openSUSE / grub2

GNU General Public License v3.0
4 stars 6 forks source link

grub error with version 2.06 #2

Open disich opened 2 years ago

disich commented 2 years ago

Did a Tumbleweed update on 11/18 and my grub is broken. Did not have any such issues when I was on Tumbleweed a month back. Any known issues?

Even manually trying or using yast gives same error.

unknownc0b6f9f4d891:~ # grub2-install -V grub2-install (GRUB2) 2.06

unknownc0b6f9f4d891:~ # grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found theme: /boot/grub2/themes/openSUSE/theme.txt Found linux image: /boot/vmlinuz-5.15.3-1-default Found initrd image: /boot/initrd-5.15.3-1-default Found linux image: /boot/vmlinuz-5.15.2-1-default Found initrd image: /boot/initrd-5.15.2-1-default Warning: os-prober will be executed to detect other bootable partitions. Its output will be used to detect bootable binaries on them and create new boot entries. /usr/sbin/grub2-probe: error: ../grub-core/kern/fs.c:121:unknown filesystem. Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi /usr/sbin/grub2-probe: error: ../grub-core/kern/fs.c:121:unknown filesystem. Adding boot menu entry for UEFI Firmware Settings ... done unknownc0b6f9f4d891:~ #

unknownc0b6f9f4d891:~ # grub2-install /dev/sda Installing for x86_64-efi platform. grub2-install: error: ../grub-core/kern/fs.c:121:unknown filesystem. unknownc0b6f9f4d891:~ # unknownc0b6f9f4d891:~ # unknownc0b6f9f4d891:~ # grub2-install -s --force /dev/sda Installing for x86_64-efi platform. grub2-install: error: ../grub-core/kern/fs.c:121:unknown filesystem. unknownc0b6f9f4d891:~ # unknownc0b6f9f4d891:~ # fdisk /dev/sda

