Another step to avoid hang at bootup
Look back at the blog posts over the last few weeks, to see issues with freezing at bootup tackled. After the release of Easy 7.0, there is still random hanging, that required pressing of the power-off button and a reboot.
It may be now that the final step has been taken to fix this. EasyOS has the simple busybox init (with pup_event service management) and runs /etc/rc.d/rc.sysinit prior to login. Both the init and login operations are provided by busybox.
One of the things that rc.sysinit does is replay udev events, which causes various actions such as loading the correct kernel modules for the existing hardware. rc.sysinit launches the 'udevd' daemon, then runs 'udevadm' to trigger hardware events, followed by "udevadm settle" which waits until all udev events have been processed.
Except that EasyOS has not done it quite like that. The "settle"
operation has not been done; instead, a later script,
/usr/bin/xwin, waits for the kernel video driver to load, before
starting Xorg. This was done to speed bootup, reasoning that
rc.sysinit can surge ahead doing lots of other stuff while the
kernel modules are still being loaded (and anything else that udev
events want to do). This has been OK for years, but now, it seems,
is causing occasional hanging.
So, what I have done is brought back the "settle" and this is now the code in rc.sysinit:
[ -f /etc/udev/hwdb.bin ] && rm -f /etc/udev/hwdb.bin
udevadm hwdb --update
udevd --daemon --resolve-names=early --children-max=32 --event-timeout=20 >/tmp/udevd-debug.log 2>&1
sleep 0.1
udevadm trigger --action=add --attr-nomatch=driver --type=subsystems
udevadm settle #--timeout=5
udevadm trigger --action=add --attr-nomatch=driver --type=devices
udevadm settle
What has changed since 7.0 is shown by highlighted bold
characters.
7.0 has children-max=80, but I decided to bring it down to 32, which doesn't have any noticeable effect on bootup time.
There are two "udevadm settle", the first had a timeout=5, which as far as I have determined in testing is not required. The last one was commented-out for years, and is, it seems (the lack thereof) the cause of random hanging.
I have been booting up with this code 8-9 times, without any
freeze, so it is looking good.
Tags: easy