-   Slackware (
-   -   How do I specify root disk in lilo (

darrin2520 06-13-2010 07:37 PM

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.



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.


Richard Cranium 06-13-2010 10:20 PM


Originally Posted by darrin2520 (Post 4002541)
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.

astrogeek 06-13-2010 10:31 PM

The UUID and LABEL...



... 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.

astrogeek 06-13-2010 10:48 PM

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...


append = "root=UUID=xxxxxxxxxxxxxxxx"

darrin2520 06-14-2010 11:31 AM

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:

/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:


image = /boot/vmlinuz
  root = /dev/sda1
  label = Original
  read-only  # Partitions should be mounted read-only for checking
image = /boot/vmlinuz
image = /boot/vmlinuz
  append = "root=UUID=df76cd54-093b-4d0e-8d37-b789a1259250"
image = /boot/vmlinuz
  append = "root=UUID=df76cd54093b4d0e8d37b789a1259250"

Only the first one works. All others give me a kernel panic with something similar to:


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.

Richard Cranium 06-14-2010 12:15 PM

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...


map (hd0) (hd4)
map (hd4) (hd0)
rootnoverify (hd4,0)
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.

TSquaredF 06-14-2010 01:17 PM

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.

Richard Cranium 06-14-2010 01:38 PM

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.]

astrogeek 06-14-2010 02:37 PM


Originally Posted by TSquaredF (Post 4003301)
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.

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!

darrin2520 06-15-2010 01:23 PM

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:

    mkinitrd -c -k -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

    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.

    image = /boot/vml_pref
      initrd = /boot/initrd.gz
      label = Linux
    image = /boot/vmlinuz
      root = /dev/sda1
      label = Fallback

    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.

    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.

/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.

swapoff /dev/sda2
mkswap -L swap
swapon /dev/sda2

TSquaredF 06-15-2010 05:18 PM


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.

tune2fs -c 50 -L root /dev/sdaX
as I usually run it anyway to set the count to 50.
Glad you got it sorted.

All times are GMT -5. The time now is 02:14 AM.