Skip to content

Add support for systemd's systemctl reboot for passwordless reboots #861

@matkeith

Description

@matkeith

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions