udevadm --settle

Bryan Kadzban bryan at kadzban.is-a-geek.net
Wed May 11 21:14:22 PDT 2011

DJ Lucas wrote:
> After updating from udev-165 to udev-168, I ran into a timing issue 
> with settle using tmpfs for /dev. My swap partition failed to mount 
> because the device node was not present. No other changes than those 
> made to the bootscripts and FS layout to account for /run.

Ah.  /run.

Does settle not work with the new location of the udev database?

> I rebooted a few more times to see that the problem was consistent.
> One other variable is that I'm using new bootscripts (which _should_
> provide a very minimal speed increase), but order is the same as
> stock LFS.

Is it easy to swap them out for the standard scripts?

What happens if you boot with init=/bin/bash, then manually run scripts
one at a time, until you get to udev, then both (a) run it, and (b) list
out /dev/sd*, in the same shell command?  What happens if you do (a) and
(b), then (c) rerun udevadm settle, then list again?  (All in the same
command again.)

Where is your swap?

(I'm thinking the kernel isn't sending the event to udev in time after
the trigger.  There's no way settle can wait for an event that udevd
doesn't know about yet.)

> Following a hint I found on a Debian mailing list claiming that 
> devtmpfs was faster, I enabled devtmpfs, commented out the /dev mount
>  in the udev script, and sure enough, the problem resolved itself.

Even if you use a symlink to the swap partition?  (Say, something in
/dev/disk/by-uuid.)  I'd be extremely surprised.

The kernel will put raw sd* device nodes into devtmpfs for you, but
using anything more stable in userspace will still have problems if
udevadm settle is broken somehow.

> 1. The obvious one (at least to me) is to force the use of devtmpfs 
> as upstream has intended, and remove the /dev mount from the udev 
> script.

Still breaks if you want to use stable names, I believe.

> 2. Add a sleep to the end of the udev script (how long?).

Not that I like this, but this is what the livecd did.  It added a
rootdelay=xx, to stuff an extra "sleep xx" in the initramfs.

> 3. Changing bootscript order to put checkfs before swap should give 
> enough time for udev to get the coldplug events handled and written 
> to the tempfs.

Except then one of the targets for checkfs will be missing.  :-)

> 4. It is a local issue and my troubleshooting skills are not up to 
> par. ;-)

5. (I really really hate this one...)  Bite the bullet and set up a
fully dynamic set of bootscripts, interfacing with udev directly.
(Because black magic, a la upstart or systemd, is *obviously* the right
way to go.  Sigh.)  So mounting a given filesystem will only happen
after the proper device node shows up (and will depend on udev, which
will depend on kernel FSes), and then anything that requires that FS
will depend on the mounting script.

It's a *LOT* of work though, for what I thought was very little gain.
However, if upstream has broken settle, we may not have much of a
choice...  :-(

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-dev/attachments/20110511/c057057a/attachment.sig>

More information about the lfs-dev mailing list