Proper way to remove kernel

Hello everyone! I am newbie to EndeavourOS and to Linux, and still learning. On fresh install I had installed LTS-kernel too, so now I am with totaly 3 kernels (6 entrys in the grub menu). My question is what are the proper commands to remove the basic kernel or the LTS, and the headers too. I want to keep the Zen-kernel and just 1 more. Thanx in advance.
Here is the output of my pacman -Q | grep linux

archlinux-appstream-data 20221014-1
archlinux-keyring 20220927-1
lib32-util-linux 2.38.1-1
linux 6.0.2.arch1-1
linux-api-headers 5.18.15-1
linux-firmware 20220913.f09bebf-1
linux-firmware-whence 20220913.f09bebf-1
linux-headers 6.0.2.arch1-1
linux-lts 5.15.74-1
linux-lts-headers 5.15.74-1
linux-zen 6.0.2.zen1-1
linux-zen-headers 6.0.2.zen1-1
playonlinux 4.4+29+gd0ae9ce6-1
util-linux 2.38.1-1
util-linux-libs 2.38.1-1

For example for linux (mainline kernel):

sudo pacman -R linux linux-headers

Have look here for availabel kernels in Arch (official and unofficial repos):

For how to use pacman:

sudo pacman -Rc linux linux-headers
sudo pacman -Rc linux-lts linux-lts-headers

By using -Rc, you ensure that any modules which depend on the kernel don’t stop the removal of the kernel.


Wow, thanx dalto for the quick responce! What is your advice: should I keep the basic one or the LTS? Along with the Zen ofcours

I would keep LTS. The mainline kernel and the zen kernel will usually be fairly similar to each other. There is a fair chance they could both be broken for you at the same time.

After running sudo pacman -Rc linux linux-headers, some 300+ MBs where removed, I have rebooted, but still have 3 kernels and the output pacman -Q | grep linux is same. What I did wrong?

You mean that you see the kernels in the grub menu?

You need to rebuild it:

sudo grub-mkconfig -o /boot/grub/grub.cfg


Can we see the end of /var/log/pacman.log where that removal occurred?

My mistake, after my pacman -Q | grep linux it was looking exactly same, but after closer look I see that one linux 6.0.2.arch1-1 is missing now :). And after rebuiling the grub - voila! Thanx

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.