Ask Your Question

How to reinstall grub2 ?

asked 2018-03-19 07:44:42 -0500

Nicryc gravatar image


It was Tuesday, I run the dnf autoremove command which has removed the grub2 packages. Then at the end of the day I turned off my computer. Yes I'm stupid I know. On Friday, I turned on my PC, it worked perfectly normal. But on Sunday, I try to turn it on and a beautiful blue screen appeared :

Performance MOK management --> Continue boot --> Enroll key from disk --> Enroll hash from disk

I try "Continue boot" and boot manager appears. It's not the usual one which is black and white, this one has a blue background :

--> Boot manager of the OS - Fedora --> Boot manager of the OS - Windows Boot Manager --> Boot from EFI file (Press F10 to install utility and Escape to leave)

When I try Fedora it go back to "MOK management" and it repeats. When I try Windows, it boot Windows normally. So I tried to press F10 on the Fedora option and it go to the BIOS manager, where you can change the date, the boot order etc.

I don't know what happened. Anyway I assume it's the grub. So I tried to reinstalled it. I booted on a Live USB, I followed a tutorial on a website to mount the HDD and my Fedora partition. It worked. For example I can access the dnf history of my computer. But I tried to reinstall the grub2 package and also to undo the autoremove command but it seems like it doesn't have access to the WiFi. I have an error message :

"failed to synchronize cache for repo updates"

Can you help me ?

edit retag flag offensive close merge delete


Connect your Live system to Wifi before you chroot into your actual Fedora system. Or use a wired ethernet connection.

The error you are mentioning could also be unrelated to your machine. It could be as simple as a mirror server being down or malfunctioning.

florian gravatar imageflorian ( 2018-03-19 08:54:32 -0500 )edit

Hi @florian shares a good idea.

Are you able to use the WiFi from the LIVE CD or is it only after your boot into Fedora ? What happens if you open a terminal window and type: ping ? Do you get a response like ? ping PING ( 56(84) bytes of data. 64 bytes from icmpseq=1 ttl=57 time=9.17 ms 64 bytes from icmpseq=2 ttl=57 time=14.2 ms 64 bytes from icmpseq=3 ttl=57 time=9.02 ms 64 bytes from icmpseq=4 ttl=57 time=9.44 ms Can you also tell me what sort of PC, Laptop or Mac you are running Broadcomm can be issue on some LTP's

smitchall gravatar imagesmitchall ( 2018-03-19 09:55:45 -0500 )edit

I do connect to the WiFi on the Live USB before doing a chroot. I can access the Internet from it, I can even execute dnf command like install, search, upgrade etc.

I'm on a HP Envy 13 notebook.

Nicryc gravatar imageNicryc ( 2018-03-19 19:06:47 -0500 )edit

Instead of chroot you could try to use the --installroot=<path> option.

dnf --installroot=/mnt ...

assuming you mounted your root file system on /mnt and the boot and efi file systems on /mnt/boot and /mnt/boot/efi respectively.

villykruse gravatar imagevillykruse ( 2018-03-20 00:43:08 -0500 )edit

How did you try to reinstall GRUB? You have an EFI system, so the package you need is grub2-efi and as was mentioned, make sure you have the EFI partition mounted on /boot/efi before you install that package. Don't run grub2-install.

ssieb gravatar imagessieb ( 2018-03-20 20:23:50 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-27 18:37:25 -0500

cmurf gravatar image

updated 2018-03-27 18:38:30 -0500

(The comment field is too short so I'm using this.)

Have you ever used mokutil before? I've never used it before now and have never seen this blue screen until I used 'mokutil --enable-validation`. When I did that a new entry appears in NVRAM.

-rw-------. 1 root root 44 Mar 27 17:16 MokSB-605dab50-e046-4300-abb6-3dd810dd8b23

But then if I just continue and don't actually try to register a key, it goes away, and the blue screen doesn't come up on the next boot. I think you might have NVRAM corruption - this is so common with NVRAM containing boot settings that Apple has had a keyboard shortcut used at boot time to reset NVRAM for ~30 years. Every PC vendor has a different way of resetting NVRAM and many don't publish a way of doing this, so I can't really offer advice. It does seem safe to just use rm-f on the MokSB file in /sys/firmware/efi/efivars/ it might just be stuck. In any case feel free to ls -l that entire directory and post it somewhere, maybe that'll be enlightening.

If you haven't tried it already, do a power off. Sometimes cold boots do NVRAM garbage collection differently. Also, absolutely make sure your firmware is up to date. Go check the manufacturer web site, make sure you've got the latest firmware for your make/model. Maybe there's a firmware bug preventing garbage collection of NVRAM. We're sorta grasping at straws but I've seen it before.

I also wonder if there's a reliable tool from the PC manufacturer or on Windows that will remove extraneous NVRAM entries... that's another idea. After that, I think you need to bug folks on Fedora Devel list, because the documentation on mokutil and shim is sufficiently light that I don't know what else to recommend but I think having to reinstall is really using a backhoe for a task requiring a trowel and I'm unconvinced it'll fix the problem besides.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-03-19 07:44:42 -0500

Seen: 698 times

Last updated: Mar 27 '18