LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   SUSE / openSUSE (https://www.linuxquestions.org/questions/suse-opensuse-60/)
-   -   grub not load after a power fault during an update (https://www.linuxquestions.org/questions/suse-opensuse-60/grub-not-load-after-a-power-fault-during-an-update-4175714484/)

marozsas 07-10-2022 05:00 PM

grub not load after a power fault during an update
 
Yesterday I started to upgrade TW from 20220630->20220706 when at some point we had a power fault in the area.

As result, grub don't load

Code:

GRUB loading....

Welcome to GRUB!

error: ../../grub-core/fs/btrfs.c:2076: file /boot/grub2/i386-pc' not found.
error: ../../grub-core/fs/btrfs.c:2076:file /boot/grub2/i386-pc/normal.mod' not found.

Entering rescue mode...
grub rescue>

Which is the proper way to recovery from this state, taking in account the fact the root FS is a BTRFS with subvolumes as is standard in Tumbleweed ?

My google-fu was not good enough to find a specific guide for opensuse/tumblewee with a btrfs root disk and subvolumes to boot....

mrmazda 07-10-2022 06:10 PM

It's not materially different with BTRFS than with EXT4. Grub isn't finding what it's looking for, so a boot from another OS is required to btrfs-check the root filesystem, then try booting again after. If that isn't enough to bring up the Grub menu, then again boot another OS to setup and run the installed system in chroot, from which YaST can be run in text mode to reconfigure the bootloader. Any change whatsoever in yast bootloader will completely configure everything to do with Grub, even (re)install rpms if necessary, as long as internet is available.

marozsas 07-12-2022 04:58 PM

SOLVED
 
For anyone interested, as I was unable to find a specif guide to opensuse/btrfs which complicates a bit the standard procedure that applies to a regular FS like ext4:

Boot with a USB stick with btrfs support, preferentially a version of the same distro, in this case, opensuse net installer.

If using the same distro to boot, look at boot menu. There is an option to "upgrade" the current system. It will scan the disk and if found a up-gradable version, proceed with the process, eventually it get fixed.

Manual approach: Boot with the USB stick , look at menu for an option "rescue" or if it is a live distro, boot normally.
1) identify the boot disk and partition: "lsblk -f"; lets say you identify the system at /dev/sda4
2) create a mount point at "/mnt" to mount the whole partition: "mkdir /mnt/volume"
3) mount it: "mount /dev/sda4 /mnt/volume";
3a) optional: at "/mnt/volume/@" you will see the root disk structure and at "/mnt/volume/.snapshots" you see all snapshots for this disk.
3b) optional: to figure out which is the current snapshot so you can navigate to it in "/mnt/volume/.snapshots/_ID_number_here_" you can run "btrfs subvolume get-default /mnt/volume".
3c) optional: CAUTION, BY YOU OWN RISK: you can rollback to a specific snapshot with "btrfs subvolume set-default _ID_number_here_ /mnt/volume", but it is probably safer doing that at the specific opensuse grub menu.
4) check the current subvolumes avaiable: "btrfs subvolume list /mnt/volume"; take a note of pairs of path/_ID_number_ for each relevant paths: (@, usr, var, etc...specially the 2 /boot/grub2 entries)
5) Create another mount point to the root fs: "mkdir /mnt/myroot";
6) Mount those paths at /mnt/myroot/whatever: i.e: for path "@", id 256: "mount /dev/sda4 -o subvolid=256 /mnt/myroot" ; for path "usr" id 257: "mount /dev/sda4 -o subvolid=257 /mnt/myroot/usr" ; repeat for all system paths/IDs, don't forget the 2 /boot/grub2 entries.
7) bind mounts: "mount /proc -o bind /mnt/myroot/proc"; "mount /sys -o bind /mnt/myroot/sys"; "mount /dev -o bind /mnt/myroot/dev";
8) chroot /mnt/myroot
9) You are ready to re-install grub, either by "update-bootloader --reinit" or/and "grub2-install"

Good luck for you, not for me though. The folders/files structure was FUBAR due to power loss.


All times are GMT -5. The time now is 11:33 PM.