How to permanently add Linux entry in UEFI menu

It seems GNU/Linux will never be treated with dignity under UEFI. The sorrow adds up when vendors fail to maintain uniformity in UEFI implementation.

Coming to the post, I recently came across Acer Aspire ES 11(ES1-132-C5UF) laptop, surprisingly, all peripherals seems to work with Kubuntu 16.04 Live USB.

However, once installed, the machine fails to boot into Kubuntu. In fact, there was no ‘kubuntu’ entry in UEFI boot order. This made me boot again into the live session to check the EFI partition. In a terminal type

mount /dev/sdX1 /mnt (replace X with your disk name)

list all the directories under the partition

ls /mnt/EFI

It showed the ‘ubuntu’ directory which was created during the OS installation, which means the UEFI boot order is not been updated. This made me turn to ‘efibootmgr’ tool. Again from the live session
sudo efibootmgr

BootCurrent: 0002
Timeout: 0 seconds
BootOrder: 0000,0001,0002,2001,2002,2003
Boot0000* Windows Boot Manager
Boot0001* Unknown Device:
Boot0002* USB HDD: JetFlashTranscend 4GB
Boot2001* EFI USB Device
Boot2003* EFI Network

The output doesn’t contain the ‘ubuntu’ entry. However, the efibootmgr provides options to add new entries, but in our case it fails to update the UEFI’s NVRAM(persistent across boots).

Unfortunately, the standard UEFI-shell was not installed on this laptop, which would have made it easy to add our ‘ubuntu’ entry.

The rEFInd project then came to rescue. The UEFI-shell is bundled in the rEFInd boot manager’s live USB(zip file), which is a compact(~7MB) tool to interact with the UEFI’s.

Note: Read the install instructions in the above downloaded zip file, disable secure-boot under BIOS before selecting the rEFInd USB drive from the boot menu(F12).

rEFInd options

The default rEFInd boot screen

Once in the rEFInd’s UEFI shell, type the following

bcfg boot dump

This will list all the available boot drives starting from Windows Boot Manager. Of course, there is no ‘ubuntu’ entry. Now, we can simply add one

bcfg boot add X fs0:\EFI\ubuntu\shimx64.efi "kubuntu"

Change X with the next available number in the ‘bcfg boot dump’ command. In my case, it was 4. Make sure you also check the path of ‘ubuntu’ EFI directory.

You may check the kubuntu entry by issuing the ‘bcfg boot dump’ command. Now, we may set the priority of kubuntu to be the default boot in our UEFI menu. In my case, the first option was ‘Windows Boot Manager’ and ‘kubuntu’ was next. To change the order just issue the following

bcfg boot mv 1 0

This will set ‘kubuntu’ to default OS, one may select other boot option from menu.

If the above step fails and resets to ‘Windows Boot Manager’, then try moving all the directories except ‘ubuntu’ from the efi partition. So that UEFI doesn’t have any other option to boot. So, boot to your GNU/Linux session(kubuntu in my case) and execute the following

sudo -s

cd /boot/efi

In my setup, I had 3 directories other than ‘ubuntu’, so I moved them to my home directory

mv Boot/ Insyde/ Microsft/ ~

Now simply reboot and I hope it works for you 🙂