LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-03-2008, 11:25 PM   #1
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Slackware Current: /dev/root?


I would be grateful if somebody would explain or provide links why Current (12.2 RC1) mounts the root partition as /dev/root. I never have seen this before. How and why does this happen? I guess I missed that day in school.
 
Old 12-04-2008, 01:20 AM   #2
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
/dev/root is a generic device which can be used in the fstab. One can also use 'rootfs'. Doing this offers some advantage in that it allows yout to be less specific. What I mean is, if the root partition is on an external drive, it may not always show up as the same device and successfully mounting it as / would require changing the fstab to match the correct device. By using /dev/root it will always match whatever device is specified in the kernel boot paramters from lilo or grub.
I'm not sure that it still works, but you used to be able to use /dev/fd2 the same way.
 
Old 12-04-2008, 02:21 PM   #3
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Where is this /dev/root method being implemented? The kernel? A udev rule?

How do I restore the old behavior?
 
Old 12-04-2008, 03:44 PM   #4
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
I'm not sure -I don't use udev, but I suspect that is where it is happening. Do you also have a device node to the real device name? Does your fstab show /dev/root or the real device name? Maybe this is part of the changes with the kernel-2.6.27 and the switch to persistent device names -I mean using /dev/sd? instead of /dev/hd?
This usage should be good nes for some as it will make it much easier to mount external devices, although it is less informative when looking at /dev and at the fstab, if indeed the fstab is alos using /dev/root.
 
Old 12-04-2008, 05:00 PM   #5
bgeddy
Senior Member
 
Registered: Sep 2006
Location: Liverpool - England
Distribution: slackware64 13.37 and -current, Dragonfly BSD
Posts: 1,810

Rep: Reputation: 232Reputation: 232Reputation: 232
I've been looking into this as well. On my test system (12.2 rc1) the /dev/root entry symlinks to /dev/hda12 which is my root parition. I can't see a udev rule to create this and wonder whether this is internal to udev or perhaps a kernel change ? It's not in my fstab either.

Google has found me information on rootfs and the /usr/src/linux/Documentation/devices.txt mentions /dev/root in the Locally defined links section. I've not had much luck tracking down what's creating this in -current though. It would be interesting to know what process creates the link.
 
Old 12-04-2008, 05:05 PM   #6
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
My fstab remains configured for the actual device partition: /dev/hda10.

Boot loader still points to /dev/hda10.

There is a new device node /dev/root pointing to the root partititon: /dev/hda10.

The remapping does not occur with 12.1. There is no /dev/root in 12.1.

I simply want to understand how this now happens and how to revert to the old way. I don't recall anything specific in the change log or changes and hints.

There was mention about CONFIG_PATA_LEGACY, but I do not have that option set in my kernel. I use the huge kernel in my VM for testing Current and I see /dev/root -> /dev/hda1. In my non virtual testing partitions, /dev/root -> /dev/sda7 but I do not have CONFIG_PATA_LEGACY set in my recompiled 2.6.27.7 kernel.

I've been searching the web but have yet to find anything.

bgeddy: Your effort parallels mine.
 
Old 12-05-2008, 01:41 AM   #7
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
Personally, I would be happy that it does that -it means you can just always use /dev/root in your fstab and depend on the kernel boot params to dtermine the real partition to mount as root. Remember all the trouble a couple of people have had recently getting their system to boot from an external drive(with and without using partition labels)?. I suggested to them then, that instead of using a label and going to the trouble of getting that to work, to just put 'rootfs' (or /dev/root/) in the fstab. It also makes it a snap to clone an installation to another partition and not have to change the fstab for it to work.
 
Old 12-05-2008, 06:23 AM   #8
zux
Member
 
Registered: Jul 2006
Location: latvia
Distribution: slackware
Posts: 140

Rep: Reputation: 26
well it's not just the kernel, I just installed the 2.6.27.7 kernel from slackware-current on my slackware-12.1 and there is no /dev/root
 
Old 12-05-2008, 01:40 PM   #9
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Quote:
well it's not just the kernel, I just installed the 2.6.27.7 kernel from slackware-current on my slackware-12.1 and there is no /dev/root
And the problem is not solely udev. Last night I disabled udev and rebooted my test box. Same result. What black magic is this?
 
Old 12-05-2008, 02:10 PM   #10
etrumbo
Member
 
Registered: Apr 2005
Location: Michigan, USA
Distribution: Slackware
Posts: 39

Rep: Reputation: 16
Quote:
Originally Posted by Woodsman View Post
And the problem is not solely udev. Last night I disabled udev and rebooted my test box. Same result. What black magic is this?
Apparently it's coming from rc.udev:

