This is indeed the generally correct order, though I think it's a bit
too primitive for real-world shutdown on more dynamic systems,
particularly desktops. It's good practice to touch /etc/nologin or
/run/nologin, sync the dirty buffers to disk, turn off swap, detach
loopback and volumes (DeviceMapper, etc.) and so on.
A theoretically advantegeous thing that systemd does (Linux-specific,
obviously) is to exec() itself into a separate shutdown loop process
that finishes by handing back control to the initramfs, so that rootfs
can actually be unmounted. I hear this was recently merged into logind
directly, which doesn't leave a good taste in my mouth. Just how
essential this also is can debated.
Still, this is useful enough for simpler, more static systems. OpenWrt's
procd has a hardcoded shutdown sequence that isn't much more complicated
than your four lines.
On 06/09/2015 10:24 AM, Steve Litt wrote:
> Hi all,
>
> I know the last part of system shutdown or reboot, after I've killed my
> daemontools-supervised processes, has the following features:
>
> * killall5 -15; sleep 2; killall5 -9; sleep 2
>
> * umount -a
>
> * mount -o remount,ro /dev/sda1
>
> * /sbin/halt or /sbin/reboot
>
> Could somebody confirm which order these things come in?
>
> Thanks,
>
> SteveT
>
> Steve Litt
> June 2015 featured book: The Key to Everyday Excellence
> http://www.troubleshooters.com/key
Received on Tue Jun 09 2015 - 17:19:43 UTC