I've installed Ubuntu 19.10 on my MacBook (Mid-2010 a.k.a. Macbook7,1) as the only OS. Right now my system is working but it has a few issues. One of those issues is that I can't seem to get GRUB to show a menu no matter what I do. Right now, this is what my /etc/default/grub
file contains:
GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
GRUB_GFXMODE=auto
When my computer boots, I see a non-blinking _
symbol for about 5 seconds and then I see the normal kernel output that you seen when Ubuntu starts booting. If I press the ESC
key when the _
is showing, the boot will not continue and the screen is stuck like that until I forcibly power down the system by holding the power button.
A clue that I have noticed is that the grub menu works perfectly fine when booting from the USB installer. I've looked at the grub.cfg
on the USB installer, and it has this line which seems absent from /boot/grub/grub.cfg
on my Ubuntu install: insmod efi_gop
So given this info, how do I configure GRUB to show a menu?
Best Answer
SHORT ANSWER
This workaround worked on my 13" Apple Macbook Pro mid-2009 running 64-bit XUbuntu 20.04:
shim*.efi
file located at/boot/efi/EFI/ubuntu/
shim
andshim-signed
) from the system.grub
folder located at/boot
grub-install /dev/sda ; grub-install --recheck
)./etc/default/grub
in order to [1] activate GRUB's console mode and [2] force GRUB to show its menu for 3 seconds, under such console mode. You do this by basically settingGRUB_TIMEOUT_STYLE=menu
,GRUB_TIMEOUT=3
andGRUB_TERMINAL=console
in/etc/default/grub
.sudo update-grub
so these fixed default settings are applied to the "fresh" GRUB install.efibootmgr
in order to make sure thatubuntu
(i.e.grubia32.efi
orgrubx64.efi
, created and stored at/boot/efi/EFI/ubuntu
) still is the default EFI boot loader option.(VERY) LONG ANSWER: HOW TO PERFORM THE ABOVE PROCEDURES
CREATE THE LIVECD.
There are several ways to create a LiveCD. The most basic ones, in my opinion, consist of downloading the *Ubuntu LiveCD
.iso
file (e.g.ubuntu-20.04-amd64.iso
) and then either using UNetbootin to burn it into a USB stick (flashdrive) or (if you have access to a Linux shell terminal such asbash
) usingdd
to burn such.iso
file into any external media (USB stick, writeable CD-ROM etc.). The answers to this question provide a quite detailed set of procedures about it.DELETE THE SHIM EFI FILES.
Once you've created your LiveCD and tested it to make sure that it's going to work if you happen to need it, open a shell terminal emulation window (CtrlAltT is a shortcut to it, but you can also run it from the Applications panel/menu or right-click a free area in the Desktop and then select the Terminal option) and then run
sudo su
in the terminal so you become the root user. Becoming root will spare you from having to usesudo
on every shell command from this point on. After becoming root, delete theshim*.efi
file (e.g.shimia32.efi
for 32-bit systems,shimx64.efi
for 64-bit systems) that is probably located at/boot/efi/EFI/ubuntu
. Assuming that the shim.efi
file is indeed located at/boot/efi/EFI/ubuntu
, it can be deleted by running this command in the terminal:If the EFI partition isn't mounted, the command
mount /boot/efi
will likely mount it. If such command doesn't mount it, runlsblk -o NAME,FSTYPE,MOUNTPOINT,PARTLABEL |grep -i efi
to find your EFI partition (e.g./dev/sda1
) and then mount it (e.g.mount /dev/sda1 /boot/efi
). If the/boot/efi
mount point does not exist, create it with the commandmkdir -p /boot/efi
and then mount the EFI partition at it (e.g.mount /dev/sda1 /boot/efi
).Furthermore, once such EFI partition is mounted at
/boot/efi
, and assuming that the shim.efi
file is at/boot/efi/EFI/ubuntu
, a command likethunar /boot/efi/EFI/ubuntu
ornautilus /boot/efi/EFI/ubuntu
(depending on which file manager your system uses) will give you root access to such folder (e.g./boot/efi/EFI/ubuntu
) directly from your file manager (windowed interface): this makes it easier to browse, find and then delete the shim.efi
file (e.g.shimx64.efi
).*WARNING* If you're connected as root and accidentally delete the wrong file, such file is lost forever (it does not go to the trash bin). It's therefore advised that you pay a lot of attention on what you're doing so you don't end up rendering your operating system unusable/inaccessible.
In case you're wondering why you should delete the shim
.efi
file (i.e. the 32-bitshimia32.efi
file or the 64-bitshimx64.efi
file): GRUB's.efi
file (i.e. the 32-bitgrubia32.efi
file or the 64-bitgrubx64.efi
file) is the appropriate one to use on a computer where Secure Boot is disabled. The shim version actually just provides a signed version of the GRUB.efi
file version (because Secure Boot requires such signed version). But if you install *Ubuntu on a Mac with disabled Secure Boot (which is the frequent case), *Ubuntu adds the shim EFI file as the default option even though the Mac's firmware tells the bootlader to load the unsecure GRUB EFI file. So the solution is to delete the shim (Secure Boot) EFI file and then make the GRUB (non-Secure Boot) EFI file the new default one that must "interact" with the Mac's hardware at boot time.PURGE THE SHIM DEB PACKAGES.
After you delete the shim
.efi
file that was located at e.g./boot/efi/EFI/ubuntu
, run APT to purge the shim DEB packages and therefore prevent future shim updates from creating the problematic.efi
file again:DELETE THE GRUB FOLDER.
Now that you're rid of shim, it's time to get rid of GRUB: go back to your file manager window (e.g. Nautilus, Thunar...) and delete the
grub
folder that is likely located at/boot
. If you don't find thegrub
folder in/boot
, run the commandupdatedb ; locate -i grubenv
to find the location of thegrubenv
file: this file is stored at thegrub
folder, thus if you find the location of thegrubenv
file you find the location of thegrub
folder.If you prefer to delete the
grub
folder from the terminal (assuming that it's located at/boot
), just run:...and the
grub
folder will be deleted.INSTALL A "FRESH" COPY OF GRUB.
Assuming that GRUB was installed in your first SATA storage drive (i.e.
sda
), install it back there by running this command:If your EFI partition is located at e.g.
sda
(e.g./dev/sda1
), it's common practice to install GRUB in/dev/sda
. If your EFI partition is located at e.g.sdb
(e.g./dev/sdb1
), it's common practice to install GRUB in/dev/sdb
. And so on.As explained here, it's also possible to use your LiveCD to install a "fresh" GRUB in your boot disk (e.g.
/dev/sda
). This method is particularly useful when your system's GRUB installer is damaged and you're temporarily unable to reinstall it through e.g. APT. I.e. for a 64-bit Intel Mac, the root installation command currently isapt install grub-common grub-efi grub-efi-amd64 grub-efi-amd64-bin grub-efi-amd64-signed grub-pc-bin grub2-common
, but if it's not working on your system, you can always boot the LiveCD so GRUB is installed from the packages that are running from your LiveCD and then the newgrub
folder created in e.g./boot
is created by this LiveCD's GRUB.FIX GRUB'S DEFAULT SETTINGS.
If you don't have the Gedit text editor, install it by running the command
apt-get install gedit -y
and then run this command in order to edit GRUB's default settings file with Gedit:Once the Gedit window shows the contents of the
grub
file, remove the#
character that is located at the left side of each one of the parametersGRUB_TIMEOUT_STYLE
,GRUB_TIMEOUT
andGRUB_TERMINAL
, and then modify their options so they become these:menu
option tells GRUB that it must create and show a menu when the computer is started or restarted.3
option tells GRUB that it must wait 3 seconds before automatically booting the default operating system kernel, so the user has enough time to e.g. select a different kernel from the menu (if you prefer, you may either lower it to 1 or 2, or increase it to 4, 5 etc.).console
option tells GRUB that it must ignore the graphics card's most appropriate driver and instead use a simplified VGA display driver that is much more basic but also much more compatible: it won't provide a fancy menu, but will provide a functional one that's more likely to work and be visible.When you're done making the above modifications, save the file and then exit the Gedit text editor.
If you prefer to use the shell's standard text editor (which happens to be Nano), run
nano /etc/default/grub
instead ofgedit /etc/default/grub
.APPLY THE CHANGES THAT WERE MADE IN GRUB'S DEFAULT SETTINGS.
This one is easy. Just go back to the terminal and run this command:
The above command will read the content of
/etc/default/grub
and apply it into the settings of the "fresh" GRUB install, thus changing GRUB's behavior from this point on.MAKE SURE THAT THE CORRECT BOOT EFI IS SELECTED.
Assuming that your EFI partition is mounted at
/boot/efi
and the shim.efi
file that you deleted was stored at/boot/efi/EFI/ubuntu
(this is *Ubuntu's default location for its.efi
files), check if the GRUB's.efi
file is there:Because Intel Macs are 64-bit computers, it's expected that a 64-bit *Ubuntu was installed on it, and that therefore a file named
grubx64.efi
is found by the command above. However, 32-bit systems should instead use a file named e.g.grubia32.efi
, so in case your system is a 32-bit one, look for the 32-bit version of the GRUB.efi
file.If no GRUB
.efi
file is found, something's wrong and you're advised to install GRUB again (see STEP 5).If the GRUB
.efi
file is found, then it's now time to check if theubuntu
EFI folder is selected as the default (i.e. first) source of.efi
files (this precedence is important at boot time). In order to do it, run this command:The output must show something like this:
In my case,
ubuntu
is identified asBoot0001*
(its number is0001
), thus it's the one that needs to be the default option: from left to right,BootOrder
must show0001
(i.e.ubuntu
) first. If this is not your case, fix it by running a command like this:This is going to make
0001
(i.e.ubuntu
) the first boot option,0080
(i.e.Mac OS X
) the second one, and0081
(i.e.Mac OS X
) the third one (I'm yet to find what is the difference between0080
and0081
. Anyway...).If your bootloader is placed at e.g.
/dev/sdb
, you must update the boot manager by running the commandefibootmgr --disk /dev/sdb
.If
ubuntu
isn't the active boot, make it active withefibootmgr -b 0001 -a
. See more e.g. here or by runningefibootmgr --help
.REBOOT THE SYSTEM.
Reboot your system in order to check if all this long journey fixed things out. You may reboot it from the menu or by running one of these terminal commands:
or
or
or
BOOT FROM THE LIVECD IN CASE OF PROBLEM.
The standard way to boot from a LiveCD on a Mac (iMac, Macbook etc.):