Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] uuid and Lilo
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Beetle B.
Guru
Guru


Joined: 01 Mar 2003
Posts: 517

PostPosted: Mon Feb 11, 2019 6:14 am    Post subject: [SOLVED] uuid and Lilo Reply with quote

My Gentoo uses Lilo for the bootloader. I use the usual /dev/sda convention. My boot and root are in /dev/sda.

Adding a new HD is Hell. It insists on being /dev/sda, breaking booting. In the past I would always fix this using a rescue disk, and editing lilo/fstab, etc.

I'm kind of sick of that. I'd rather use UUID. However, I'm not sure what I need to do. I can update lilo.conf and replace the boot and root fields. What about the initramfs? Does it need to be regenerated, and if how? (This is prior to plugging in the new HD). How do I handle that? And do I need to modify fstab? And any scripts I have with sda and sdb hard coded?


Thanks.
_________________
Beetle B.

Please update the table of equivalents.
A Firefox guide.


Last edited by Beetle B. on Tue Feb 12, 2019 2:20 am; edited 1 time in total
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5761

PostPosted: Mon Feb 11, 2019 8:02 am    Post subject: Reply with quote

The boot= line only matters while reinstalling the bootloader from a fully running system, it's not used during boot at all. You can use anything you see fit in /dev/ for that, I use the /dev/disk/by-id/ata-* symlink for the hard disk.

The root= line is more difficult. lilo reads it during boot and passes it straight to the kernel, and that either forwards it to an initramfs for early userspace to interpret, or without that it tries to mount what it sees. An initramfs can understand root=UUID=etc syntax, but a bare kernel only understands root=/dev/sd??. You may want to make two bootloader entries with a root=/dev/sdaX and root=/dev/sdbX while you get this working. There's nothing wrong with having your boot disk permanently be /dev/sdb, I do that myself.

For fstab, the most reliable setup is to have a GPT partition table and use the PARTUUID=foo identifiers which /sbin/blkid gives you. (It's possible to convert a MBR disk in-place to GPT, but dangerous.)
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Mon Feb 11, 2019 2:13 pm    Post subject: Reply with quote

Beetle B.

What Ant P. said but the kernel also understands root=PARTUUID= without an initrd.

Code:
$ /sbin/blkid
/dev/sda1: UUID="9392926d-6408-6e7a-8663-82834138a597" TYPE="linux_raid_member" PARTUUID="0553caf4-01"
...

Notice that the filesystem UUID and PARTUUID are different.
It works with both GPT and MSDOS disklabels.

Warning: Its not safe to use PARTUUID with MSDOS partitions > 04. This is because logical partitions get renumbered if you delete one.

You can put root=PARTUUID= into the APPEND statement in lilo.conf if you have to.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Beetle B.
Guru
Guru


Joined: 01 Mar 2003
Posts: 517

PostPosted: Mon Feb 11, 2019 7:04 pm    Post subject: Reply with quote

So let me do this step by step.

Current scenario: I have not yet added the new HD. My boot and root are in /dev/sda. If I were to insert the new HD, the new one would become /dev/sda.

I currently do use initramfs.

So right now, I should:

1. Update lilo, and update the boot option.

I'm still unclear about the root option. I take it if I put the UUID path there, the initramfs will pick it up. But I still need to worry about the kernel? Or since I have an initramfs I need not worry about the kernel at all?

And do I need to regenerate my initramfs (before inserting the new HD)? Or do I just use the one I'm using now since it will get the path passed in as an argument?

Regarding fstab, I'm not clear how to update. If I replace it with the UUID paths that may not work? Is it a given that I'm using MBR since I use Lilo? I would rather not move away from Lilo. I tried Grub when I installed Gentoo recently, and it's surprising how I couldn't change the default option when booting (everything I found on the Forums and Wiki did not work, and several people had the same problem).

Thanks.
_________________
Beetle B.

Please update the table of equivalents.
A Firefox guide.
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 7089
Location: Saint Amant, Acadiana

PostPosted: Mon Feb 11, 2019 7:09 pm    Post subject: Reply with quote

Last time I checked Lilo refused PARTUUID, is it improved now?
_________________
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Mon Feb 11, 2019 10:05 pm    Post subject: Reply with quote

Beetle B.,

If you use the filesystem UUID to describe root, you must have an initrd that contains the userspace mount utility as the kernel cannot understand filesystem UUID.
Provided your initrd already has the mount utility, it will just work.

When you add a new HDD it may become sda. Kernel device names are allocated in device discovery order, so you can't actually tell until you do it.

Its always safe to use UUID in /etc/fstab. /etc/fstab cannot be read until root is mounted. Once root is mounted, the mount utility is available from the root filesystem.

I don't think you can pass root=PARTUUID= in lilo.conf but append can contain any random strings.
I'm not sure if root= can be empty or missing either.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Beetle B.
Guru
Guru


Joined: 01 Mar 2003
Posts: 517

PostPosted: Mon Feb 11, 2019 11:26 pm    Post subject: Reply with quote

Quote:
Provided your initrd already has the mount utility, it will just work.


How can I check this?
_________________
Beetle B.

Please update the table of equivalents.
A Firefox guide.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43178
Location: 56N 3W

PostPosted: Mon Feb 11, 2019 11:38 pm    Post subject: Reply with quote

Beetle B.,

The initrd file is either a mini root filesystem in a (compressed) file, or a compressed cpio archive of other cpio archives.
The former has mostly been replaced by the latter.

Unpack the initrd and see if it contains /bin/mount
Also check the init script to ensure that it will parse UUID on the kernel command line.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Beetle B.
Guru
Guru


Joined: 01 Mar 2003
Posts: 517

PostPosted: Tue Feb 12, 2019 2:19 am    Post subject: Reply with quote

It did. And I got it working. Thanks.
_________________
Beetle B.

Please update the table of equivalents.
A Firefox guide.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum