View previous topic :: View next topic |
Author |
Message |
therealjrd Tux's lil' helper
Joined: 18 May 2006 Posts: 120
|
Posted: Sun May 06, 2018 3:45 pm Post subject: [SOLVED] Yet another question about GPT/EFI/grub |
|
|
Hi all. I fear this is another case where if were to RTFM enough, I'd figure it out, but so far it hasn't been working.
I'm setting up a new machine. I'm trying to be modern and use GPT/EFI. I've managed to get the boot disk partitioned/formatted (key part there really is VFAT for /boot) and have got my kernel built/installed.
The problem is that when I reboot, grub fails to find the rootfs partition by UUID.
grub-mkconfig generates entries like
Code: |
menuentry 'Gentoo GNU/Linux, with Linux x86_64-4.9.76-gentoo-r1-jrd-exp' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-4.9.76-gentoo-r1-jrd-exp-advanced-23378068-8ac5-40e0-a3fc-b35e51fd1a20' {
load_video
if [ "x$grub_platform" = xefi ]; then
set gfxpayload=keep
fi
insmod gzio
insmod part_gpt
insmod fat
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 0397-71B8
else
search --no-floppy --fs-uuid --set=root 0397-71B8
fi
echo 'Loading Linux x86_64-4.9.76-gentoo-r1-jrd-exp ...'
linux /kernel-genkernel-x86_64-4.9.76-gentoo-r1-jrd-exp root=UUID=23378068-8ac5-40e0-a3fc-b35e51fd1a20 ro
echo 'Loading initial ramdisk ...'
initrd /initramfs-genkernel-x86_64-4.9.76-gentoo-r1-jrd-exp
}
|
but grub can't find the UUID. If I change that to root=/dev/nvme0n1p4, it works perfectly.
The UUID above is correct.
Code: |
frankenstein /usr/src/linux # lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
sdb
nvme0n1
├─nvme0n1p1 vfat 44F7-B2C4
├─nvme0n1p2 vfat 0397-71B8 /boot
├─nvme0n1p3 swap 2df6bedb-4bbe-4485-843b-ed10fad8af2a
└─nvme0n1p4 ext3 23378068-8ac5-40e0-a3fc-b35e51fd1a20 /
|
Related (probably) evidence: When the kernel boots, it's unable to mount devices by label. My fstab mentions LABEL=boot for /boot, but the kernel can't find it. If I mount by dev, it works fine. Again, I'm pretty sure I have the labels set:
Code: |
frankenstein /usr/src/linux # parted /dev/nvme0n1 print
Model: Unknown (unknown)
Disk /dev/nvme0n1: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 3146kB 2097kB grub bios_grub
2 3146kB 512MB 509MB fat16 boot boot, esp
3 537MB 65.0GB 64.5GB linux-swap(v1) swap
4 65.0GB 128GB 63.0GB ext3 root
|
I suspect I've gotten something wrong in my disk config, such that neither grub nor the kernel can find partitions by anything other than the device. What should I look at next?
Thanks in advance . . .
Last edited by therealjrd on Tue May 08, 2018 1:04 pm; edited 1 time in total |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54239 Location: 56N 3W
|
Posted: Sun May 06, 2018 4:13 pm Post subject: |
|
|
therealjrd,
The kernel understands PARTUUID and the dev node. All the other things require the use of the user space mount tool.
To use UUID that means that mount must be in your initrd. Once root is mounted, /bin/mount can be used.
There is a trap for the unwary in trying to use the disk-by-* symlinks. They are created by udev at startup and its possible to try to use them before they exist.
Do not use disk-by-* in fstab.
Be aware that PARTUUID is a property of a partition and UUID is a property of a filesystem. The two are different, see blkid.
/sbin/blkid: |
/dev/sde1: UUID="c400b18c-0210-4338-a0fd-f437ecbaaf99" TYPE="ext4" PARTLABEL="ext4" PARTUUID="150e6ef1-7ba8-409c-9c3f-dbdecdc9f18b"
/dev/sde2: UUID="cFoZJl-1URB-JTGu-05Df-eJ0R-nJYE-45AqZb" TYPE="LVM2_member" PARTLABEL="LVM" PARTUUID="5472e6a9-101d-4d52-87aa-91388f0df5b6" |
_________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
therealjrd Tux's lil' helper
Joined: 18 May 2006 Posts: 120
|
Posted: Sun May 06, 2018 4:22 pm Post subject: |
|
|
Thanks for the quick response, Neddy
I fear I'm still confused. I'm not getting why lack of userspace mount in initrd would cause grub to be unable to find the right partition to use for rootfs. What am I missing? |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54239 Location: 56N 3W
|
Posted: Sun May 06, 2018 6:22 pm Post subject: |
|
|
therealjrd,
What do you mean by root here?
The term is used by grub in two ways.
Grub uses it to describe the location on the HDD where its files and the files it needs to load at boot time are located.
Its used in grub.cfg on the kernel line to describe the location that the kernel should use as the root of the filesystem tree.
I read you post as inferring it was this root that was causing problems. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
therealjrd Tux's lil' helper
Joined: 18 May 2006 Posts: 120
|
Posted: Sun May 06, 2018 7:30 pm Post subject: |
|
|
Sorry, I was giving confusing information
The main problem I was trying to solve is that at boot time, grub starts and allows me to select which kernel I want to boot, but then there was an error finding the partition to use as the rootfs for that kernel. The grub.cfg generated by grub-mkconfig uses "root=UUID= ... " on the command line. I had mistakenly thought it was grub failing to find the partition by UUID, but now I realize it was the booting kernel failing to find the partition. Changing my grub.cfg by hand to say "root=/dev/nvme0n1p4" worked.
The secondary problem I was trying to solve is that once I got a kernel to boot, I couldn't mount /boot, because the kernel couldn't find the partition by name. I'm putting that one aside for the moment.
After googling more and finding vaguely similar issues, I rebuilt the kernel making sure everything to do with EFI was on, especially CONFIG_EFI and CONFIG_EFI_PARTITION. That fixed the boot problem, sort of: my kernel comes up and finds its rootfs when identified by "root=UUID=...". I was about to post back and say so, when I realized that now it's leaving the rootfs mounted read-only after boot. I'm still puzzling over that one.
Once I get that sorted out, I'll get back to figuring out why my kernel can't interpret fstab using LABEL=name.
Thanks in advance for any further hints. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54239 Location: 56N 3W
|
Posted: Sun May 06, 2018 8:21 pm Post subject: |
|
|
therealjrd,
Root is mounted read only to start with so that rootfsck can run.
Once that's successful, root is remounted read write.
rootfsck consults /etc/fstab to determine the filesystem on the root partition.
root will stay read only if the /etc/fstab entry is incorrect or it finds a problem.
Inspect and correct /etc/fstab if thats not correct.
dmesg will tell of any problems.
You can mount root read write with Code: | mount -o rw,remount / | but lots of services won't have started so you cannot do very much.
Its OK to fix fstab. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
therealjrd Tux's lil' helper
Joined: 18 May 2006 Posts: 120
|
Posted: Sun May 06, 2018 9:29 pm Post subject: |
|
|
NeddySeagoon wrote: |
rootfsck consults /etc/fstab to determine the filesystem on the root partition.
root will stay read only if the /etc/fstab entry is incorrect or it finds a problem.
Inspect and correct /etc/fstab if thats not correct. |
Ah, ok, that explains that part. Many thanks. Will proceed to debug in that direction. |
|
Back to top |
|
|
therealjrd Tux's lil' helper
Joined: 18 May 2006 Posts: 120
|
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54239 Location: 56N 3W
|
Posted: Tue May 08, 2018 2:28 pm Post subject: |
|
|
therealjrd,
The handbook is not open to public editing, so you can't in this case, do it yourself.
Provide feedback on the Discussion page or file a bug at bugs.gentoo.org.
LABEL= is a property of a filesystem.
PARTLABEL= is a property of a partition, when GPT is in use. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
|