I use rEFInd for dual-boot with Windows 10 on my PC and I want to remove GRUB because I don't use it and OS boots from rEFInd directly, without GRUB (after rEFInd installation, I removed ubuntu directory from /boot/efi/EFI).

Can I do this safely? If so, how?

Сurrent contents of my /boot/efi/EFI:

maxim@ProBook:~$ sudo ls /boot/efi/EFI
Boot  Microsoft  refind  tools

Installed GRUB packages:

maxim@ProBook:~$ dpkg -l | grep grub
ii  grub-common                                    2.02~beta2-36+elementary11+r2~ubuntu0.4.1               amd64        GRand Unified Bootloader (common files)
ii  grub-efi-amd64                                 2.02~beta2-36+elementary11+r2~ubuntu0.4.1               amd64        GRand Unified Bootloader, version 2 (EFI-AMD64 version)
ii  grub-efi-amd64-bin                             2.02~beta2-36+elementary11+r2~ubuntu0.4.1               amd64        GRand Unified Bootloader, version 2 (EFI-AMD64 binaries)
ii  grub-efi-amd64-signed                          1.66.2+elementary11~ubuntu0.4.1+2.02~beta2-36ubuntu3    amd64        GRand Unified Bootloader, version 2 (EFI-AMD64 version, signed)
ii  grub2-common                                   2.02~beta2-36+elementary11+r2~ubuntu0.4.1               amd64        GRand Unified Bootloader (common files for version 2)

Thank you in advance!

up vote 4 down vote accepted

The short answer is "yes, you can safely remove GRUB if rEFInd works for you." There are some caveats, though. Most notably, it's always possible that something in the future will break. For instance, there's bug #1649326, which is preventing kernels 3.13.0-101 through at least 3.13.0-106 from booting via rEFInd (or any other method that relies on the EFI stub loader). That said, given the way Ubuntu keeps the currently-booted kernel installed, even if you ran into a problem like this, it should be possible to boot the old kernel via rEFInd, either indefinitely or until a real solution is found.

As to how to remove GRUB, the following command should delete the packages:

dpkg -P grub-efi-amd64 grub-efi-amd64-signed grub-common grub-efi-amd64-bin \
        grub-common grub2-common shim-signed

There are three caveats:

  • Package changes might necessitate a change to the preceding package list. (That list is taken from this page of the rEFInd documentation, which I wrote a couple months ago.)
  • This command removes the packages, but not the GRUB binary on the ESP. To delete that, you'll need to type sudo rm -rf /boot/efi/EFI/ubuntu.
  • Ubuntu is likely to try to add GRUB back. To deal with this issue, I personally employ an empty "dummy" package that claims to be GRUB 3. You can download it from here, if you care to use it. Since it claims to be GRUB 3, Ubuntu won't try to replace it with GRUB 2.

Alternatively, you could delete the files on the ESP and then simply lock the installed GRUB version with a command like this:

apt-mark hold grub-efi-amd64 grub-efi-amd64-signed grub-common \
              grub-efi-amd64-bin grub-common grub2-common

This should keep GRUB off the ESP and prevent future GRUB updates, although your current GRUB package will technically remain installed.

A third possibility is to use dont_scan_file or dont_scan_dirs in refind.conf to keep Ubuntu's GRUB out of the rEFInd menu. This solution won't remove GRUB at all, which has the advantage that it should remain accessible via the computer's built-in boot manager should it ever be needed. OTOH, if Ubuntu should update GRUB, it will take over as the default boot manager. See this page for more ideas on how to handle such issues.

  • Thank you! I removed GRUB packages via your command (after that apt autoremove also removed mokutil, os-prober, secureboot-db and shim packages), installed "GRUB 3" and removed /boot/grub folder and it works! I tried to install newest kernel manually and didn't get any problems. – png2378 Dec 15 '16 at 0:11

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.