Four days ago my Grub got corrupted by a Fedora update. I have been all over the WWW trying to find out how to repair Grub. I simply can’t get past errors of “can’t lookup blockdev” and “can’t find in /etc/fstab”.
I am using a freshly downloaded live session .iso of Fedora 43 with KDE Plasma. I am logged in as superuser, using sudo su –
Below are my partition characteristics, compiled from various commands (e.g. lsblk, fdisk -l, etc.). Both drives are internal, I do not have an LVM, there is no Windows on this machine (and no dual boot).
SYSTEM PARTITIONS:
nvme0n1p1 0 .6g vfat efi system
nvme0n1p2 2 g ext4 linux extended boot
nvme0n1p3 293 g btrfs /
nvme0n1p4 62.5g btrfs hibernationswap
nvme0n1p5 573 g btrfs /home
DATA PARTITIONS:
/dev/sda1 through /dev/sda6 (ntfs HDD)
For example, this:
mount /dev/nvme0n1p3/boot I get: “can’t lookup blockdev”.
I’ve looked at a couple of dozen online articles on fixing grub, but can’t get past this point. Some things I have tried give a “can’t find in /etc/fstab”, although with Dolphin I can find it when click on the / that (in Properties) is mounted from “/dev/nvme0nip3”, but can’t find it from the / mounted from “LiveOS_roots”.
If I try to boot the computer I get three errors that are “../../grub-core/script/lexer.c:352: ”. The X was “syntax error” for the 1st and 3rd, and “incorrect command” for the 2nd one. I can get to a grub> prompt, but was unable to do anything useful from there, so I have been trying live sessions.
As I understand, I need to make three mounts:
mount /dev/nvme0n1p3 /mnt
mount /dev/nvme0n1p3 /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot/efi
I don’t have an /efi in the root of either the nvme drive or the live boot. I do have a
/boot/efi/EFI/fedora, but it does not have a grub.cfg file. It has a bunch of grub executables, like grub64.efi. The …/fedora directory also has a /boot directory.
And I’m not sure whether I should be trying to mount to /mnt or mnt/…, not knowing where Fedora normally mounts an nvme drive, but all the instructions I have found on fixing grub have those locations, as I have shown them above with my partition designations.
I don’t know how to do that from the ‘system’. I have tried both a regular user and a superuser, and both times I get:
boot_image=(cd0)/boot/x86_64/loader/linux quiet rhgb root=live:cdlabel =fedora=KDE-Live-43 rd.live.image
From your partition list and your fstab, I would expect that your /boot is actually nvme0n1p2. In your fstab, / and /boot have different UUIDs, so they can’t both be nvme0n1p3.
The second nvme0n1p3 line can’t work — you want to use nvme0n1p2 for the boot partition. You should mention where you found the instructions that mount the same partition twice so we try to have them corrected.
Steep learning curve here. I had saved my system setup with TimeShift, but don’t know how to restore everything with that, in this Live session situation. Is that a way to fix this more easily? And if so, how do I access my actual system to do that, instead of the Live system?
I am not really familiar with TimeShift, other than that it is more common in the Ubuntu world and that it requires an Ubuntu-style subvolume layout (@ and @home) for Btrfs snapshots.
Since TimeShift is something users have to setup themselves on Fedora, I doubt people here will be able to assist with, at least not without figuring out how you set it up first.
But I think you’re almost there even without timeshift:
The lexer.c errors indicate a faulty grub.cfg, which can be fixed like it is described in Fedora’s official documentation with grub2-mkconfig -o /boot/grub2/grub.cfg
As @l-c-g and @gnwiii pointed out, your /boot partition is nvme0n1p2, not p3. Right now the important thing is to make sure we are actually looking at your installed system and not the LiveOS tree.
From the live session, mount your three Fedora partitions:
mount /dev/nvme0n1p3 /mnt
mount /dev/nvme0n1p2 /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot/efi
When you boot your system without live usb press esc to access grub menu with 3 kernels and one rescue select default one first one from list and select button e to edit kernel boot lines there you will see default ‘root=uuid’ check it is match uuid from fstab if not just retype uuid that match it and with ‘ctrl + x’ boot it .
Are you sure about that? In the partition list, nvme0n1p5 is listed as /home. Also, in the fstab shown, the entries for / and /home have different UUIDs and both mount subvolid=5, which would match the partition list (two Btrfs partitions, nvme0n1p3 and nvme0n1p5, at least without actually knowing the UUIDs):
Spearate partitions instead of subvolumes isn’t the default and not how I set up Btrfs systems, but it works. And as /home doesn’t need to be mounted to restore GRUB, I had decided to ignore it.
These two lines also somewhat contradict each other: Is nvme0n1p4 a Btrfs partition, I take it with a swapfile in it, or is it actually a swap partition? A Btrfs partition with a swapfile would get you some of the overhead of Btrfs without any real benefit.
@lteak, the next time you are booted into the livesystem, could you get us the output of
lsblk -f -p
This way, we can see the actual partitions and their UUIDs and won’t have to guess anymore which one corresponds to which line in your fstab.
Thanks for your patience and those further thoughts. I went to bed sick early last night and slept 15 hours. Here is the result (hand copied, since I have no way to get data off of my Linux machine at the moment)"
Lsblk -f -p
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
/dev/loop0 erofs c49c3ecb-832b-440f-89b5-a601286ebff0 0 100% /run/rootfsbase
/dev/sda
/dev/sda1
/dev/sda2 ntfs P5-E (not copied)
/dev/sda3 ntfs P5-F ditto
/dev/sda4 vfat fat32 P5-G ditto
/dev/sda5 vfat fat32 Disk_Sys ditto
/dev/sda6 swap 1
/dev/sdb
/dev/sdb1 exfat 1.0 Ventory 4E21-0000
/dev/sdb2 vfat FAT16 VTOYEFI E039-AD96
/dev/zram0 swap 1 zram0 f9bd099d-b39d-480a-867b-77fb63d49d24
/dev/nvme0
/dev/nvme0n1p1 vfat FAT32 D669-)B52
/dev/nvme0n1p2 ext4 1.0 c434373b-72fb-4622-bad7-657cf14cd228
/dev/nvme0n1p3 btrfs / 232a5005-d694-4e4e-b025-9e2e71c50e49
/dev/nvme0n1p4 btrfs Hiber 6978faa7-983f-4174-93c3-894a9c47716c
/dev/nvme0n1p5 btrfs /home 2e7bcaef-f294-4542-8df0-e86a508fd150
(Sorry, I had laid out in uniform colums, using spaces, but those got lost pasting it it.)
A further note. I had set up /home in a separate partition to avoid data loss, since I went through 4 fresh installs of fedora, while on my learning curve. (A carry over of a lesson hard-learned on Windows: don’t store anything anywhere on C: that you don’t want to lose in a reinstall.)