/etc/init.d/umountfs is run during shutdown to unmount most filesystems. It contains this:
PROTECTED_MOUNTS="$(sed -n ':a;/^[^ ]* \(\/\|\/usr\) /!{H;n;ba};{H;s/.*//;x;s/\n//;p}' /proc/mounts)" This command apparently selects a subset of the lines in /proc/mounts, which then become exempt from being unmounted later in the script.
It matches lines with / or /usr in the second field (the mount point) and then what it does next involves too many exotic sed features for me to figure out what the intent is.
It would make sense if this was just selecting the / and /usr lines, since those get unmounted in a different script. But it doesn't do that. When I run it on my actual /proc/mounts, $PROTECTED_MOUNTS ends up containing almost all the lines, including the /home line. It's not good if /home doesn't get unmounted, so that can't be right.
What could the writer of that sed command possibly have meant to do, with all that branching and hold space stuff?
EREthough the syntax assumesgnu sed, why doingn;ba? Isn't that the same as simply usingbor even better,d? AndHwhen either... or... ? Why not using it only once, at the top of the script, so that it applies to all lines ? [[:shrugs:]]/etc/init.d/umountfsis not run at all, at startup or shutdown, by default in Debian, from Debian 8 onwards. It is masked by a symbolic link at/lib/systemd/system/umountfs.service./usrpart which is new in Debian 9.