-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for systemd's systemctl reboot for passwordless reboots #861
Comments
Thanks for the report! Does the Though the |
@SteveLauC yeah it looks like typing "reboot" without sudo works as well for me on bazzite as well |
I found that this root-less reboot only works if you have local access to your machine, i.e., not ssh, when you do it via ssh: $ reboot
Call to Reboot failed: Interactive authentication required. See also: Getting errors whenever I try to reboot or shutdown through terminal |
Bummer. I found some additional info from ubuntu's forum as well specifically these criteria: On Ubuntu 14.10 and older, sudo is required. The introduction of Systemd in 15.04 changed the way Ubuntu handles shutdown and reboot:
so it seems there are more nuances involved than simply using ssh. reboot would fail on a multiuser system or if an application were to prevent it.
reboot is just pointed at systemctl reboot anyhow. I don't see a way around this intelligently. oh well =/ |
So, it seems that:
Let me implement this. |
I want to suggest some general feature
Topgrade should allow for reboot without requiring a sudo password by using command "systemctl reboot" if the system is running systemd.
More information
If the linux system uses systemd you do not need to reboot using sudo, which requires typing in a password. Instead use the command "systemctl reboot" which will just reboot the system without further user action
https://www.freedesktop.org/software/systemd/man/latest/sd_booted.html
"Internally, this function checks whether the directory /run/systemd/system/ exists. A simple check like this can also be implemented trivially in shell or any other language."
Seems like you can check for this folder in rust and then execute the alternate command "systemctl reboot" instead in the below function
pub fn reboot() -> Result<()> { print!("Rebooting..."); Command::new("sudo").arg("reboot").status_checked() }
I do not know how to test this from a side branch, as I am using bazzite, an immutable desktop. I'm willing to give it a try though if there are instructions somewhere.
The text was updated successfully, but these errors were encountered: