Unable to Boot after moving from UEFI system to BIOS system

I recently had to move my hard drive from a UEFI system to a BIOS system (strange I know). However, this caused my install to fail to boot as it was partitioned for UEFI systems. I believe I made the necessary changes using GParted and created a bios_grub partition of size 4M at the start of my drive (sda1) and left my boot partition untouched (sda2). My actual root and home data is on sda3 in a btrfs partition with LUKS encryption. See how it looks in GParted

Using a live usb, I then updated my /etc/fstab and reinstalled grub onto the new bios_grub partition as below. I have also include my /etc/default/grub so you can see my command line parameters.
Chroot in:

root@localhost-live:/home/liveuser# cryptsetup luksOpen /dev/sda3 myvolume
Enter passphrase for /dev/sda3: 
root@localhost-live:/home/liveuser# mount /dev/mapper/myvolume /mnt -o subvol=root
root@localhost-live:/home/liveuser# mount /dev/sda2 /mnt/boot
root@localhost-live:/home/liveuser# mount -o bind /dev /mnt/dev
root@localhost-live:/home/liveuser# mount -o bind /proc /mnt/proc
root@localhost-live:/home/liveuser# mount -o bind /sys /mnt/sys
root@localhost-live:/home/liveuser# mount -o bind /run /mnt/run
root@localhost-live:/home/liveuser# chroot /mnt

blkid output:

[root@localhost-live /]# blkid
/dev/ventoy: BLOCK_SIZE="2048" UUID="2024-10-24-15-04-27-00" LABEL="Fedora-WS-Live-41-1-4" TYPE="iso9660" PTUUID="7c243d72-530f-4837-9421-263adb58fd3a" PTTYPE="gpt"
/dev/mapper/myvolume: LABEL="fedora_localhost-live" UUID="51941106-0b3e-4eb1-8b02-9049aff8f2e7" UUID_SUB="003ee1cd-b94a-465e-bbfb-2b94ca9f6c37" BLOCK_SIZE="4096" TYPE="btrfs"
/dev/sdb2: SEC_TYPE="msdos" LABEL_FATBOOT="VTOYEFI" LABEL="VTOYEFI" UUID="223C-F3F8" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="VTOYEFI" PARTUUID="d712cd63-3622-47d2-87a3-b24ed6065c68"
/dev/sdb1: LABEL="Ventoy" UUID="C4A0-F959" BLOCK_SIZE="512" TYPE="exfat" PTTYPE="dos" PARTLABEL="Ventoy" PARTUUID="8a3ad89f-f065-405c-9ea6-aaecf12d00de"
/dev/loop0: TYPE="squashfs"
/dev/sda4: PARTUUID="1bc9e030-ab8c-49db-840e-af7b75ef43d6"
/dev/sda2: UUID="a56893bd-e666-4eda-b22f-7eac41d71912" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="745a79f8-e42b-474b-a6aa-31533c830908"
/dev/sda3: UUID="1215ebbc-d2e8-425a-899d-1d876f8d6467" TYPE="crypto_LUKS" PARTUUID="3c784936-0ab9-4bb9-a9eb-c89cd7b5ef59"
/dev/sda1: PARTUUID="c8bd6d5c-4dce-4c8f-a1dd-c781489bbd04"
/dev/zram0: LABEL="zram0" UUID="469850d8-46d1-4e18-904a-df980b48105b" TYPE="swap"

fstab contents:

[root@localhost-live /]# cat /etc/fstab

#
# /etc/fstab
# Created by anaconda on Wed Nov  4 01:53:21 2020
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=51941106-0b3e-4eb1-8b02-9049aff8f2e7 /                       btrfs   subvol=root,x-systemd.device-timeout=0 0 0
UUID=a56893bd-e666-4eda-b22f-7eac41d71912 /boot                   ext4    defaults        1 2
# UUID=F24D-2031          /boot/efi               vfat    umask=0077,shortname=winnt 0 2
UUID=51941106-0b3e-4eb1-8b02-9049aff8f2e7 /home                   btrfs   subvol=home,x-systemd.device-timeout=0 0 0

