-
Notifications
You must be signed in to change notification settings - Fork 0
Change default kernel
It is possible to have multiple kernels (or "versions") of the same Linux distro installed on a computer. The newest kernel is usually booted by default, but this can be adjusted to user preference.
To change the default kernel at system boot, you need to identify and adjust the kernel ids used in the boot loader config file.
Note
This guide assumes your system is using the default systemd boot manager for Endeavour OS, rather than grub or refind.
-
Change to the root user with
sudo -sand enter your password. -
Check which kernel is currently set as default with:
$ bootctl list
-
The terminal will display various details for installed kernels, indicating the kernel
(selected)at boot and set as(default).# kernel currently booted and set as default type: Boot Loader Specification Type 1 (.conf) title: EndeavourOS (6.19.11-arch1-1) (default) (selected) # current id: 1fcde8d015be4360aa122975ea19eca2-6.19.11-arch1-1.conf source: ... sort-key: endeavouros-6.19.11-arch1-1 version: 6.19.11-arch1-1 machine-id: 1fcde8d015be4360aa122975ea19eca2 # current default id linux: ... initrd: ... options: ...
# kernel to set as default at boot type: Boot Loader Specification Type 1 (.conf) title: EndeavourOS (6.19.12-arch1-1) id: af2ba735c1714a3ebdd24c10355d5b20-6.19.12-arch1-1.conf source: ... sort-key: endeavouros-6.19.12-arch1-1 version: 6.19.12-arch1-1 machine-id: af2ba735c1714a3ebdd24c10355d5b20 # id to set as default
-
Copy the
machine-idof the kernel you want to set as the default. In this example:-
Current id:
1fcde8d015be4360aa122975ea19eca2 -
New id:
af2ba735c1714a3ebdd24c10355d5b20
-
Current id:
-
Enter
nano /efi/loader/loader.confto edit the boot loader config in the terminal.
-
Replace the old kernel
idwith the one you copied from earlier. This goes on the line containingdefaultin the config file. -
Be sure to add a wildcard/asterisk after the
id(no space in between). This ensures the same kernel is booted regardless of version number.default af2ba735c1714a3ebdd24c10355d5b20* # add wildcard * timeout 20 # wait time (sec) before system boots default console-mode auto reboot-for-bitlocker 1
-
Double check the kernel
idyou entered is an exact match with the one frombootctl list. -
Press
Ctrl+Xto finish editing, then pressYto save the updated config.
-
Run
bootctl listagain to verify the desired kernel was set as default, indicated with(default)by the kernel title.type: Boot Loader Specification Type 1 (.conf) title: EndeavourOS (6.19.12-arch1-1) (default) # new default id: af2ba735c1714a3ebdd24c10355d5b20-6.19.12-arch1-1.conf source: ... -
Rebootthe system to check that the correct kernel boots by default.
Useful resources:
A list of the installed kernels can also be viewed with the ls command. This does not indicate which kernel is set to default, but has a much simpler terminal output.
-
Enter
ls /efi/loader/entries/to display a list of the kernel entries.$ sudo ls /efi/loader/entries/ 1fcde8d015be4360aa122975ea19eca2-6.18.21-1-lts.conf 1fcde8d015be4360aa122975ea19eca2-6.19.11-arch1-1-fallback.conf 1fcde8d015be4360aa122975ea19eca2-6.18.21-1-lts-fallback.conf af2ba735c1714a3ebdd24c10355d5b20-6.19.12-arch1-1.conf 1fcde8d015be4360aa122975ea19eca2-6.19.11-arch1-1.conf af2ba735c1714a3ebdd24c10355d5b20-6.19.12-arch1-1-fallback.conf
-
The kernel id is the identifying string in front of the version number.
# kernel id # version number af2ba735c1714a3ebdd24c10355d5b20-6.19.12-arch1-1.conf 1fcde8d015be4360aa122975ea19eca2-6.19.11-arch1-1.conf -
Enter
ls -l /efi/loader/entries/to list all kernel entries with last updated dates.$ sudo ls -l /efi/loader/entries/ total 24 -rw-r----- 1 root root 534 Apr 6 03:23 1fcde8d015be4360aa122975ea19eca2-6.18.21-1-lts.conf -rw-r----- 1 root root 565 Apr 6 03:23 1fcde8d015be4360aa122975ea19eca2-6.18.21-1-lts-fallback.conf -rw-r----- 1 root root 542 Apr 6 03:23 1fcde8d015be4360aa122975ea19eca2-6.19.11-arch1-1.conf -rw-r----- 1 root root 573 Apr 6 03:23 1fcde8d015be4360aa122975ea19eca2-6.19.11-arch1-1-fallback.conf -rw-r----- 1 root root 542 Apr 20 18:18 af2ba735c1714a3ebdd24c10355d5b20-6.19.12-arch1-1.conf -rw-r----- 1 root root 573 Apr 20 18:18 af2ba735c1714a3ebdd24c10355d5b20-6.19.12-arch1-1-fallback.conf
-
In most cases, the
(selected)kernel is likely the last updated file. In this case, it would be the entry accessed onApr 20 18:18.
While bootctl provides detailed information on installed kernels, you can use cat to display the boot loader config file.
-
Enter
sudo cat /efi/loader/loader.confto display the boot loader config.$ sudo cat /efi/loader/loader.conf default af2ba735c1714a3ebdd24c10355d5b20* # kernel id timeout 20 console-mode auto reboot-for-bitlocker 1