-
-
Notifications
You must be signed in to change notification settings - Fork 268
Simplify reboot halt poweroff and shutdown in case of systemd #1011
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
Simplify reboot halt poweroff and shutdown in case of systemd #1011
Conversation
…hutdown.sh replaces in the rear recovery system /bin/reboot /bin/halt /bin/poweroff /bin/shutdown by scripts that basically do umount -a and systemctl --force [reboot halt poweroff] to make reboot halt poweroff and shutdown work simpler and more fail-safe (issue 953).
|
I tested it on SLES12-SP2-RC2 and with RESCUE g136:~ # cat /bin/reboot #!/bin/bash echo umounting all filesystems umount -vfar &>/dev/null echo reboot in 3 seconds... sleep 3 systemctl --force reboot RESCUE g136:~ # cat /bin/halt #!/bin/bash echo umounting all filesystems umount -vfar &>/dev/null echo halt in 3 seconds... sleep 3 systemctl --force halt RESCUE g136:~ # cat /bin/poweroff #!/bin/bash echo umounting all filesystems umount -vfar &>/dev/null echo poweroff in 3 seconds... sleep 3 systemctl --force poweroff and RESCUE g136:~ # cat /bin/shutdown
#!/bin/bash
command=poweroff
for arg in "$@" ; do
case "$arg" in
(-r|--reboot) command=reboot ;;
(-H|--halt) command=halt ;;
esac
done
$command
which seem to work well for me according to my very first tests. |
|
Hmm - I think running umount verbose but then |
|
Now I umount actually verbosely. |
|
The more I use it, the more I like it. |
|
@gdha Furthermore I ask for feedback if you like my verbose umounting Personally I prefer verbosity (in contrast to the traditional Unix |
…ail safe (issue 953).
…wn.sh (issue 953).
|
Something is wrong with the test if systemd is not used test -d $ROOTFS_DIR/usr/lib/systemd/system || return 0 that I copied from I tested on a non-systemd machine (SLES11-SP4) in my case I.e. it seems in the rear recovery system there is a ...investigating... |
|
It seems the test if systemd is used in if ps ax | grep -v grep | grep -q systemd ; then Furthermore it seems |
|
It is not 10_copy_as_is.sh that copies the content This way the rear recovery system becomes 236K bigger $ du -hsc $( find usr/share/rear/skel/default/ | grep systemd ) 16K usr/share/rear/skel/default/etc/systemd 12K usr/share/rear/skel/default/run/systemd 196K usr/share/rear/skel/default/usr/lib/systemd 12K usr/share/rear/skel/default/var/run/systemd 236K total but that is a different issue. |
…roff_shutdown.sh (issue 953).
|
I fixed the test if systemd is used. # Skip if systemd is not used. # Because the scripts below need the systemctl executable and because # via prep/GNU/Linux/28_include_systemd.sh and build/GNU/Linux/10_copy_as_is.sh # systemctl gets only copied into the recovery system if systemd is used, # we can test here (i.e. after build/GNU/Linux/10_copy_as_is.sh had already run) # if /bin/systemctl exists in the recovery system: test -x $ROOTFS_DIR/bin/systemctl || return 0 Now it works for me on SLES12-SP2 with systemd @gdha |
|
@jsmeix looks perfect to! Thank you for the quick fix. |
…s_used_issue1097 Skip remount sync when systemd is used. Remounting all what is mounted below /mnt/local with sync option is no longer needed when systemd is used because when systemd is used reboot, halt, poweroff, and shutdown are replaced by scripts that do umount plus sync to safely shut down the recovery system, see #1011 and #1097 Furthermore remounting with sync option could become in practice a major annoyance because it makes writing anything below /mnt/local basically unusable slow, see #1097
|
@schlomo I.e. before there was only plain 'systemctl --force reboot' But again: |
The new script
build/GNU/Linux/63_simplify_systemd_reboot_halt_poweroff_shutdown.sh
replaces in case of systemd in the rear recovery system
/bin/reboot /bin/halt /bin/poweroff and /bin/shutdown
by scripts that basically do
"umount -a" and "systemctl --force [reboot halt poweroff]"
to make reboot halt poweroff and shutdown work simpler
and more fail-safe, see #953