[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#606806: initramfs-tools: Handling of numeric root= arguments is not udev-friendly



Package: initramfs-tools
Version: 0.98.1
Severity: normal
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu natty ubuntu-patch

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.

-- System Information:
Debian Release: squeeze/sid
  APT prefers maverick-updates
  APT policy: (500, 'maverick-updates'), (500, 'maverick-security'), (500, 'maverick')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.35-23-generic (SMP w/1 CPU core)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
=== 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*//')
 		;;
 	[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


Reply to: