[TriLUG] / is /dev/root and not /dev/sda?

Joseph Mack NA3T jmack at wm7d.net
Tue Jun 12 22:05:06 EDT 2012


On Tue, 12 Jun 2012, Cristóbal Palmer wrote:

thanks for the excellent sleuthing

> Some slackware users wondered about it back in 2008:
>
> http://www.linuxquestions.org/questions/slackware-14/slackware-current-dev-root-688189/

I had found this one, where people couldn't track down the 
origin of the problem. I gave up before getting to the end 
where there's a posting from "Pat"

"
Piter Punk first notified me of the kernel change to using 
/dev/root in places, and while I thought it was not 
necessarily a good idea, it falls into the "get used to it" 
.
.
As far as I am aware, there is no straightforward way to 
return the old behavior. It's probably advisable to figure 
out workarounds for any problems with /dev/root that don't 
involve trying to get mount to produce the old output.

"

The origin of the problem isn't explained, although you can 
have an init script to modify /etc/mtab straight after / is 
mounted but before anything else is mounted.

Here's what I did (minor modification of the posted method)


# Restore the mount command reporting the actual device node rather than /dev/root.
ROOTFS="$(readlink /dev/root)"  #/dev/root -> /dev/sda3, put by rc.udev
if [ -n $ROOTFS ]       #true if string of non-zero length, ie returns sda3
then
  /bin/sed -i -e '/\/dev\/root/d' /etc/mtab
  /bin/mount -o remount,rw  /
fi

> Google helped me find it in Linux back in 2003:
>
> https://www.kernel.org/pub/linux/kernel/people/gregkh/misc/2.5/devfs-cleanup-2.5.40.patch

this is with devfs. I ignored this because devfs didn't 
survive. However it shows /dev/root has been around for a 
while. It never showed up till 18mo ago on one of my 
machines, so it was never forced on me.

> Ditto, this time for the 2.4 kernel:
>
> http://www.kernel.org/pub/linux//kernel/people/marcelo/linux-2.4/Documentation/filesystems/devfs/ChangeLog
>
> And that last one provides a real "Aha!"

I only found devfs entries concerned with /dev/root

> -----8< snip 8<-----
> - Created /dev/root symlink
>  Thanks to Roderich Schupp <rsch at ExperTeam.de>
>  with further modifications by me
> -----8< snip 8<-----

symlinks in /dev/ aren't causing me any problems. The 
slackware posting tells you that removing it doesn't cure 
the problem. It's the entry mtab and what df sees that are 
the problem.

However the location of the udev rule is sheer bastardry. 
There are udev rules in /etc/udev and in /lib/udev. This 
rule (the only one) is in /dev/.udev. I wasn't looking for 
udev rules there.

> and more searching based on that puts it at 1998:
> http://lkml.indiana.edu/hypermail/linux/kernel/9810.0/0515.html
>
> I'll reserve research on the history of devfs and the rationale for
> the /dev/root alias for another day. For now, I'll ask what your
> /etc/mtab shows, because I'm guessing that shows the right pairing of
> / and the underlying device you want.

/etc/mtab has /dev/root too. That was part of my original 
posting

I assume the kernel is causing it. Why I haven't noticed it 
till 18mo ago I don't know. Why it's in the kernel, other 
than "get used to it", is being kept quiet.

Thanks for the pointers
Joe

-- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!


More information about the TriLUG mailing list