Bug#606806: initramfs-tools: Handling of numeric root= arguments is not udev-friendly
On Sat, Dec 11, 2010 at 01:14:42PM -0800, Evan Broder wrote:
>
> If you pass a root= argument with a numeric device number
> (i.e. root=0806), that's currently resolved by running mknod to create
> a /dev/root device with an appropriate major/minor number and setting
> ROOT=/dev/root (the parse_numeric function in scripts/functions).
>
> However, this /dev/root device is completely unknown to udev. On
> Ubuntu, this leads to problems because we use udev to wait for the
> root device to appear. Since /dev/root isn't in udev's database, the
> boot hangs forever (well, it hangs until rootdelay passes).
>
> udev's standard configuration creates /dev/block/N:N symlinks for
> every block device in its database (see the first non-comment line of
> /lib/udev/rules.d/50-udev-default.rules). Setting ROOT to the
> /dev/block/N:N symlink instead of creating a new /dev/root device and
> setting ROOT to that solves Ubuntu's problem.
>
> See https://bugs.launchpad.net/bugs/576429 for more discussion.
>
> We've applied a patch (attached) to do this, and thought you might be
> interested in doing the same.
>
> Thanks.
thank you for submitting, I had seen it and had a question to the patch.
> === modified file 'scripts/functions'
> --- scripts/functions 2010-10-04 22:34:10 +0000
> +++ scripts/functions 2010-11-27 02:56:12 +0000
> @@ -364,8 +364,8 @@
> return
> ;;
> [0-9]*:[0-9]*)
> - minor=${1#*:}
> - major=${1%:*}
> + minor=$(echo ${1#*:} | sed -e 's/^0*//')
> + major=$(echo ${1%:*} | sed -e 's/^0*//')
I had wondered why you remove leading nulls, but now thanks
to your aboves desc I do not understand.
Now the trouble is the implementation, please use shell parameter
expansion. sed assumes busybox in the initramfs, which might not be
with the case with BUSYBOX=no for small initramfs or mem constraint
boxes. something like ${minor#0}, not sure if we need to account for more
then 2 prefixed zeroes, in this case shell guru's can give a hint.
> ;;
> [A-Fa-f0-9]*)
> value=$(( 0x${1} ))
> @@ -377,8 +377,7 @@
> ;;
> esac
>
> - mknod -m 600 /dev/root b ${major} ${minor}
> - ROOT=/dev/root
> + ROOT=/dev/block/${major}:${minor}
> }
>
> # Parameter: device node to check
this assumes udev running in initramfs for the symlink.
together with devtmpfs and force loading one can built one without,
but I agree that this may now be very special case.
thank you for the feedback.
--
maks
Reply to: