[Pkg-lirc-maint] Bug#676343: Bug#676343: lirc: /var/run/lirc contents disappear due to subtle udev interaction
Matthijs Kooijman
matthijs at stdin.nl
Wed Jul 11 13:09:28 UTC 2012
Hi Stefan,
> In my experience, with several USB/ hotpluggable lirc devices and a
> separate /var/ partition, this is the actual problem. What happens is
> that the lircd socket gets created underneath the final /var/run/,
> /run/ respectively, before it is mounted on its final place, thereby
> getting hidden and inaccessible from the clients. On a regular
> installed the most common cause for this is mounting /var/ on a
> dedicated partition, I assume something similar is the case on
> Debian-live with its writeable overlay filesystem(s).
I agree that this would cause a problem, but I am confident this is not
the problem I'm seeing here:
1. My /var is not a separate filesystem (/ is an overlay filesystem
consisting of a readonly base with a tmpfs overlay, but all of this
is setup in initrd already).
2. The lirc init script runs in rc2.d/S19, which is way later than all
of the mounting scripts (which run in rcS).
3. /var is not completely empty, /var/run/lirc does exist (but is
empty).
I'm pretty confident I know what's going on here, I just don't know what
the proper fix would be. I'll try again to make more clear what's
happening. For this, I added some debug output to my boot process. To the top
of /etc/init.d/lirc, I added:
echo "$0 $@" >> /etc/lirc.log
ps aux --forest >> /etc/lirc.log
At the end, I added:
ls -l /var/run/lirc >> /etc/lirc.log
To the top of /etc/init.d/mountall-bootclean.sh I added:
echo "$0 $@" >> /etc/lirc.log
ls -l /var/run/lirc >> /etc/lirc.log
# Use trap to run this at shell exit, since bootclean.sh is sourced below
# and uses "exit"
trap 'ls -l /var/run/lirc >> /etc/lirc.log' 0
The output from lirc.log is below. I trimmed the ps outputs a bit to show the
relevant commands only and added some newlines.
/etc/init.d/lirc restart udev
root 1 17.5 0.0 2076 596 ? Ss 14:06 0:02 init boot
root 248 1.8 0.0 2224 892 ? S 14:06 0:00 /sbin/plymouthd --mode=boot --attach-to-session
root 791 0.0 0.0 2076 84 tty1 Ss+ 14:06 0:00 init boot
root 792 1.0 0.0 1792 588 tty1 S+ 14:06 0:00 \_ /bin/sh /etc/init.d/rc S
root 841 0.0 0.0 1792 576 tty1 S+ 14:06 0:00 \_ /bin/sh -e /etc/rcS.d/S03udev start
root 892 0.0 0.0 1976 624 tty1 R+ 14:06 0:00 \_ udevadm settle
root 863 0.0 0.0 2448 888 ? S<s 14:06 0:00 udevd --daemon
root 879 0.0 0.0 2444 768 ? S< 14:06 0:00 \_ udevd --daemon
root 1046 0.0 0.0 1792 504 ? S 14:06 0:00 | \_ /bin/sh /etc/init.d/lirc restart udev
root 1048 0.0 0.0 2392 868 ? R 14:06 0:00 | \_ ps aux --forest
/etc/init.d/lirc stop
root 863 0.0 0.0 2448 888 ? S<s 14:06 0:00 udevd --daemon
root 879 0.0 0.0 2444 768 ? S< 14:06 0:00 \_ udevd --daemon
root 1046 0.0 0.0 1792 544 ? S 14:06 0:00 | \_ /bin/sh /etc/init.d/lirc restart udev
root 1073 0.0 0.0 1792 504 ? S 14:06 0:00 | \_ /bin/sh /etc/init.d/lirc stop
root 1074 0.0 0.0 2536 960 ? R 14:06 0:00 | \_ ps aux --forest
total 0
/etc/init.d/lirc start udev
root 863 7.0 0.0 2448 888 ? S<s 14:06 0:00 udevd --daemon
root 879 0.0 0.0 2444 768 ? S< 14:06 0:00 \_ udevd --daemon
root 1046 0.0 0.0 1792 544 ? S 14:06 0:00 | \_ /bin/sh /etc/init.d/lirc restart udev
root 1360 0.0 0.0 1792 512 ? S 14:06 0:00 | \_ /bin/sh /etc/init.d/lirc start udev
root 1361 0.0 0.0 2392 876 ? R 14:06 0:00 | \_ ps aux --forest
total 4
srw-rw-rw- 1 root root 0 Jul 11 14:36 lircd
-rw-r--r-- 1 root root 5 Jul 11 14:36 lircd.pid
total 4
srw-rw-rw- 1 root root 0 Jul 11 14:36 lircd
-rw-r--r-- 1 root root 5 Jul 11 14:36 lircd.pid
/etc/rcS.d/S13mountall-bootclean.sh start
total 4
srw-rw-rw- 1 root root 0 Jul 11 14:36 lircd
-rw-r--r-- 1 root root 5 Jul 11 14:36 lircd.pid
total 0
/etc/rc2.d/S19lirc start
root 2101 0.0 0.0 1792 584 ? Ss 14:06 0:00 /bin/sh /etc/init.d/rc 2
root 2353 0.0 0.0 1792 508 ? S 14:07 0:00 \_ /bin/sh /etc/rc2.d/S19lirc start
root 2850 0.0 0.0 2392 868 ? R 14:07 0:00 \_ ps aux --forest
root 1372 0.0 0.0 3104 600 ? Ss 14:30 0:00 /usr/sbin/lircd --driver=default --device=/dev/lirc0
root 1377 0.0 0.0 1720 56 ? Ss 14:30 0:00 /usr/sbin/lircmd --uinput
root 1382 0.0 0.0 1736 64 ? Ss 14:30 0:00 /usr/bin/irexec -d /etc/lirc/lircrc
total 0
As can be seem from above, this is what happens:
- rcS.d/S03udev triggers an add event, which starts restarts (== stop +
start) lirc. The lirc socket and pidfile are in place.
- Then, rcS.d/S13mountall-bootclean.sh runs. Before the cleaning, the
lirc socket and pidfile are stil there. After the cleaning they are
gone.
- Later on, rc2.d/S19lirc tries to start lirc as part of the normal
boot process. However, since lirc is already running, it doesn't
start. However, since the socket is gone, lirc is running but
unusable now!
Looking at this, it seems there is nothing about this problem that is
specific to my Debian live setup, I would expect this problem to occur
on all systems (but perhaps not all systems trigger hotplug events in
rcS.d for LIRC devices)?
> If you're trying it on Debian live systems, you better inject a fixed
> package[1] into the ISO build - but I'm not familiar with Debian-live
> specifics.
> [1] by applying this patch
> http://lists.alioth.debian.org/pipermail/pkg-lirc-changes/2011-May/000568.html
> to 0.9.0~pre1-1.
I applied this patch, but it didn't change anything (above output was
made with the patch applied).
Gr.
Matthijs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-lirc-maint/attachments/20120711/52c51536/attachment.pgp>
More information about the Pkg-lirc-maint
mailing list