[SOLVED] lilo.conf: is "root=" recommended when using initrd?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
A more recent version of the file also shows the "root = " setting used with "initrd = " in the example.
My understanding was that "root = " wasn't necessary and actually shouldn't be used with initrd. It wasn't necessary because the root partition is included in the initrd.
It shouldn't be used together in the lilo.conf because of problems in the /boot/initrd-tree/init program with setting/passing/parsing the $ROOTDEV parameter. GazL identified the section of code involved in this post.
In the same thread from 2012 Alien Bob mentions not using "root = ".
Quote:
Originally Posted by Alien Bob
Did anyone yet try to remove the "root=" line in your lilo.conf ? I have been deleting that line for years as it is not needed, even confusing, when using an initrd.
I'm getting failures when booting in Slackware64-14.2 with RAID and LUKS-encrypted root directory. It doesn't mount root file system as it's mapped as the init created "luks<base name>" instead of the name in lilo.conf or the initrd. In my case device /dev/md12 is mapped as device luksmd12. It unlocks the device then tries to mount device cryptroot which is the root name in initrd and lilo.conf.
EDIT: To Clarifiy ... I only get these failures above when including the "root = " parameter in lilo.conf. Otherwise the system boots without a problem.
What is the current best practice for using these two parameters in lilo.conf and do the current examples in documentation agree with the current best practice?
Last edited by TracyTiger; 09-19-2016 at 01:12 AM.
Reason: Clarification of when failures occur.
Does your /boot/initrd-tree/etc/mdadm.conf file contain anything other than comments?
Yes I direct the contents of the current RAID configuration there.
Code:
mdadm --detail --scan > /etc/mdadm.conf
This results in a file containing "ARRAY" lines.
I believe I'm following best practices regarding RAID with linux partition types of "da - Non-FS data" and block devices in /etc/fstab identified by UUID. My arrays containing from 2 to 5 disk partitions always assemble. I don't have any problems as long as I don't identify a root device for an image block in lilo.conf.
EDIT: I edited my original post to clarify that I'm only having boot failures when using the "root = " parameter.
EDIT-2: I finally correctly read your question. The file /boot/initrd-tree/etc/mdadm.conf also has the ARRAY lines of the system. Same data as /etc/mdadm.conf.
Last edited by TracyTiger; 09-19-2016 at 01:43 AM.
Reason: Correctly read question asked of me.
A more recent version of the file also shows the "root = " setting used with "initrd = " in the example.
This is the way I have always done it.
Quote:
Originally Posted by TracyTiger
What is the current best practice for using these two parameters in lilo.conf and do the current examples in documentation agree with the current best practice?
There is nothing in the documentation which says that the two options should not be used together.
Have you used both in lilo.conf with RAID and/or LUKS on the root disk?
No.
The document you're questioning doesn't mention anything about either of those special circumstances.
In fact, the very first example it gives doesn't even specify a root partition... in which case it is not only recommended, but necessary to have both lines in your lilo.conf.
No. The document you're questioning doesn't mention anything about either of those special circumstances.
Thanks for the response. The document on the install disk README_CRYPT.TXT also shows a lilo example using both parameters when the root disk is encrypted.
The examples in the documentation are general in nature. You will almost always need to modify them if you have a special use case.
What you call a "special use case" I see as just one of the normal features of Slackware. There are README files for RAID, LVM, and encryption encouraging their use. I want to use these features of Slackware and configure them correctly.
These "special use cases" are mostly adequately documented in my opinion. I'm just having difficulty with the lilo configuration that accompanies these Slackware features. My experience isn't matching up with the documentation as I understand it.
Perhaps I'm having problems with lilo and the documentation because I'm doing something wrong. I want to learn the correct way, so I'm asking.
If you look at /usr/src/linux/Documentation/initrd.txt you'll notice that the linux documentation actually says one should specify root=/dev/ram0 when using an initrd. Unfortunately, the slackware initrd's init script would break if you actually pass this value. The init script could probably do with something like the following to cope should someone actually follow the official docs.
Code:
root=/dev/ram0)
# Ignore '/dev/ram0' and use value embedded in the initrd file.
;;
root=/dev/*)
ROOTDEV=$(echo $ARG | cut -f2 -d=)
;;
Anyway, short answer. Don't pass root= from lilo.conf if you're using an initrd. At best it's unnecessary and at worst it will cause problems for the logic in the initrd's init-script (which admittedly could use a little work).
Yes I direct the contents of the current RAID configuration there.
Code:
mdadm --detail --scan > /etc/mdadm.conf
This results in a file containing "ARRAY" lines.
I believe I'm following best practices regarding RAID with linux partition types of "da - Non-FS data" and block devices in /etc/fstab identified by UUID. My arrays containing from 2 to 5 disk partitions always assemble. I don't have any problems as long as I don't identify a root device for an image block in lilo.conf.
EDIT: I edited my original post to clarify that I'm only having boot failures when using the "root = " parameter.
EDIT-2: I finally correctly read your question. The file /boot/initrd-tree/etc/mdadm.conf also has the ARRAY lines of the system. Same data as /etc/mdadm.conf.
Actually, your first response answered the point that I was heading toward.
If you do have an mdadm.conf file in your initrd, it had better contain the information to build your arrays. A readable mdadm.conf file in your initrd that consists entirely of comments will supress the scan to auto-create the arrays.
A readable mdadm.conf file in your initrd that consists entirely of comments will supress the scan to auto-create the arrays.
So it's better to have the file missing from the initrd-tree than to have an existing file without information?
IF the mdadm.conf file is missing, in general is it better to have the linux partition types as the deprecated "fd - Linux raid auto" or as type "da -Non-FS data"?
So it's better to have the file missing from the initrd-tree than to have an existing file without information?
IF the mdadm.conf file is missing, in general is it better to have the linux partition types as the deprecated "fd - Linux raid auto" or as type "da -Non-FS data"?
In answer to your first question, yes. There's this bit from the initrd init script:
Code:
# Initialize RAID:
if [ -x /sbin/mdadm ]; then
# If /etc/mdadm.conf is present, udev should DTRT on its own;
# If not, we'll make one and go from there:
if [ ! -r /etc/mdadm.conf ]; then
/sbin/mdadm -E -s >/etc/mdadm.conf
/sbin/mdadm -S -s
/sbin/mdadm -A -s
# This seems to make the kernel see partitions more reliably:
fdisk -l /dev/md* 1> /dev/null 2> /dev/null
fi
fi
...which leads me to state that the answer to your second question is no. It is merely sufficient to have an mdadm.conf file in your initrd that is correct or to not have one at all.
EDIT: The default /etc/mdadm.conf file that is installed is exactly wrong for the way the initrd's init script is written; it contains only comments.
Last edited by Richard Cranium; 09-19-2016 at 08:46 PM.
Since I posted this thread I installed Slackware64-14.2 three times; plain default, with RAID1 on root partition, and with LUKS encryption on root partition. I used various lilo.conf settings with and without using "root = " and "initrd = " together.
If everything else is configured correctly, the only system startup failure was when using both lilo.conf parameters (root,initrd) with LUKS encryption. In that case (when using /dev/sda2 as root) "lukssda2" is mapped (/dev/mapper/lukssda2) instead of the name chosen, cryptroot in this case.
(Workaround to finish startup ...At this point the system drops you into a shell and the problem can be fixed by closing the lukssda mapping, mapping and opening cryptroot then exiting to continue the system startup.)
Short of modifying a program or two, it would be nice if there was a note about not using both lilo.conf parameters in the "Encrypted root filesystem" section of the README_CRYPT.TXT document.
The use of both "root = " and "initrd = " in lilo when using RAID1 on the root partition without encryption doesn't appear to cause problems. There are other ways to mess up a RAID setup impacting bootup as LQ member Richard Cranium has explained in multiple posts over the years.
Regarding my initial question: "In a lilo.conf should the options "root = " and "initrd = " be used in the same image block?" The answer is best summed up by GazL's response.
Quote:
Don't pass root= from lilo.conf if you're using an initrd. At best it's unnecessary and at worst it will cause problems for the logic in the initrd's init-script (which admittedly could use a little work).
Not to throw a spanner in the works, but I have been using a generic kernel+initrd+LUKS for years, and have always referenced both "root=" and "initrd=" in /etc/lilo.conf as directed in README_CRYPT.txt"
And I haven't yet run into trouble related to doing so. But then, I don't use a RAID array.
I'm also not overly tempted to experiment by removing "root=" and rebooting...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.