How to change the default operating system in Arch Linux (for UEFI and systemd-boot)

This instruction applies to all boot loaders that implement the Boot Loader Specification and/or Boot Loader Interface, such as systemd-boot.

If you have a modern computer (no older than seven years at the time of writing), then it most likely uses UEFI instead of BIOS and, therefore, uses systemd-boot to boot, which is usually mentioned in the Arch Linux installation instructions (although there may be grub).

The bootctl program can check EFI firmware and bootloader status, list and manage available bootloaders and bootloader entries, and install, update, or remove systemd-boot on the current system.

To check if your system uses systemd-boot, run the command:

bootctl is-installed

The following command will show all available loader entries that implement the Boot Loader Specification, as well as any other entries found or automatically generated by a loader that implements the Boot Loader Interface.

bootctl list

  • title is an entry name. Note that the entry with the string “(default)” is selected as the default loaded
  • id is an identifier, it is needed in the commands described below to change the OS loaded by default
  • source is a path in the OS
  • linux is the Linux kernel
  • initrd is initial RAM filesystem. The purpose of initramfs is to boot the system to the point where it can access the root filesystem.
  • options are boot options

The following command sets the default bootloader entry. It takes one string of the bootloader entry ID as an argument.

sudo bootctl set-default ID

The set-oneshot command will set the default entry for the next boot only, set-default will set it permanently for all future bootings.

sudo bootctl set-oneshot ID

Optionally, the bootloader entry ID can be one of: @default, @oneshot, or @current, which corresponds to the current default bootloader entry for all future downloads, the current default bootloader entry for the next boot, and the currently loaded bootloader entry. These special identifiers are converted to the current values of the EFI variables LoaderEntryDefault, LoaderEntryOneShot, and LoaderEntrySelected. These special identifiers are primarily useful as a quick way to permanently make the currently loaded bootloader entry the default choice, or update the default bootloader entry for the next boot to the default bootloader entry for all future bootings, but they can be used for others operations as well. If an empty string ("") is specified as the identifier, the corresponding EFI variable will not be set.

The boot manager integrates with the systemctl command, so the following commands can be used:

systemctl reboot --boot-loader-entry=ID

This command will reboot the computer to the specified bootloader entry.

By the way, to get a very compact list containing only bootloader entries, run the command:

systemctl reboot --boot-loader-entry=help

The following command will immediately reload you into the EFI boot menu. This menu will have a timeout for the specified number of SECONDS:

systemctl reboot --boot-loader-menu=SECONDS

Leave Your Observation

Your email address will not be published. Required fields are marked *

Scroll Up