FS#7574 - udev root symlink script incompatible with lilo

Attached to Project: Arch Linux
Opened by Sergej Pupykin (sergej) - Friday, 06 July 2007, 13:17 GMT
Last edited by Greg (dolby) - Tuesday, 17 June 2008, 10:39 GMT
Task Type Bug Report
Category System
Status Closed
Assigned To Tobias Powalowski (tpowa)
Eric Belanger (Snowman)
Architecture All
Severity High
Priority Normal
Reported Version 2007.05 Duke
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
Udev /lib/udev/root-link.sh incompatible with lilo.

$ dmesg | grep 'Kernel command'
Kernel command line: BOOT_IMAGE=arch ro root=302 quiet

so /lib/udev/root-link.sh does not work

Steps to reproduce:
Boot with lilo and check /dev/root file

Solution:
I have no ideas about symlink, but may be something like this will be usefull:

#!/bin/sh
# Creates root symlink in /dev
# for Arch Linux by Roman Kyrylych <Roman.Kyrylych@gmail.com>


if ! [ -L /dev/root ]; then
ROOT=$(cat /proc/cmdline | sed "s: :\n:g" | grep root= | sed "s:root=::")
if [ "x${ROOT:0:4}" == "x/dev" ]; then
ln -f -s $ROOT /dev/root
else
ROOT_MAJ=`echo -e "ibase=16\n$ROOT/100" | bc`
ROOT_MIN=`echo -e "ibase=16\n$ROOT%100" | bc`
mknod -m 0660 /dev/root b $ROOT_MAJ $ROOT_MIN
chown root.disk /dev/root
fi
fi
This task depends upon

Closed by  Greg (dolby)
Tuesday, 17 June 2008, 10:39 GMT
Reason for closing:  Fixed
Comment by Roman Kyrylych (Romashka) - Sunday, 15 July 2007, 10:52 GMT
I wonder why it is root=302.
IIRC there was a patch long time ago to make lilo pass normal style root=/dev/sda to kernel. Tpowa, can you correct me?
Comment by Tobias Powalowski (tpowa) - Monday, 23 July 2007, 19:02 GMT
puh i don't use lilo since early 2000, so i don't know actually
Comment by Damjan Georgievski (damjan) - Friday, 27 July 2007, 00:40 GMT
Why is the /dev/root link needed anyway? ... is it only because of HAL?
I've noticed something, cat /proc/mounts on my Arch system gives me:
<code>/dev/root / ext3 rw,noatime,data=ordered 0 0</code>
but on a Debian system it gives me:
<code>/dev/hda1 / ext3 rw,data=ordered 0 0</code>

So maybe if we find what the difference is, and make /proc/mount on Arch be as the Debian case, the HAL problem will be solved too?
Comment by Roman Kyrylych (Romashka) - Friday, 27 July 2007, 08:11 GMT
AFAIK /dev/root is the only known way to fix  FS#5519  which is was very annoying bug.
It would be cool if lilo pass root=/dev/sda1 instead of root=302 to kernel.
Comment by Damjan Georgievski (damjan) - Friday, 27 July 2007, 21:05 GMT
Romashka, yes I know ... I wonder if another way is possible ...  FS#5519  is really a HAL bug, where HAL reads from /proc/mounts instead of /etc/mtab, right? It would be silly to patch udev, lilo, grub, initcpio etc.. just for a HAL bug, isn't it...

BTW I'll try to help here, I can check with Debian and Slackware (Slack has the same problem actually).

Does anyone know where is the command that mounts the root filesystem in the initramfs? Is it the last line in /lib/initcpio/init (exec kinit ...)???
Comment by Jan de Groot (JGC) - Friday, 27 July 2007, 23:17 GMT
Debian also shows /dev/root and rootfs mounted on /, not the real device. That's what I see on debian etch with kernel 2.6.22.1 (no initrd).

Referring to /etc/mtab is quite crappy: it's a user controlled file that doesn't always reflect what is mounted currently. /proc/mounts does, and so will some sysfs equivalent do. Mounts belong in the kernel, let the kernel manage the mount table then. Hal runs on top of udev and the kernel, so it's no point in looking for a file controlled by userspace tools.

About the dev/root symlink: this is how all other distros solve it, though they create the file from initrd as normal block device instead of a symlink.
Comment by Damjan Georgievski (damjan) - Saturday, 28 July 2007, 00:46 GMT
Ok, so it's not a HAL problem then.

In Debian 4.0 *with* initrd and the default 2.6.18-4-686 kernel /proc/mounts is correct ... so it seems that the Debian initrd scripts do it right...

The difference is that Arch just calls /bin/kinit -- "root=${root}", while Debian mount's the rootfs in it's scripts, and then moves /sys and /proc to /root/sys and /root/proc ...

If you have a Debian near you can check /usr/share/initramfs-tools/scripts/local (mountroot is defined here) and /usr/share/initramfs-tools/init

As far as I understood, if you are mounting without an initrd then:
1) you can't specify the root device by-label, or by-uuid, or LABEL=
2) you can't have anything else but /dev/root in /proc/mounts
Comment by Eric Belanger (Snowman) - Wednesday, 20 February 2008, 23:00 GMT
I use lilo.
You can pass root=/dev/sda to kernel with lilo. On my system /dev/root is a broken symlink whch points to a non-existing /dev/308. My system boots and works fine though.
Comment by Eric Belanger (Snowman) - Wednesday, 20 February 2008, 23:41 GMT
I just tested and I have the hal/nautilus problem too.
Comment by Roman Kyrylych (Romashka) - Wednesday, 20 February 2008, 23:51 GMT
Eric, could you confirm that the proposed fix works with lilo and grub (creates /dev/root correctly)?
Comment by Eric Belanger (Snowman) - Friday, 22 February 2008, 05:01 GMT
For some reason the proposed fix doesn't work on start-up (lilo). Neither the symlink nor block device are created. If it's ran after the system is started, it creates the block device.

Also, on further test, it seems that it is not necessary anymore. Nautilus only displays one icon for the root filesystem. Either the update to udev 118 fixed it or I mistook the entries for my winxp or backup partition.
Comment by Tobias Powalowski (tpowa) - Monday, 24 March 2008, 09:33 GMT
can we close this now?

Loading...