help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: grub: eval vars for linux command / write config agnostic to other d


From: Pascal Hambourg
Subject: Re: grub: eval vars for linux command / write config agnostic to other disks
Date: Sat, 28 Mar 2020 20:49:35 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

Le 28/03/2020 à 17:56, Toerless Eckert a écrit :
I would like to have a grub config that will work even
if the disk is re-plugged into a different SATA port
and independent of whether other disks are plugged in.

Lets say i today have this config:

  set root='hd5,gpt2'
  search --no-floppy --fs-uuid --set=root 4bdb3675-62ff-499f-9fc4-e5fd8c7ba777
  linux   /vmlinuz root=/dev/sdf5 ro

The problem really is the "root=/dev/sdf5" when starting linux.

Indeed.

When the disk is plugged into a different slot, or if one of
the prior disks is removed, then /dev/sdf5 will be wrong.

There are many other situations which may cause a change in drive names.
SCSI drive names are not persistent across reboots. Do not rely on them.

I know, ideally inux should be able to solve the problem itself,
but it seemingly can't: LABEL=<label> or similar are not available
when choosing the root partition.

That's because you do not use an initramfs (formerly initrd). The kernel itself does not understand UUID or LABEL. Why don't you use an initramfs ? This is quite common these days, and so much more convenient.

Is there a way to evaluate grub2 variables being passed to a
command like the linux command ?

Yes, but it is not reliable. There is no persistent mapping between GRUB device numbers and Linux device names.

You'd rather use a persistent identifier that the kernels kows about : PARTUUID. Get the value with blkid.

Can't remember whether the kernel knows about PARTLABEL too, which would be nicer. Guess not.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]