Ask Your Question

How to rescue my Fedora installation?

asked 2018-06-07 01:25:15 -0500

ckujau gravatar image

OK, I'm out of ideas here. I have a Thinkpad T470 that came pre-installed with Windows 10 x64 and I installed Fedora 27 in a dual-boot configuration. I didn't really configure much. the Fedora 27 live-installer did it and I was glad that it worked. All was great, really enjoyed Fedora on the desktop, upgraded to F28 a few weeks ago, no issues.

Today I felt like dual-booting into Windows and...maybe an OS update did something to my bootloader - I don't know. But now my laptop boots straight into Windows every time I turn it on. No GRUB, no nothing. I can boot from USB (writing this with the F28 live-installer booted), but I'm unable to get it to boot from the disk again :-\

The hard disk is an integrated Samsung PM981 (NVMe), the partition table looks somewhat messy - remember, Windows 10 pre-installed, and then F27 install-magic did the rest:

# fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 953.9 GiB, 1024209543168 bytes, 2000409264 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: F1EDA8B2-AB20-45E1-952B-071FDB96900E

Device              Start        End    Sectors   Size Type
/dev/nvme0n1p1       2048     534527     532480   260M EFI System
/dev/nvme0n1p2     534528     567295      32768    16M Microsoft reserved
/dev/nvme0n1p3     567296  264194047  263626752 125.7G Microsoft basic data
/dev/nvme0n1p4 1998360576 2000408575    2048000  1000M Windows recovery environment
/dev/nvme0n1p5  264194048  264726527     532480   260M EFI System
/dev/nvme0n1p6  264726528 1993637887 1728911360 824.4G Linux filesystem
/dev/nvme0n1p7 1993637888 1998356479    4718592   2.3G Linux swap

I don't really understand why I have two EFI partitions (p1 and p5), but that's the way it is. The partitions can be mounted and read from (no hardware errors, really!), even p6 (where F28 is installed) can be mounted just fine, so the data is still there. But I really want to have it boot again.

Still in the F28 live-installer, I tried to re-install grub2:

# mount -t xfs /dev/nvme0n1p6 /mnt/
# mount -t vfat /dev/nvme0n1p1 /mnt/boot/efi/
# mount -t proc proc /mnt/proc/
# mount -t sysfs sysfs /mnt/sys/
# mount -t devtmpfs dev /mnt/dev/
# mount -t devpts devpts /mnt/dev/pts/
# chroot /mnt

chroot% grub2-install /dev/nvme0n1
Installing for i386-pc platform.
grub2-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
grub2-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
grub2-install: error: will not proceed with blocklists.

Out of desparation I used --force and the command came back w/o errors, but it still would not boot.

I found some tutorials online and both looked very promising. But F28 has CONFIG_EFI_VARS=n and efibootmgr always comes back with:

 > EFI variables are not supported on this system.

The 2nd tutorial mentioned to boot the live-image in UEFI mode, but I haven't figured out ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-07 04:26:04 -0500

villykruse gravatar image

First of all: Do not enable Bios Compatibility Mode.

Always make sure you boot your LiveCD in UEFI more. If efibootmgr doesn't work, you may not have booted in UEFI mode, and then you should disable Bios Compatibility Mode. and reboot.

Running grub2-install was a mistake. Forcing it was a bigger mistake. You should not run grub2-install on a UEFI Fedora system. Install you (re)install grub2-efi-x64 and shim-x64 but that was probably not necessary. Remember: UEFI do not use a Master Boot record. When mounting the EFI file system, do make sure you mount the correct one. /etc/fstab as found on the mounted root file system would tell you which one it is.

I would guess that all you had to do was to select Fedora in the UEFI boot menu. This can also be done using efibootmgr or the equivalent utility in Windows. The file that you should be loading in UEFI is fedora/shimx64.efi.

edit flag offensive delete link more


Going to the BIOS once more and I finally managed to boot into UEFI-mode. And you're right of course, UEFI-systems don't mix with grub2-install as I now found out too. So, it boots again, but now the Windows entry is gone from the GRUB menu, but it can be selected in the UEFI bootmenu before. This is...different, but at least it works again. Thanks for your help!

ckujau gravatar imageckujau ( 2018-06-07 05:18:14 -0500 )edit

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg should set up the boot entry for Windows, as it did when installing Fedora for the first time.

villykruse gravatar imagevillykruse ( 2018-06-07 10:29:41 -0500 )edit

It's possible grub2-mkconfig isn't smart enough to find the bootloader on the other EFI System partition, if it's not mounted. Option A is to manually consolidate the contents of the two ESPs (copy the Microsoft directory to the Fedora ESP, then you don't have to change fstab), then rerun grub2-mkconfig. Option B is to manually add a boot entry for Windows to either /etc/grub.d/40custom or 41custom (drop-in) and then run grub2-mkconfig.

cmurf gravatar imagecmurf ( 2018-06-07 11:45:34 -0500 )edit

Indeed, grub2-mkconfig didn't bring the Windows entry back yet. And fstab mounts nvme0n1p5 as /boot/efi, which is indeed missing any Windows entries. Copied ../EFI/Microsoft to /boot/efi/EFI and another grub2-mkconfig run found the Windows Boot Manager - twice: on nvme0n1p1 and on nvme0n1p5. Maybe I should remove this dangling nvme0n1p1 partition or overwrite it, hm. Or retroactively file a bug against the F27-installer for creating a 2nd ESP :-D Thanks for your all your help!

ckujau gravatar imageckujau ( 2018-06-07 12:15:31 -0500 )edit

This sounds risky to remove nvme0n1p1. At least, if you do so, you will need to make some adjustments using efibootmgr. Maybe Windows won't like it either. You probably better leave things as they are.

By the way. Try out sudo os-prober. It will show the other bootable os without modifying anything.

villykruse gravatar imagevillykruse ( 2018-06-07 13:14:58 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-06-07 01:25:15 -0500

Seen: 247 times

Last updated: Jun 07