Welcome to fdisk (util-linux 2.37.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command.

This disk is currently in use - repartitioning is probably a bad idea. It's recommended to umount all file systems, and swapoff all swap partitions on this disk.

Command (m for help): p

Disk /dev/sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors Disk model: TOSHIBA KSG60ZMV Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: gpt Disk identifier: 97C834C6-2BEC-492F-A56C-6C6D2A8688C5

Device Start End Sectors Size Type /dev/sda1 2048 1333247 1331200 650M EFI System /dev/sda2 1333248 1595391 262144 128M Microsoft reserved /dev/sda3 1595392 253104127 251508736 119.9G Microsoft basic data /dev/sda4 473055232 475082751 2027520 990M Windows recovery environment /dev/sda5 475082752 497799167 22716416 10.8G Windows recovery environment /dev/sda6 497801216 500084735 2283520 1.1G Windows recovery environment /dev/sda7 253104128 346566655 93462528 44.6G Linux filesystem /dev/sda8 350760960 473055231 122294272 58.3G Microsoft basic data /dev/sda9 346566656 350760959 4194304 2G Linux swap

Partition table entries are not in disk order.

Command (m for help): q

grub2-install with -v flag did not give any better information so output not provided. Any known issues here?

I updated again y'day and here is my OS info: unknownc0b6f9f4d891:~ # cat /etc/os-release NAME="openSUSE Tumbleweed"

VERSION="20211128"

ID="opensuse-tumbleweed" ID_LIKE="opensuse suse" VERSION_ID="20211128" PRETTY_NAME="openSUSE Tumbleweed" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:opensuse:tumbleweed:20211128" BUG_REPORT_URL="https://bugs.opensuse.org" HOME_URL="https://www.opensuse.org/" DOCUMENTATION_URL="https://en.opensuse.org/Portal:Tumbleweed" LOGO="distributor-logo-Tumbleweed"

WenhuaChang commented 2 years ago

The grub update in 20211118 only touched arm linux loader, so it is unlikely to case regression to grub2-probe linux utility. The earlier changes in 20211110 also looked innocent to me despite xfs is patched in reaction to grub upstream announcement.

Would you please help to provide these output to see is there's any hint for troubleshooting ?

  1. grub2-probe -vvv -t fs /boot
  2. lsblk -f
disich commented 2 years ago

grubprobe.log

Thanks @WenhuaChang for looking into this. I have attached the logs.

WenhuaChang commented 2 years ago

grubprobe.log

The log looks good to me as no error reported in probing /boot and correct result (btrfs) is returned in the end. The next to try is EFI System Partition as it's filesystem is validated by grub-install as a sanity/foolproof check.

Would you please help again to provide the log ? Thanks in advanced.

  1. grub2-probe -vvv -t fs /boot/efi
  2. grub2-install -vvv
disich commented 2 years ago

grubdebug.log

Attaching the additional logs, thanks in advance.

disich commented 2 years ago

Just notifying @WenhuaChang of above logs. Thanks.

WenhuaChang commented 2 years ago

The fat on ESP is not detected by grub's own fat module that is quite a surprise because we did not make any change to fat module.

grub-core/kern/fs.c:57: Detecting fat...
grub-core/osdep/hostdisk.c:359: reusing open device `/dev/sda1'
grub-core/osdep/hostdisk.c:359: reusing open device `/dev/sda1'
grub-core/kern/fs.c:79: fat detection failed.

If your previous grub version in use was 2.04, then chances are there that changes in between 2.06 induced the regression.

git --no-pager  log --oneline grub-2.04..grub-2.06 -- grub-core/fs/fat.c
81f196239 fs: Use 64-bit type for filesystem timestamp
20def1a3c fat: Support file modification times
8ad7c2386 exfat: Save the matching directory entry struct when searching 

Is it possible for you to provide compressed dd image of your esp partition via dd if=/dev/sda1 | gzip -9 > sda1.gz or we may have to use debug grub rpm package. Please Let me know what do you think. Thanks.

disich commented 2 years ago

@WenhuaChang Yeah, here you go. Guess this was too big (41MB) for github so its on my onedrive. But its strange, if FAT on ESP itself is not detected then its quite basic and the whole world should be complaining. Was just wondering if my SSD went bad at the same time I started the Tumbleweed update.

WenhuaChang commented 2 years ago

No. Your SSD is not broken, I could reproduce the problem as well. It turns out that you have a file with invalid timestamp driving grub nuts.

ll /mnt
drwxr-xr-x 7 root root 4096 Sep 21 06:47 EFI
-rwxr-xr-x 1 root root 4096 Jan  1  1980 FSCK0000.REC
drwxr-xr-x 2 root root 4096 Oct 14  2020 System Volume Information

The FSCK0000.REC has invalid timestamp, though it is displayed as 1980, the on-disk value is all zeroed that shouldn't exist on this planet ( ie 1980/00/00). This didn't happen in grub 2.04 because it just don't care, but new grub 2.06 has added support for file modification time thus is not happy about the format.

You also need a bit of luck to really see this problem, the file needs to be the first item in the root directory entry. Grub only probes first file encontered and exit immediately to know it is fat.

The problem can be solved by just removing FSCK0000.REC or moving it elsewhere. Did you have any information for FSCK0000.REC being created in this state? That is helpful to understand the problem more. Thanks.

disich commented 2 years ago

Perfect @WenhuaChang . Your analysis was spot on. This resolved the problem for me. I understand grub will also make a fix so it still works in this situation?

Logs below: unknownc0b6f9f4d891:~ # cd /boot/efi/ unknownc0b6f9f4d891:/boot/efi # ls -ltr total 12 -rwxr-xr-x 1 root root 4096 Jan 1 1980 FSCK0000.REC drwxr-xr-x 2 root root 4096 Oct 14 2020 System Volume Information drwxr-xr-x 7 root root 4096 Sep 20 23:47 EFI unknownc0b6f9f4d891:/boot/efi # rm FSCK0000.REC unknownc0b6f9f4d891:/boot/efi # cd unknownc0b6f9f4d891:~ # grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found theme: /boot/grub2/themes/openSUSE/theme.txt Found linux image: /boot/vmlinuz-5.15.3-1-default Found initrd image: /boot/initrd-5.15.3-1-default Found linux image: /boot/vmlinuz-5.15.2-1-default Found initrd image: /boot/initrd-5.15.2-1-default Warning: os-prober will be executed to detect other bootable partitions. Its output will be used to detect bootable binaries on them and create new boot entries. Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi Adding boot menu entry for UEFI Firmware Settings ... done unknownc0b6f9f4d891:~ # grub2-install /dev/sda Installing for x86_64-efi platform. Installation finished. No error reported.

Booted my system and I get the grub menu, wow, thanks a ton!

WenhuaChang commented 2 years ago

Sorry for late reply, I was on vacation.

Yes I will try to come up a patch to upstream and see how it pans out.