Changing kernel guide

Personally, I would find quite necessary a little guide for installing/change kernel. I tried months ago but I switched a lot of time from the arch wiki to other sites to understand how get the packaging of a custom kernel. What gave me problems was the creation of the initramfs, so, I was stucked into this passage because it raised me an error.
As an ignorant, I suggest to get a little wiki on the endeavourOS site.
In my personal case, I need to install a real-time kernel (yes, I already tried to install it from the AUR repo but it takes too much time to compile it) for audio recording experiments, but I noticed that is faster to download a kernel and patching it. The problem is how to make it start for booting.
It could be interesting for everybody, but this is only a personal suggestion/opinion.

1 Like

Which kernel? linux-rt is available in extra?

Well, you can use our very own akm tool.

Using this you can install almost all the kernels in the Arch repo.

To boot from the kernel you can use this. If you’re using systemd-boot. If you’re using GRUB then you have to edit /etc/default/grub.

Use sudo nano /etc/default/grub and change GRUB_DEFAULT=0 to GRUB_DEFAULT="1>2" So if the linux-rt is the first in the sub-menu it’ll make it boot. If you want more clarification on this use this post in StackExchange. Or you can just replace the number in front of GRUB_DEFAULT= and see what works (I can’t remember how to find the correct number).

After editing the GRUB config you need to recreate the actual grub.cfg file to do this you just have to run sudo dracut-rebuild. Now reboot to test.

EDIT: Remembered how to find the kernel ID.

  • To find $menuentry_id_option use:
$ sudo grep submenu /boot/grub/grub.cfg
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-38ea4a12-6cfe-4ed9-a8b5-036295e62ffc' {
  • To find $menuentry_id_option for the ernel you want to use:
menuentry 'EndeavourOS, on linux-lts' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-lts-advanced-f2f94842-8952-4808-9752-1a9608e5af53' {
menuentry 'EndeavourOS, on linux-lts (fallback initramfs)' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-lts-fallback-f2f94842-8952-4808-9752-1a9608e5af53' {
menuentry 'EndeavourOS, on linux' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-f2f94842-8952-4808-9752-1a9608e5af53' {
menuentry 'EndeavourOS, on linux (fallback initramfs)' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-f2f94842-8952-4808-9752-1a9608e5af53' {

Above 4 entries are numbered 0, 1, 2, and 3. So when you are counting you should count it like below.

0 ---- menuentry 'EndeavourOS, on linux-lts' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-lts-advanced-f2f94842-8952-4808-9752-1a9608e5af53' {
1 ---- menuentry 'EndeavourOS, on linux-lts (fallback initramfs)' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-lts-fallback-f2f94842-8952-4808-9752-1a9608e5af53' {
2 ---- menuentry 'EndeavourOS, on linux' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-f2f94842-8952-4808-9752-1a9608e5af53' {
3 ---- menuentry 'EndeavourOS, on linux (fallback initramfs)' --class endeavouros --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-f2f94842-8952-4808-9752-1a9608e5af53' {

From the list, you can just select the one you want to use and then change GRUB_DEFAULT= to the number. If you want to use the normal kernel from the above list then change GRUB_DEFAULT=0 to GRUB_DEFAULT=2. Save the file and then sudo dracut-rebuild.

Then reboot and use uname -a to double-check what kernel you have been booted into.


I already installed akm, but I missed the passages that you had explained because the problem described in the post above (initramfs cannot be created… so, no grub config).
Anyway, I will try again.
Thanks for your post.

You can also use sudo grub-mkconfig -o /boot/grub/grub.cfg to generate the .cfg file. But only if you have GRUB installed.

1 Like

Creating initramfs when using grub:

sudo mkinitcpio -P

About grub menus: you can write grub menu entries into file
/etc/grub/custom.cfg with which you can experiment a bit.

To write that file, you can copy a menuentry from the existing
/boot/grub/grub.cfg and change some obvious details.

And you do not have to run grub-mkconfig to make it work!
Simply reboot and test if your definitions work. If not, boot with a working entry and make the required changes to custom.cfg.

Really wish we had this tool/option during the EndeavourOS install.

You can change these if you used the online installer. If you used the offline one then it’s more of a standard install.

What are the commands to install/ remove specific kernel ? On Akm you can install only latest kernel plus lts

If you mean downgrading, the command is

downgrade <package(s)>

Otherwise normal pacman commands like

sudo pacman -S <kernel> <kernel>-headers   # install
sudo pacman -R <package-name>              # remove