summaryrefslogtreecommitdiff
path: root/rc.shutdown
diff options
context:
space:
mode:
Diffstat (limited to 'rc.shutdown')
-rwxr-xr-xrc.shutdown43
1 files changed, 25 insertions, 18 deletions
diff --git a/rc.shutdown b/rc.shutdown
index 5928b2d..4b513f7 100755
--- a/rc.shutdown
+++ b/rc.shutdown
@@ -19,20 +19,6 @@ run_hook shutdown_start
stop_all_daemons
-status "Shutting down UDev" udevadm control --exit
-
-status "Deactivating Swap" swapoff -a
-
-# stop monitoring of lvm2 groups before unmounting filesystems
-[[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) ]] &&
- status "Deactivating monitoring of LVM2 groups" vgchange --monitor n
-
-run_hook shutdown_prekillall
-
-kill_all
-
-run_hook shutdown_postkillall
-
stat_busy "Saving Random Seed"
RANDOM_SEED=/var/lib/misc/random-seed
install -TDm 0600 /dev/null $RANDOM_SEED
@@ -51,9 +37,30 @@ stat_done
# Write to wtmp file before unmounting
halt -w
-# if we don't have devtmpfs support, /dev is mounted as tmpfs, so don't unmount it
-status "Unmounting Filesystems" \
- umount -a -r -t nodevtmpfs,notmpfs,nosysfs,noproc,nodevpts -O no_netdev
+# stop monitoring of lvm2 groups before unmounting filesystems
+[[ $USELVM = [Yy][Ee][Ss] && -x $(type -P lvm) ]] &&
+ status "Deactivating monitoring of LVM2 groups" vgchange --monitor n
+
+# any future uevents can and should be ignored
+status "Shutting down UDev" udevadm control --exit
+
+run_hook shutdown_prekillall
+
+kill_all
+
+run_hook shutdown_postkillall
+
+run_hook shutdown_preumount
+
+# unmount any non-api partitions that are backed by swap, we don't want to
+# move their contents into memory (waste of time and might caues OOM).
+status "Unmounting Swap-backed Filesystems" umount_all "tmpfs"
+
+# almost everything is dead now, so the swap should hopefully be relatively
+# empty, and quick to switch off
+status "Deactivating Swap" swapoff -a
+
+status "Unmounting Non-API Filesystems" umount_all
run_hook shutdown_postumount
@@ -116,7 +123,7 @@ if [[ -x /run/initramfs/shutdown ]]; then
else
status "Remounting Root Filesystem Read-only" \
- mount -n -o remount,ro /
+ mount -n -o remount,ro /
# Power off or reboot
printsep