On Sun, 30 Nov 2014 21:07:54 +0100 Jonas Smedegaard <[email protected]> wrote: > Today when I hit CTRL+ALT+BACKSPACE on my laptop (due to an Xorg crash)
Ctrl-Alt-Backspace or Ctrl-Alt-Del? The former should *not* cause a reboot or the shutdown of services other than X (and likely wouldn't work if Xorg had already crashed). > the system started shutting down services but then at some (quite late, > I believe) point spewed out this: > > /etc/molly-guard/run.d/30-query-hostname: 48: > /etc/molly-guard/run.d/30-query-hostname: tty: not found > W: aborting reboot due to 30-query-hostname exiting with code 127. [...] > My system has separate root and /usr partitions, and I suspect the issue > might be molly-guard being invoked after /usr partition was unmounted. Yeah, that seems likely. I find it somewhat surprising that it got past line 41, which exits if stdin doesn't refer to a TTY. I would hope that scripts and services don't get a TTY on stdin (or a stdin at all other than /dev/null) during shutdown, with the exception of services that specifically need one (as cryptsetup or similar need during startup, but I would hope nothing does during shutdown). That ought to get fixed, but that seems like a separate bug. As for /usr, that really should *not* get unmounted during shutdown, except at the very last possible instant. It could, perhaps, get mounted read-only, but it should not get unmounted. That seems like a bug as well, but again, a separate one. (Ideally, one of these days, we'll use the mechanism that jumps back into the initramfs filesystem and then unmounts *all* filesystems, including the root filesystem. However, that won't happen for jessie.) However, molly-guard can work around both of those issues easily enough, as well as avoiding issues when manually interactively invoked by the sysadmin on an incompletely started or shut-down system that doesn't have /usr. I first considered switching from $(tty) to $(readlink -f /dev/stdin) (since readlink lives in /bin), but unfortunately, that only works on Linux, and version 0.4.5 switched *to* $(tty) for exactly that reason. In any case, since it seems highly unlikely that molly-guard's protection logic applies at all to a system without /usr mounted, I've added a check for "command -v tty" instead. See https://anonscm.debian.org/cgit/collab-maint/molly-guard.git/patch/?id=5306639f6f58511c7534bddc9a4d3db348fa51aa for the upstream patch; you can manually apply that patch to /etc/molly-guard/run.d/30-query-hostname locally as a workaround until molly-guard 0.5.2-1, or you can build 0.5.2-1 from the collab-maint git repo. (This didn't fail before because molly-guard only installed its binaries to /usr/sbin, so they didn't get invoked at all with /usr unmounted; now, molly-guard installs its binaries to /sbin, to remove one of only two instances in Debian of two different packages shipping different binaries with the same name in / and /usr. Thus, you won't see this issue if you use the version in jessie.) - Josh Triplett -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

