LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 06-13-2010, 06:37 PM   #1
darrin2520
LQ Newbie
 
Registered: Jun 2010
Posts: 6

Rep: Reputation: 4
How do I specify root disk in lilo


With the continued growth of SATA devices, I have really been having problems with my boot loader. In the old days, it was pretty easy to make sure that the IDE devices stayed put. However, now everything is an sd device. Specifying a root directory of /dev/sda1 in lilo is no longer a sure thing. If you have a USB device plugged in or an ESATA device, your sd devices are no longer guaranteed to stay put.

In reading through the lilo documentation, it appears that you can specify root devices by UUID or even by LABEL.

Code:
root="UUID=xxxxx..."
root="LABEL=root"
However, at the present time this is not working for me and I get a kernel panic that it can not find my root device when trying either of these methods.

I stumbled across something that said that this was not possible in Slackware? Is this true?

Also, does grub support this type of thing. I really don't want to use grub if I can avoid it. I am very old school and having been using lilo since Slackware first came out. But it is imperative that I find a solution.

How about a udev rule? I am just not sure when these get loaded and if it would be available to the boot loader.

I have looked everywhere and I can't seem to get a definitive answer on this. I am shocked that this is not more of an issue to more people.

Any input, advice or work arounds would be greatly appreciated.

Thanks.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 06-13-2010, 09:20 PM   #2
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.1
Posts: 1,544

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by darrin2520 View Post
If you have a USB device plugged in or an ESATA device, your sd devices are no longer guaranteed to stay put.
Well, your SATA and/or SCSI drivers should be loaded prior to any USB drivers. You can set up your initrd to do that.

As for any ESATA devices, can't you set your BIOS to put them at the end of the device list? (I don't know if that is the case or not; I don't have any ESATA devices to test this.)

The major strength of grub is that it allows you to interactively set things when you are booting to get around issues like this; that is very convenient.
 
Old 06-13-2010, 09:31 PM   #3
astrogeek
Senior Member
 
Registered: Oct 2008
Distribution: Slackware: 12.1, 13.1, 14.1, 64-14.1, -current, FreeBSD-10
Posts: 1,976

Rep: Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769
The UUID and LABEL...

Code:
root="UUID=xxxxx..."
root="LABEL=root"
... method works with lilo, although as I recall the use of quotes is not intuitive.

I am away from the machine that I use that method with so cannot look quickly, but will do so later this evening.
 
Old 06-13-2010, 09:48 PM   #4
astrogeek
Senior Member
 
Registered: Oct 2008
Distribution: Slackware: 12.1, 13.1, 14.1, 64-14.1, -current, FreeBSD-10
Posts: 1,976

Rep: Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769
I just remembered that I recently posted this solution and found it here

In the stanza for your Slackware boot add the root device by UUID or LABEL to the append line, like this...

Code:
append = "root=UUID=xxxxxxxxxxxxxxxx"
 
Old 06-14-2010, 10:31 AM   #5
darrin2520
LQ Newbie
 
Registered: Jun 2010
Posts: 6

Original Poster
Rep: Reputation: 4
Thanks for the answers. Definitely gave me some things to try. Mostly this has to do with SATA add-on cards. I think with a kernel recompile I could probably force it to load the drivers for the main board first followed by the add-on cards and probably get around this.

That being said, it is a bit of pain to fix this problem in this manner.

Astrogeek, I have tried to use the append command without any luck. Perhaps someone can see where I have made a mistake.

Here is the output from my blkid:
Code:
/dev/sda1: LABEL="root" UUID="df76cd54-093b-4d0e-8d37-b789a1259250" TYPE="ext4"
/dev/sda2: UUID="4f6c3fd8-d986-4e42-b2c6-0affa2d1ffe7" TYPE="swap" LABEL="swap"
/dev/sdb1: UUID="25330763-690c-4470-b75a-3ca9fa58e903" SEC_TYPE="ext2" TYPE="ext3" LABEL="music"
As you can see, the labels have taken and are posted. Here is 4 different boot entries that I have in lilo.conf:

Code:
image = /boot/vmlinuz
  root = /dev/sda1
  label = Original
  read-only  # Partitions should be mounted read-only for checking
image = /boot/vmlinuz
  label=alt
  append="root=LABEL=root"
  read-only
image = /boot/vmlinuz
  label=alt2
  append = "root=UUID=df76cd54-093b-4d0e-8d37-b789a1259250"
  read-only
image = /boot/vmlinuz
  label=alt3
  append = "root=UUID=df76cd54093b4d0e8d37b789a1259250"
  read-only