Code:
          # Create rootdev rules
          DEVICENUMBER=$( /bin/stat -c %d / )
          MAJORNUMBER=$(($DEVICENUMBER / 256))
          MINORNUMBER=$(($DEVICENUMBER % 256))

          echo 'ACTION=="add", SUBSYSTEM=="block", ENV{MAJOR}=="'$MAJORNUMBER'",
 ENV{MINOR}=="'$MINORNUMBER'", SYMLINK+="root"' > /dev/.udev/rules.d/61-dev-root
-link.rules
Not sure where fstab got updated, but it's definitely a part of -current installs.
 
Old 12-05-2008, 04:36 PM   #11
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Last night I too saw that section in rc.udev. I commented out the echo command to /dev/.udev/rules.d and rebooted my test machine. No effect as the root partition still got mapped to /dev/root. Black magic.
 
Old 12-05-2008, 05:40 PM   #12
etrumbo
Member
 
Registered: Apr 2005
Location: Michigan, USA
Distribution: Slackware
Posts: 39

Rep: Reputation: 16
Quote:
Originally Posted by Woodsman View Post
Last night I too saw that section in rc.udev. I commented out the echo command to /dev/.udev/rules.d and rebooted my test machine. No effect as the root partition still got mapped to /dev/root. Black magic.
A little something from 'devices.txt' in the kernel documentation:

Quote:
4 block Aliases for dynamically allocated major devices to be used
when its not possible to create the real device nodes
because the root filesystem is mounted read-only.

0 = /dev/root
For what it's worth, I use udev in a fresh -current installation and my fstab shows /dev/root.
 
Old 12-05-2008, 08:39 PM   #13
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Quote:
4 block Aliases for dynamically allocated major devices . . . .
Does that imply a kernel compile option that can be disabled?
 
Old 12-06-2008, 04:26 AM   #14
etrumbo
Member
 
Registered: Apr 2005
Location: Michigan, USA
Distribution: Slackware
Posts: 39

Rep: Reputation: 16
Quote:
Originally Posted by Woodsman View Post
Does that imply a kernel compile option that can be disabled?
I went looking through compile options in my kernel (2.6.26) last night but didn't see anything that explicitly mentioned it. This is just an indication that while udev works with it, its origin must be elsewhere. If I have time today, I'll look through the -current ChangeLog.
 
Old 12-06-2008, 01:05 PM   #15
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Original Poster
Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
I contacted Pat about this anomaly and the mysterious messages I reported in another thread. Here is what he wrote:

I'll start by saying that both of these issues will not happen when an initrd and the generic kernel are used. 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" category. It seems that HP-UX and other systems have been doing this for quite some time, but I'm still hazy on what the benefit is. At least /dev/root points to the actual device name after some changes to udev.

When the kernel is booted without an initrd, it will often use /dev/root for the root partition name in /etc/mtab, though this may not be true in all cases. I have found that it's possible to make "mount" output the correct name like this:

Edit /etc/mtab, removing the line with /dev/root
Run mount like this: mount -f /

In a more brutal fashion, this also seems to do the trick:

rm /etc/mtab ; mount -a

But there are some side effects, such as any partition not mounted through /etc/fstab not showing up. There may be other problems with this.

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. Or, if you use the generic kernel and an initrd, you should get the old output.


With that said, I tested the following in rc.S at line 256:

Code:
# Restore the mount command reporting the actual device node rather than /dev/root.
ROOTFS="$(readlink /dev/root)"
if [ -n $ROOTFS ]; then
 /bin/sed -i -e '/\/dev\/root/d' /etc/mtab
 /bin/mount -f /
fi
The mount command then reports the old way. At that point in rc.S, none of the non-root partitions are yet mounted, avoiding the concerns addressed by Pat. This snippet could also work in rc.local, but then the mount list would show the root partition at the bottom of the list rather than the top as many of us are accustomed because mtab by then is populated with all the mount points.

When I asked about making this change permanent, Pat wrote:

It's not a change that I would have decided to make personally, but it's probably in everyone's best interests now to just go along with it (if it's not too annoying).

I still would like to know how this black magic occurs.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Lilo hangs on /dev/hda in -current Uncle_Theodore Slackware 4 09-13-2008 09:53 PM
slackware current question on the current kernels davimint Slackware 3 06-03-2007 07:39 AM
DISCUSSION: Upgrade to Slackware -current without a -current CD truthfatal LinuxAnswers Discussion 0 09-19-2006 01:42 PM
/dev/rtc + udev in current dive Slackware 3 09-02-2006 09:37 PM
Boot Error: Root file system /dev/root adtomar Linux - Networking 0 12-27-2004 10:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration