* Roger Leigh <rle...@codelibre.net>, 2012-11-08, 00:22:
mountall-bootclean.sh removes files from /run, but these may include
files created by init scripts earlier in the same boot process. I
observed this because the script nuked files in /run/udev/, leaving
my X server without any input devices.
I can still reproduce this bug.
That's a bit frustrating, I thought we had this nailed now.
Would it be possible to debug this in a bit more detail on your system?
/lib/init/bootclean.sh's clean function must be failing all these
checks:
# Does not exist
[ -d "$dir" ] || return 1
# tmpfs does not require cleaning
[ -f "$dir/.tmpfs" ] && return 0
# Can clean?
checkflagfile "$dir" || return 0
# Already cleaned
[ -f "${dir}/.clean" ] && return 0
# Can't clean yet?
which find >/dev/null 2>&1 || return 1
Could you possibly put some print statements in there and find out if
all these pass? If so, is the ".tmpfs" file missing? Or the ".clean"
flag file? If that's the case, we really need to know why they aren't
present, since they should have been created before this point.
If the init scripts are being run in the wrong order, these could
potentially be run after the files were deleted.
This is what happens with the attached patch:
Thu Nov 8 12:17:30 2012: Cleaning up temporary files....
Thu Nov 8 12:17:30 2012: BEFORE BOOTMISC: [ .tmpfs dhclient.eth0.pid initctl
initramfs lock mount network sendsigs.omit.d shm udev utmp ]
Thu Nov 8 12:17:30 2012: AFTER BOOTMISC: [ dhclient.eth0.pid initctl initramfs
lock mount network sendsigs.omit.d shm udev utmp ]
Thu Nov 8 12:17:31 2012: Setting up X socket directories... /tmp/.X11-unix
/tmp/.ICE-unix.
Thu Nov 8 12:17:31 2012: BEFORE MOUNTALL-BOOTCLEAN: [ dhclient.eth0.pid
initctl initramfs lock mount network sendsigs.omit.d shm udev utmp ]
Thu Nov 8 12:17:31 2012: Cleaning up temporary files... /tmp /lib/init/rw /run
/run/lock /run/shm.
Thu Nov 8 12:17:31 2012: AFTER MOUNTALL-BOOTCLEAN: [ .clean initramfs lock
mount network sendsigs.omit.d shm udev utmp ]
Thu Nov 8 12:17:31 2012: INIT: Entering runlevel: 2
(This is on a VM on which I had to impose a sleep to make the bug
trigger. However, the bug also triggers naturally on my development
machine, which I can't reboot right know, though I'm pretty sure the
cause is the same there.)
As I understand it, bootmisc is supposed to be run _after_
mountall-bootclean, though this order doesn't seem to be enforced in any
way.
--
Jakub Wilk
--- unpacked/etc/init.d/mountall-bootclean.sh 2012-05-25 00:39:27.000000000 +0200
+++ /etc/init.d/mountall-bootclean.sh 2012-11-08 12:00:27.567362205 +0100
@@ -14,8 +14,11 @@
case "$1" in
start|"")
+ sleep 2
# Clean /tmp, /var/lock, /var/run
+ echo BEFORE MOUNTALL-BOOTCLEAN: \[ $(ls -A /run) \]
clean_all
+ echo AFTER MOUNTALL-BOOTCLEAN: \[ $(ls -A /run) \]
exit $?
;;
restart|reload|force-reload)
--- unpacked/etc/init.d/bootmisc.sh 2012-05-25 00:39:27.000000000 +0200
+++ /etc/init.d/bootmisc.sh 2012-11-08 12:00:28.087361602 +0100
@@ -41,7 +41,9 @@
case "$1" in
start|"")
+ echo BEFORE BOOTMISC: \[ $(ls -A /run) \]
do_start
+ echo AFTER BOOTMISC: \[ $(ls -A /run) \]
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2