Looking for a way to install a couple of operative systems in a laptop compatible with UEFI I need to found how to change the default boot operative system selected for UEFI, or in other words how to change the order of the default entries of boot options in UEFI so it starts Ubuntu instead Windows (i.e).
All of this started with the installation of each operative system, each of them will create an special partition between 300 – 500 MB which will act for file system for UEFI (In my case after installing Ubuntu it was /dev/sda/1) . If you mounted that partition probably you’ve found this file system hierarchy:
# mount the partition mount /dev/sda1 /mnt/sda1 # Check inside /EFI /ubuntu
Inside the /ubuntu directory we will find:
grub.cfg # grub2 config file grubx64.efi # boot loader mmx64.efi # shumx64.efi # boot pre-loader (secure boot) fw # Some sort of directory for firmware? It's empty anyway fwupx64.efi # Firmware Update (fw up)
Those files are important because they contain instructions on «how to load the operative system» in this case «Ubuntu» and where it is located «which partition» among other information.
We need to backup the ubuntu directory under EFI and proceed to install the next operative system:
/EFI /boot (Clonezilla) # Clonezilla operative system /ubuntu # Ubuntu operative system /home # clonezilla's file system /live # clonezilla's file system /syslinux # clonezilla's file system /GPL # clonezilla's file system /utils # clonezilla's file system /efidefaults #clonezilla's file system
In this case I’ve installed Clonezilla (by decompressing it directly on the partition). Don’t get confused about the other directories, you are only interested on /boot (clonezilla although it could be Debian, Lubuntu or even Windows) and /ubuntu.
The thing is, after decompressing Clonezilla the UEFI boot process always starts Ubuntu, so how to modify that behavior?
Changing which Operative system to load by default with UEFI
The first thing we need is a CLI (a command line interface like bash) and the efibootmgr utility, fortunately for me Clonezilla has both things! You could also use an ubuntu live or other tool that has efibootmgr, I’ve started Clonezilla from a pendrive. I highly recommend reading the answer given here which describes other ways to do this.
Executing efibootmgr without parameters shows this:
root@debian:~ efibootmgr BootCurrent: 000E Timeout: 0 seconds BootOrder: 0010,000A,000C,000B,0000,0001,0002,0003,0004,0005,0006,0007,0008,0009,000D Boot0000 Startup Menu Boot0001 System Information Boot0002 Bios Setup Boot0003 3rd Party Option ROM Management Boot0004 System Diagnostics Boot0005 System Diagnostics Boot0006 System Diagnostics Boot0007 System Diagnostics Boot0008 Boot Menu Boot0009 HP Recovery Boot000A USB: Boot000B* WDC WD5000LPLX-60ZNTT1 : Boot000C* Intel Corporation: IBA CL Slot 00FE v0106 Boot000D Network Boot Boot000E* \EFI\boot\bootx64.efi Boot000F Network Boot Boot0010* ubuntu
So Ubuntu is being loaded as Boot0010* ubuntu as first in the UEFI boot order: BootOrder: 0010,000A,000C, etc… And clonezilla it’s Boot000E* \EFI\boot\bootx64.efi
I don’t like the name given automatically by UEFI so I added the entry with a custom label:
# adding a UEFI boot entry efibootmgr -v -c -L clonezilla -l '\EFI\boot\bootx64.efi'
The parameters are:
- -v verbose
- -c create
- -L custom label
- -l loader name
And now I have:
root@debian:~ efibootmgr BootCurrent: 000E Timeout: 0 seconds BootOrder: 0010,000A,000C,000B,0000,0001,0002,0003,0004,0005,0006,0007,0008,0009,000D .... etc .... Boot000E* \EFI\boot\bootx64.efi Boot000F Network Boot Boot0010* ubuntu Boot0011* clonezilla
And to make Clonezilla boot by default we change the BootOrder with the switch -o (explicitly set BootOrder)
# 0010 is ubuntu and 0011 is Clonezilla efibootmrg -o 0011,0010,000A,000C,000B,0000,0001,0002,0003,0004,0005,0006,0007,0008,0009,000D
After restating the computer Clonezilla is being loaded as default.
Topics I’ve read for this post: