bootctl utility rather than editing configuration files directly. The LoaderEntryDefault setting is stored in volatile memory and persists only until the next reboot unless explicitly written to NVRAM via bootctl set-default. This ensures your preferred operating system loads automatically without manual intervention at the bootloader menu.
Understanding systemd-boot Configuration
systemd-boot is a simple UEFI boot manager that reads configuration from the ESP (EFI System Partition). Unlike GRUB, it does not maintain a complex database of entries in a single file. Instead, it scans specific directories for .conf files that describe each operating system or kernel. When you want to change which OS boots by default, you are essentially telling the bootloader which entry to select automatically.
The confusion often arises because users try to edit the loader configuration files manually to set defaults. While you can specify a default entry in the main loader.conf file using the default directive, this method is static. If you add new kernels or remove old ones, the hardcoded path might break. A more dynamic approach involves using the bootctl command-line tool, which interacts with the firmware's EFI variables directly.
Locating Your Windows Entry
Before changing the default, you need to identify the exact identifier of your Windows installation. Boot into Linux and open a terminal. Use the following command to list all available boot entries:
bootctl list
This output displays a table with columns for ID, Title, and Type. Look for an entry that identifies Windows, such as Windows Boot Manager or a similar string. Note the ID column value, as this is what you will pass to the set-default command. For example, if the ID is windows, you will use that string in subsequent steps.
Setting the Default Entry Permanently
To make Windows the default boot option, run the following command with root privileges:
sudo bootctl set-default windows
This command writes the chosen entry ID into the EFI variable LoaderEntryDefault. This variable is read by systemd-boot during the initialization phase. By updating this variable, you ensure that the bootloader skips the menu after the timeout period and proceeds directly to the selected OS. This method is robust because it relies on the bootloader's internal logic rather than static file paths.
If you ever need to revert to manual selection, you can clear the default by running:
sudo bootctl set-default ""
This removes the preset, causing systemd-boot to display the full menu every time the system starts. This is useful for troubleshooting or when you frequently switch between operating systems.
Verifying the Change
After setting the default, verify that the change has been applied correctly. You can check the current EFI variables by inspecting the loader status:
bootctl status
Look for the line indicating Default Boot Loader Entry. It should display the ID you just set. Additionally, restart your computer and observe whether the system boots directly into Windows. If it still shows the menu, ensure that the timeout setting in /boot/loader/loader.conf is configured appropriately. A timeout of zero disables automatic selection entirely, while a positive number sets the delay before auto-booting.
Troubleshooting Common Issues
Sometimes, the EFI variable may not update due to permission issues or filesystem restrictions. Ensure that you are running the bootctl command as root. If the command fails, check the journal logs for errors:
journalctl -u systemd-boot
Another common issue is mismatched identifiers. If the ID you provided does not match any entry in the bootctl list output, the command will fail silently or throw an error. Always double-check the ID spelling and case sensitivity. Furthermore, some UEFI implementations have quirks with how they handle EFI variables. If you experience inconsistent behavior, consider checking your BIOS settings for any "Fast Boot" options that might bypass standard bootloader sequences.
For more insights on managing dual-boot environments, see our guide on Managing Files in Dual-Boot Linux and Windows. Understanding how both systems interact with the disk can prevent conflicts and ensure smoother transitions.
Frequently Asked Questions
Why doesn't my Windows entry show up in bootctl list?
Your Windows entry might be hidden or located in a different directory. Ensure that the .conf file for Windows exists in the /boot/loader/entries/ directory. If it is missing, you may need to create it manually or reinstall the bootloader to detect the existing Windows installation.
Can I set the default using a text editor instead of bootctl?
Yes, you can edit /boot/loader/loader.conf and add a line like default windows. However, this method is less flexible than using bootctl because it hardcodes the path. If your Windows partition label changes, the static reference might break, whereas bootctl manages references more dynamically.
What happens if I delete the EFI variable?
Deleting the LoaderEntryDefault variable resets the bootloader to its fallback behavior, which is typically displaying the menu. This is safe and reversible. You can always re-set the default using the bootctl set-default command again.
Does this affect my Windows hibernation state?
No, changing the boot order in systemd-boot does not impact Windows hibernation. However, if you are experiencing issues with waking from hibernation, refer to our article on Recovering Hibernated Windows 10 SSD for solutions related to storage and power states.
Is it safe to use bootctl on other distributions?
Yes, bootctl is part of the systemd package, which is widely used across many Linux distributions. As long as your system uses systemd-boot as the bootloader, the commands will work similarly regardless of the distro, provided you have the necessary permissions.