rEFInd Question: Remove multiple boot items?

29,417

Solution 1

There are a number of ways to do what you want, but first, understand that you've got three (or maybe four) entries that boot Ubuntu in different ways:

  • The grubx64.efi entry launches GRUB, which in turn launches the Linux kernel (and may also offer its own menu for booting other things, depending on how it's configured).
  • The boot\vmlinuz-3.11.0-18-generic.efi.signed entry launches the 3.11.0-18-generic kernel without using GRUB. (It boots via the EFI stub loader, which is built into the kernel itself.)
  • The boot\vmlinuz-3.11.0-15-generic.efi.signed entry launches the 3.11.0-15-generic kernel -- a slightly older kernel than the preceding one.
  • The "Boot Legacy OS..." option might launch a BIOS-mode version of GRUB -- you don't describe what happens when you select that option, so it's not really clear if it does this or is useful at all.

In any event, the big distinction here is between GRUB and the EFI stub loader. In most cases, both approaches to booting Linux work equally well, but sometimes one works better than the other. Personally, I dislike GRUB; IMHO it's bloated and unnecessarily complex. It's also an extra step in your boot path, given that you probably need rEFInd to manage your triple-boot on a Mac. OTOH, GRUB is the standard way of booting Ubuntu. Note that, although GRUB has just one entry in rEFInd, its own menu (if you set it to appear) will probably enable you to boot either of the two Linux kernels that rEFInd lets you boot directly.

Personally, I'd keep all of those three entries (GRUB and the two kernels), at least if they all work. The reason is that they give you multiple options to boot your computer; if one fails, you'll have the others as fallbacks. Note that your kernel selection is likely to increase as you upgrade your system and new kernels are released. You can keep the list to two or three by using sudo apt-get autoremove once the list grows beyond that limit.

If you want to remove entries, you have several options, most of which involve editing refind.conf (which is probably in /boot/efi/EFI/refind under Linux):

  • Add the filename(s) you want to avoid scanning to dont_scan_files. Note that hiding individual kernels in this way is inefficient, since you'll need to update the list when new kernels are installed. This could be a good way to hide GRUB, though.
  • Add the directory/ies where unwanted boot loaders are described to dont_scan_dirs. (For instance, boot to remove the Linux kernels or EFI/ubuntu to remove GRUB.)
  • Add the volume names associated with unwanted boot loaders to dont_scan_volumes. Note that this is the only dont_scan_* option that works with BIOS/CSM/legacy boot options; add any subset of the relevant name to block that entry.
  • To disable all disk-based BIOS/CSM/legacy boot options, uncomment scanfor and ensure that hdbios is not among the options. This is probably undesirable in your case, though, since you say you're booting Windows 7, and that usually boots in BIOS/CSM/legacy mode. If you managed to install Windows in EFI mode, though, this might be a good option.
  • To remove both the kernel options, and all future kernel options, you can remove the EFI filesystem driver for your Linux filesystem from the drivers (or drivers_x64 or drivers_ia32, depending on your architecture) subdirectory of the EFI/refind directory on your ESP. This will render rEFInd unable to locate the Linux kernels, so those options will disappear. GRUB does not rely on these drivers, so it will continue to work.
  • BIOS/CSM/legacy options appear only when rEFInd thinks it's detected boot code on a disk's MBR or in a partition. Given the description of your "Boot Legacy OS..." option, rEFInd has probably found boot code in the MBR. (Bugs in some recent versions of rEFInd cause misidentification of the location, though, so if you're not using version 0.8.7, that identification may be incorrect.) Wiping the boot code can therefore remove an entry from rEFInd's menu. This approach is DANGEROUS, though. I recommend trying it only if you already understand how to do it, which is why I am deliberately not providing explicit instructions on doing it -- I could write a whole answer about how to do this task and it would still probably be incomplete.

The refind.conf options are described in more detail in comments within refind.conf and on the rEFInd configuration documentation page.

Solution 2

Easy Fix

In rEFInd bootloader menu, you can hide the excess entries by selecting the extra entries by arrow keys in keyboard and then pressing the Delete key! A confirmation will pop up...upon selecting yes, the entry gets hidden and your bootloader is good to go!!

Cheers!

Share:
29,417

Related videos on Youtube

whitecrow1
Author by

whitecrow1

Updated on September 18, 2022

Comments

  • whitecrow1
    whitecrow1 over 1 year

    Just installed Ubuntu on a separate drive (not partitioned with any other OS), as well as rEFInd, on my Mac Pro. I managed to get it all to start up properly and can boot to any of the locations from rEFInd without trouble. The problem is, I have 3 extra items loading on the boot manager that I kind of want to get rid of. I have been searching for answers and still nothing seems to work. Aside from my OS X, Windows 7, and Ubuntu Grubx64 (whatever that means), I have the following items:

    boot\vmlinuz-3.11.0-18-generic.efi.signed
    boot\vmlinuz-3.11.0-15-generic.efi.signed
    Boot Legacy OS from whole disk volume

    I keep seeing people say "well try this" and they just give the method without giving the directions for how to actually do it. Can someone just give me a simple set of directions for how to hide these?

  • Rod Smith
    Rod Smith almost 9 years
    You should NOT move your kernel files! GRUB relies on them being where they are, too! You might get away with it under certain circumstances, but at best that's a very risky action to take!
  • Organic Marble
    Organic Marble about 4 years
    Fun fact: the other answer was written by the developer of rEFind.
  • Soujatya Sarkar
    Soujatya Sarkar about 4 years
    Ask him if I am wrong, cuz i solved my problem with this solution.
  • Carlos Pinzón
    Carlos Pinzón over 3 years
    This should be the accepted answer. The detailed low-level version is ok, but very unnecessary.
  • Clemens
    Clemens almost 3 years
    I agree, uncommenting the scanfor value is really the best and cleanest solution. My steps on Kubuntu 20.04 LTS were sudo nano /boot/efi/EFI/refind/refind.conf and then remove the # before scanfor internal,external,optical,manual,firmware. Done! :-) PS There seems to exist (as of 2021) some sort of bug in gptfdisk when 5 GPT partitions are present (at one single disk). It is not possible to convert the hybrid GPT scheme to a clean GPT protective one, not in Mac OS and not in Kubuntu. Although gptfdisk confirms the change, it is after reboot still hybrid. (Hardware: iMac 8,1)
  • Clemens
    Clemens almost 3 years
    Well, this is absolutely a possible way. However, in my case I wanted to disable the legacy BIOS/MBR boot functions in rEFInd completely. This can be done quite easy with the above mentioned change, sudo nano /boot/efi/EFI/refind/refind.conf and then remove the # before scanfor internal,external,optical,manual,firmware. Done!
  • Rod Smith
    Rod Smith almost 3 years
    The method specified in this answer is perfectly valid. I wrote my previous answer before I implemented this method, so my answer omitted this option because it didn't exist at the time. That's what happens in five years' time....
  • Typewar
    Typewar over 2 years
    @RodSmith Would you mind adding this to the bottom as a hint? This is what threw me off a bit.
  • Matthias Pitscher
    Matthias Pitscher over 2 years
    How to a get an entry back after I hide it with del or -?