Arch Linux

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#25659 - [udev] /dev/root symlink is not created

Attached to Project: Arch Linux
Opened by Paride Legovini (torn) - Thursday, 18 August 2011, 22:44 GMT
Last edited by Tom Gundersen (tomegun) - Friday, 26 August 2011, 16:20 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Tobias Powalowski (tpowa)
Jan de Groot (JGC)
Tom Gundersen (tomegun)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No


The /dev/root symlink to the the actual device mounted as the root filesystem is not created. In this way one ends with a broken mount output, e.g.

% mount
/dev/root on / type ext4 (rw,relatime,barrier=1,data=ordered)

where /dev/root does not exist. This breaks any script that relies on mount to find the root filesystem device, for example grub-mkconfig:

# grub-mkconfig
/sbin/grub-probe: error: cannot stat `/dev/root'.

For comparison in Debian there's an udev rule (/lib/udev/write_dev_root_rule) that created the /dev/root symlink.

Just in case it matters I'm running Linux-3.0.3 without an initramfs/initrd.
This task depends upon

Closed by  Tom Gundersen (tomegun)
Friday, 26 August 2011, 16:20 GMT
Reason for closing:  Won't fix
Additional comments about closing:  The problems described should be fixed in other packages. Adding /dev/root is not the solution.
Comment by Tobias Powalowski (tpowa) - Friday, 19 August 2011, 06:22 GMT
/dev/root was removed since ages from udev.
It caused more issues than it helped, imho.
Comment by Paride Legovini (torn) - Friday, 19 August 2011, 13:39 GMT
Thank you for your reply.
So how do I deal with the programs that look for /dev/root? For example grub-mkconfig doesn't work for me at the moment, as I wrote in the bug description.
Comment by Tom Gundersen (tomegun) - Friday, 19 August 2011, 18:46 GMT
@torn: I don't know why /dev/root is not in upstream udev (tpowa would know better, as this was added and removed before my time), my best guess would be that chroot'ing and bindmounts causes problems.

I can reproduce the problem (running without the initrd). I fear this has to be fixed in the kernel, as /dev/root does not seem to make much sense to me.
Comment by Paride Legovini (torn) - Friday, 19 August 2011, 20:11 GMT
I think that if they put that /dev/root into the kernel there's a good reason for it, for example it may be impossible for the kernel to use /dev/sda* as it doesn't know its existence at the very beginning of the boot process, so it uses a generic /dev/root instead of it.

May devtmpfs give a solution?
Comment by Tom Gundersen (tomegun) - Friday, 19 August 2011, 20:20 GMT
Yeah, it almost certainly will not be simple (or even possible) to fix in the kernel (or it would have been). My guess was just that doing it in user-space would be worse (due to the same /dev being mounted in different roots). I suggest taking this to udev upstream, as they surely would be able to say for certain if this is something that could be done by them.

I'm able to reproduce with devtmpfs (by the way, if you are not using devtmpfs, you should. /dev on tmpfs is hardly tested anymore and is known to be suboptimal).
Comment by Paride Legovini (torn) - Friday, 19 August 2011, 20:35 GMT
Well, in Debian, where the symlink is created, there are no problems with duplicate mount entries AFAIK. I don't think it will be fixed in udev upstream: as you said for the kernel, they would have already fixed it if it was possible or easy.

What in my opinion is really bad is that at the moment it isn't possible in Arch Linux to use a kernel without an initrd and have grub.cfg created by the standard tools. I have to write it by hand. I also find strange that this issue is not mentioned in the kernel compiling howto page on

Comment by Tom Gundersen (tomegun) - Friday, 19 August 2011, 21:21 GMT
We should probably fix the grub tool for this case. I guess the reason it is not more of a problem is that it does not happen with the standard Arch kernel. I'm not using grub, so I don't know anything about how the tool works, maybe you could file a bug report against grub to make them aware of the problem?
Comment by Tom Gundersen (tomegun) - Friday, 19 August 2011, 21:31 GMT
@torn, I forgot to add:

What happens in Debian if /dev/root points to /dev/sda1 and that /dev/sdb1 is another partition, and you then do:
mount /dev/sdb1 /mnt
mount --bind /dev /mnt/dev
chroot /mnt /bin/bash
ls -l /dev/root
Comment by Tobias Powalowski (tpowa) - Saturday, 20 August 2011, 06:09 GMT
Adding Jan to the bugreport and Gerardo both should know why /dev/root was removed.
I think it was something with dbus.
Comment by Gerardo Exequiel Pozzi (djgera) - Saturday, 20 August 2011, 17:26 GMT
@Tobias: me? Not added but I read this task.

/dev/root is used if is the kernel that mounts root filesystem from block device [init/do_mounts.c] or from ramdisk block device [init/do_mounts_rd.c], /dev/root is created by the kernel in rootfs (is not a symlink). In other words if not initramfs mechanism is used to mount root [init/initramfs.c] like in Arch Linux.

Anyway using or not using devtmpfs does not care, /dev/root node will not exists (neither if devtmpfs is automatically mounted by kernel).

The question is: why this /dev/root is not created in devtmpfs when main namespace is created [init/do_mounts.c]? I do not know. Maybe because devtmpfs_mount always return 0 if not supported and also 0 if supported but not mounted automatically. Maybe because create such node will be out-of-control from devtmpfs or does not fit in the devtmpfs logic. Maybe mounting root via kernel is deprecated for general purpose (crossing fingers). I think that Kay Sievers (devtmpfs and udev author) give the right answer here. I am just guessing!
Comment by Paride Legovini (torn) - Sunday, 21 August 2011, 01:48 GMT
Dear Tom (and others),

As you suggested I'll file a bug report for grub too. I'm not sure that's the right place where to fix the issue, but at least they should be aware of it.
Comment by Paride Legovini (torn) - Sunday, 21 August 2011, 18:03 GMT Comment by Tobias Powalowski (tpowa) - Tuesday, 23 August 2011, 06:10 GMT

I never added myself to that discussion, but the only reason for having
a /dev/root is because it shows up in the mount output. Without
a /dev/root symlink, hal would be unable to detect what device was the
root device.
As hal is dead and /dev/root doesn't show up in standard mount output,
it's no longer required and we decided to kill it. I think it was killed
during the udev rules cleanup, as it required special udev rules to get
it working.

Comment by Paride Legovini (torn) - Tuesday, 23 August 2011, 20:31 GMT
I understand the point, but /dev/root *do* show up in the standard mount output, and programs relying on that output (for example the cited grub helper scripts) won't find what device is mounted in /, as /dev/root doesn't exist.
Comment by Tom Gundersen (tomegun) - Tuesday, 23 August 2011, 21:53 GMT
@torn: a very simple workaround is to use an initramfs.

You can create a minimal one using mkinitcpio with /etc/mkinitcpio.conf containing only
Comment by Gerardo Exequiel Pozzi (djgera) - Wednesday, 24 August 2011, 00:07 GMT
Or trivially but not dynamic: "ln -s /dev/your-partition /lib/udev/devices/root". Just keep in mind this if you change your root-partition on migration ;)

@Tom: That will works if Paride has initramfs support. (For example I do not have it enabled)
Comment by Tom Gundersen (tomegun) - Wednesday, 24 August 2011, 00:19 GMT
@djgera: That's correct. Forgot you could disable it altogether.
Comment by Paride Legovini (torn) - Wednesday, 24 August 2011, 13:08 GMT
@Tom, @djgera: yes, I normally don't use kernels with initramfs enabled. I don't have anything against it, but as I don't need it I use to keep it disabled.

@djgera: thank you for the suggestion on putting the symlink in /lib/udev/devices/, I'll try that.