Only the first one works. All others give me a kernel panic with something similar to:

Code:
VFS: Cannot open root device "UUID=..." or unknown-block(0,0)
Has anyone gotten this to work with lilo on slackware actually? I read a blurb somewhere that for whatever reason this won't work on slackware. Is it worth it to try grub? Or am I better off to just retool the kernel to try to get sATA drives to load in the proper order?

Thanks again for your help. Your suggestions so far were very helpful.
 
Old 06-14-2010, 11:15 AM   #6
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.1
Posts: 1,544

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Do your cards all use different drivers? If so, then just change the module order in /boot/initrd-tree/load_kernel_modules and re-create your initrd.gz file. (I think you can do the same thing via the order that you give modules in mkinitrd's -m option.)

In grub, you can swap drives around. For instance, my Windows drive (hey, ya gotta be able to play games) is not the first drive on my machine. My grub config file has...

Code:
map (hd0) (hd4)
map (hd4) (hd0)
rootnoverify (hd4,0)
makeactive
chainloader +1
...which swaps the first and fifth drive on my machine for the boot environment. The thing that threw me for a long time was that grub still referred to the original order for all of its commands; that's why the rootnoverify uses (hd4,0) instead of (hd0,0).

I know that Pat and the gang don't care for grub, but I've found it flexible and fairly easy to use.
 
Old 06-14-2010, 12:17 PM   #7
TSquaredF
Member
 
Registered: Dec 2005
Location: "The South Coast of Texas"
Distribution: Slackware64-current
Posts: 490
Blog Entries: 1

Rep: Reputation: 55
You need an initrd to get "root=LABEL=foo", etc. to work. The code was added to /boot/initrd-tree/init by Eric Hameleers a while back, but that's the only place it exists.
Regards,
Bill
 
Old 06-14-2010, 12:38 PM   #8
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.1
Posts: 1,544

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Hmm, now that you mention it TSquaredF, 13.1 appears to also support "root=UUID=*" up to the ability of findfs to locate it.

[edit: You did put "etc" in there. I'll leave this as a testimony on my inability to read.]

Last edited by Richard Cranium; 06-14-2010 at 02:26 PM.
 
Old 06-14-2010, 01:37 PM   #9
astrogeek
Senior Member
 
Registered: Oct 2008
Distribution: Slackware: 12.1, 13.1, 14.1, 64-14.1, -current, FreeBSD-10
Posts: 1,976

Rep: Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769Reputation: 769
Quote:
Originally Posted by TSquaredF View Post
You need an initrd to get "root=LABEL=foo", etc. to work. The code was added to /boot/initrd-tree/init by Eric Hameleers a while back, but that's the only place it exists.
Regards,
Bill
Thanks TSquaredF, I did not know that. I always use the generic kernels so I never bumped into it, now I understand better why some people have difficulty getting it to work!

Last edited by astrogeek; 06-14-2010 at 01:39 PM. Reason: Grammer, spelling, keyboard dyslexia...
 
Old 06-15-2010, 12:23 PM   #10
darrin2520
LQ Newbie
 
Registered: Jun 2010
Posts: 6

Original Poster
Rep: Reputation: 4
Huge thanks to everyone that responded. I am extremely impressed with the knowledge of the responses as well as the quickness. I have this set up now and running exactly as I intended.

I thought I would provide a quick summary of what I ended up doing to get this working. As I mentioned previously, I am a bit old school. I have been using Slackware almost since it first came out. I have never used, nor needed to use initrd before. I always compile a custom kernel with the drivers I need in the kernel. So just a quick howto for those that may come across this in the future.

Assigning root device by name in lilo with Slackware
Using a device label or name to specify your root (and other) drives is much easier and more dynamic than using the assigned sd device. In the old days with hd devices it was very easy to control how the device numbers were assigned. However, with sd devices becoming more popular with add on cards for both SATA and ESATA devices, it is much more difficult to control how these device numbers are assigned when you add a card or a drive. By using disk labels, this is no longer an issue. Here are some simple steps to make this work. Replace the /dev/sd? and names to suit your needs.
  1. Setup initrd
    While I don't know the exact how's and why's, it is necessary to use initrd in order to specify your root device by name. initrd is simply a small filesystem loaded into RAM. This is actually pretty simple to do. Under /boot, there is a utility called mkinitrd. Basically you need to run this, with everything needed to get your root drive up. In my case, I needed a file system (ext4) and a SATA driver (sata_sis). The following is what I used:
    Code:
    mkinitrd -c -k 2.6.33.4 -m ext4 -m sata_sis
    The -c tells mkinitrd to clear all previous modules out. The -k tells it what kernel version to use. The -m loads a module/driver. For more information on all of this there is a readme under /boot called README.initrd. Also there is a man page for mkinitrd
  2. Name your volume
    You need to name your volume. It is possible to do this with UUID's as well, but using names is a lot easier. Using a utility called e2label that you can use on ext formatted disks
    Code:
    e2label /dev/sda1 root
    Pretty straight forward, /dev/sda1 is the device, root is the name it will be assigned.
  3. Modify lilo.conf and load
    Edit the file under /etc/lilo.conf to add a new boot entry. I always add a new entry when I am testing, so that if things go really wrong, I can fallback on the original boot loader that was known to be working. This is highly recommended whether you are trying a new kernel or anything. These are the two entries I have. Linux is the tester and Fallback is the original setup at install.
    Code:
    image = /boot/vml_pref
      initrd = /boot/initrd.gz
      label = Linux
      append="root=LABEL=root"
      read-only
    image = /boot/vmlinuz
      root = /dev/sda1
      label = Fallback
      read-only
    Note that the image is different. This isn't necessary, but probably something that you want to do, even if vml_pref just links to the generic kernel.

    Make sure you run lilo to load the boot loader. (I forget this step every once in a while...)
  4. Update fstab
    Similar to the boot loader, you will also need to update the fstab so that the drives are remounted properly as well. Simply replace the device designation (/dev/sda1) with LABEL=root (or whatever name you are using. Here is a sample of my fstab. Notice that I have named all my drives to make them device designation independent.
    Code:
    LABEL=swap      swap             swap     defaults         0   0
    LABEL=root      /                ext4     defaults         1   1
    LABEL=music     /mnt/music       ext3     defaults         0   0
    LABEL=backup    /mnt/backup      ext3     defaults         0   0

That is it! Now the boot loader will always mount the volume named "root" as the root device.

Here is a print of my current blkid as well. As you can see, once I added external SATAs and some other drives after installing slackware, my root device is actually assigned sdd1. I could care less now though.
Code:
/dev/sdb1: UUID="40bc8a19-c078-469f-bdf0-82612cfd70e1" SEC_TYPE="ext2" TYPE="ext3" LABEL="music"
/dev/sda1: UUID="8b95e160-93ac-fa7d-77fc-79722dfa36a6" TYPE="linux_raid_member"
/dev/sdd1: LABEL="root" UUID="df76cd54-093b-4d0e-8d37-b789a1259250" TYPE="ext4"
/dev/sdd2: LABEL="swap" UUID="4f6c3fd8-d986-4e42-b2c6-0affa2d1ffe7" TYPE="swap"
/dev/sdc1: LABEL="backup" UUID="15afcd80-c442-4bd5-9c0a-545f1d37eda1" TYPE="ext3"
/dev/sde1: LABEL="music" UUID="25330763-690c-4470-b75a-3ca9fa58e903" TYPE="ext3"
Also, one last thing, you can only label ext devices using e2label. There may be a way to label other devices, but I don't know of any, except the swap device. To label a swap device, you will need to turn it off first and then remake it and name it.
Code:
swapoff /dev/sda2
mkswap -L swap
swapon /dev/sda2
 
3 members found this post helpful.
Old 06-15-2010, 04:18 PM   #11
TSquaredF
Member
 
Registered: Dec 2005
Location: "The South Coast of Texas"
Distribution: Slackware64-current
Posts: 490
Blog Entries: 1

Rep: Reputation: 55
Quote:
Darrin2520:
Also, one last thing, you can only label ext devices using e2label. There may be a way to label other devices, but I don't know of any
I use tune2fs to set both label & # of mounts between fscks.
Code:
tune2fs -c 50 -L root /dev/sdaX
as I usually run it anyway to set the count to 50.
Glad you got it sorted.
Regards,
Bill
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Incresing disk device to / root disk Redhat Enterprise server 4 lamoul Red Hat 1 03-25-2010 04:40 PM
root disk with LILO sheky Slackware 1 11-10-2005 03:44 AM
Lilo lost, Install disk failing to restore Lilo on dual boot? Dobie Linux - Newbie 2 05-05-2004 05:00 PM
Installing Slack using Boot Disk (root disk stalls!) guardian653 Slackware 3 10-07-2003 04:03 PM
Lilo Boot Disk BittaBrotha Slackware 7 07-31-2002 12:08 AM


All times are GMT -5. The time now is 03:46 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration