The init file /etc/init.d/lighttpd contains a line LIGHTTPD_PID="$($(which lighttpd) -pf ${LIGHTTPD_CONF} | grep pid | cut -d '=' -f 2 | tr -d \\\" | tr -d [:space:])" This line runs the lighttpd program with the -p flag to print parsed configuration. The problem is that when the filesystem is in read-only state, for example when booting, lighttpd -p hangs (I don't know if it wants to write somewhere or what...). Thus this command hangs. This file is called from /lib/rc/sh/gendepends.sh to get service dependencies, before setting the filesystem read-write, thus hanging the boot process of the whole system. As a result the system hangs on booting after writing the lice Caching service dependencies. I had to change the line to LIGHTTPD_PID="$(cat ${LIGHTTPD_CONF} | grep pid | cut -d '=' -f 2 | tr -d \\\" | tr -d [:space:])" to make it work.
Hi. I'm OK that change. We could even remove one shell spawn by avoiding calling cat: LIGHTTPD_PID="$(grep pid ${LIGHTTPD_CONF} | cut -d '=' -f 2 | tr -d \\\" | tr -d [:space:])" Could you try and report back? It should work as well. If it does, I'll commit the change straight away.
(In reply to Patrice Clement from comment #1) > Hi. I'm OK that change. We could even remove one shell spawn by avoiding > calling cat: > LIGHTTPD_PID="$(grep pid ${LIGHTTPD_CONF} | cut -d '=' -f 2 | tr -d \\\" | > tr -d [:space:])" > > Could you try and report back? It should work as well. If it does, I'll > commit the change straight away. working
Ah, nice catch! The change looks good to me.
The improved version of the fix (monsieurp's) was added to the Gentoo repository. Re-sync and re-emerge lighttpd to receive the updated copy. Commit ID: 258e3475e0eda930f424d3141cb3ba9fc0f87a9a Thanks for reporting, Marek!
Thank for the fix! I looked at hangup issue today on virtual server. It hung for me because 'lighttpd -t' called 'getrandom()' which blocks unless random pool is initialized in kernel. As a result boot took 3 minutes. Openrc calls gendepend (and 'lighttpd -t' at top level) even before /etc/init.d/urandom is called. /etc/init.d/urandom is supposed to refill entropy pool after previous boot.
I also suggest revbumping ebuilds for users to pull init.d change sooner.
lighttpd 1.4.44 was released in Dec 2016 (the month following the discussion here) and deferred the call to li_rand_init(). That change in lighttpd 1.4.44 should have addressed the issue raised here. The change made here to LIGHTTPD_PID in /etc/init.d/lighttpd, should probably be reverted, as it has caused problems. See https://bugs.gentoo.org/626688, where I have referred back to this issue and suggested the same solution.