NI Linux Real-Time Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Reboot button cRIO-903x in panel Embedded UI

Solved!
Go to solution

Hello;

I want to put a button in the panel of the embedded UI to allow the user to reboot the system.

I Get restart from the command line as an administrator, but want the lvuser could reboot the system with a button on the panel.

I'm able to reboot the cRIO using the shell as administratos, but  I want th lvuser coul reboot the system with a button on the panel.

Is there any way to do it?

Thanks

Image and video hosting by TinyPic
<script type="text/javascript" async src="//cdn.youracclaim.com/assets/utilities/embed.js"></script>
0 Kudos
Message 1 of 7
(4,053 Views)

What version of the software stack are you using (from MAX's "Operating System" entry or by running the command "uname -a", both while the target has software installed)?

I think the issue you're running into is that the "reboot" command is not on a normal user's path, you need to call out a direct path to /sbin/reboot. This is a symlink to a symlink to a binary (/sbin/reboot -> /sbin/reboot.sysvinit -> /sbin/halt.sysvinit).

The binary that it eventually points to has a special permission bit set: the setuid bit. This special bit tells the kernel to look at the ownership of the file and use that for the capabilities for running the binary (e.g. run the binary as if the owner of the binary file is running the binary). This binary is owned by admin/root.

I did a quick check on a target sitting on my desk by using the su command to become the lvuser user, calling /sbin/reboot directly, and it works as expected. I am not really in a convenient place to check if calling the same binary from LV works as well, but if not you should report that.

Message 2 of 7
(3,809 Views)

Thanks BradM

Calling /sbin/reboot works fine.

Thanks

Image and video hosting by TinyPic
<script type="text/javascript" async src="//cdn.youracclaim.com/assets/utilities/embed.js"></script>
0 Kudos
Message 3 of 7
(3,809 Views)
Solution
Accepted by topic author anderg

Hi anderg,

There's also a restart VI that should work as well, you just have to pass in a session:

restart.png

0 Kudos
Message 4 of 7
(3,809 Views)

SAL9000,

I blame my answer on a lack of coffee. It did directly answer the question, but is not the best answer.

andberg,

I certainly recommend using the actual LV functionality, not the SystemExec calling the function, as I suggested.

0 Kudos
Message 5 of 7
(3,809 Views)

Is there an easy way to call this from the Xfce desktop (maybe a link to a batch file or similar) or menu or taskbar?




DSH Pragmatic Software Development Workshops (Fab, Steve, Brian and me)
Release Automation Tools for LabVIEW (CI/CD integration with LabVIEW)
HSE Discord Server (Discuss our free and commercial tools and services)
DQMH® (Developer Experience that makes you smile )


0 Kudos
Message 6 of 7
(2,707 Views)

Hey joerg.hampel,

 

I did a quick test and you can create a file that calls /sbin/reboot and call it from a launcher on the XFCE desktop. 

 

For example, I created a file /home/lvuser/restart with the following.

#!/bin/bash

/sbin/reboot

 

Then, I called the file restart from a launcher after creating a new panel on the desktop. This worked and rebooted the target.

 

Thanks,

Andy 

PSE

 

 

Message 7 of 7
(2,692 Views)