2008-03-19 23:11:44

by Bill Nottingham

[permalink] [raw]
Subject: race between SCSI uevents and media detection

For a typical livecd boot using udev, you'd check for the root device
with a udev rule like:

KERNEL=="sr[0-9]", PROGRAM=="/lib/udev/vol_id -l %N", RESULT="<some label>",
SYMLINK+="root"

This creates a /dev/root symlink to whichever CD device holds the proper
CD/DVD.

However, this currently fails repeatedly on some machines, as the run
of vol_id gets ENOMEDIUM attempting to open the CD device. I suspect
this is because the initial medium scan is actually done after the
uevent for /dev/sr0 is emitted.

Can the open path be fixed to block until the medium state is initially
known? I don't see how this can be worked around from userspace - you
don't get another uevent for the media detection.

Bill