Reinstalling grub on the new bios_grub partition:

[root@localhost-live /]# grub2-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
[root@localhost-live /]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done

/etc/default/grub contents:

[root@localhost-live /]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.luks.uuid=luks-1215ebbc-d2e8-425a-899d-1d876f8d6467 quiet rhgb"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true
[root@localhost-live /]# 

However, I am unable to boot into my system and am just dropped at the grub command line when booting off my drive. If I manually try and boot into my drive using the grub command line as below


This works well enough for me to be prompted for my LUKS password which I enter but then I get mount: /sysroot: unknown filesystem type 'crypto_LUKS' ... Failed to mount sysroot.mount - /sysroot as below:

So I seem to have two problems:
1 - For some reason I never see the grub menu when booting and get dropped into the grub command line where I have to manually set my linux kernel and initramfs
2 - After manually setting my linux kernel and initramfs I am unable to mount my BTRFS LUKS partition

I tried reinstalling the kernel in my chroot environment as I thought that might help but no luck.

I am quite at a loss what to do, I have been reading forum posts for weeks across here, reddit and the arch and ubuntu forums and haven’t been able to make progress past what I have done so far. Any help would be greatly appreciated

Sorry for the poor phone camera photos, I’m not sure how else to get output prior to booting

You also need to run grub2-install or you wont have grub2 installed in the MBR sector. That only works if you are booted in classical BIOS boot mode. How exactly to do that I don’t know for sure, but it would involve booting a live system.

I did also run grub2-install after booting into a live system and then chrooting into my drive. The output is in the big bit of terminal output I included (which I admit is probably a bit hard to see). It didn’t error out at all when I ran grub2-install:

[root@localhost-live /]# grub2-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
[root@localhost-live /]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done

The reference to UEFI Firmware Settings is a bit strange seeing as its a BIOS-only system

This is a generic entry and indicates a means of opening the bios setup menu from within grub. AFAIK all modern systems use a uefi bios even if configured to boot only with MBR. Even if not a uefi bios the method of opening the setup menu is often identical.

Sorry for not reading carefully.

This comes from /etc/grub.d/30_uefi-firmware and is a cosmetic issue. The firmware menu entry is only shown on UEFI systems.

Based on some advice from the Fedora Matrix server I updated my /etc/default/grub to look like this:

[root@localhost-live /]# cat /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.luks.uuid=luks-1215ebbc-d2e8-425a-899d-1d876f8d6467 quiet rhgb root=UUID=51941106-0b3e-4eb1-8b02-9049aff8f2e7 rootflags=subvol=root"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true

re-ran

[root@localhost-live /]# grub2-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
[root@localhost-live /]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Adding boot menu entry for UEFI Firmware Settings ...
done

and then rebuilt my initramfs with dracut --regenerate-all --no-uefi --force --verbose but no success.

root=/dev/sda3 is incorrect. That is ciphertext and can’t be mounted. The root is usually a UUID for the file system, which can be hard to type in the pre-boot GRUB environment. It might actually be easier to do the crypto device unlock/open and mount, entirely manually from a Linux CLI instead of from GRUB. To do that use rd.break=pre-mount and you’ll just get a dracut shell where you should be able to cryptsetup open /dev/sda3 dogbreath and then you can do mount -o subvol=root /dev/mapper/dogbreath /sysroot and then exit.

Point is, this method lets you name the cryptodevice whatever you want, instead of its name being some sort of UUID.

The /etc/kernel/cmdline should still be valid though. I’m offhand not thinking why anything in there would be wrong.


As for why you’re getting a grub prompt. That suggests it’s not finding the grub.cfg on hd0,gpt2 (ext4)…

At the grub prompt, type:

pager=1
set

take a cell photo, then press space bar and take another - the environment variables are probably just over 1 screen page long so it might take two photos.

1 Like