How to properly get rid of previous version of linux kernels?

Hi
It seems like when there is some major update in linux kernel pacman doesn’t auto-deletes the previous version of the kernel. So 2 linux-kernels shows up in the grub menu? Last time I just removed the extra kernel from the grub menu by grubcustomizer.

How to get rid of the other kernels?

On Arch, and Arch based distros (like EndeavourOS) old kernels are not stored. They are replaced with new kernel whenever you update.

You had two “versions” of kernel? That are probably the main Linux kernel and a fallback initramfs option. They are the same kernel, but images have been generated with different parameters (I might not be phrasing it perfectly correct).

Nothing to do :upside_down_face:

2 Likes

There’s only one kernel is kept as @flyingcakes said. Unless the user has installed another kernel (ex: LTS Kernel, ZEN Kernel … etc). The two entries are the main kernel and its fallback iniframs which can be used to recover the system in case the main kernel fails.

So, if you have installed 2 kernels then you will see 4 entries in GRUB. If you have 1 kernel it\ll show 2 entries. It’s best not to meddle with GRUB and kernel if they’re not broken.

We don’t recommend using GRUB customizer. It breaks things more than it fixes stuff. You can do everything this does by using a text editor it’s not that hard.

2 Likes

Thanks for the reply
photo_2022-01-20_10-42-17
So this is the what I get in the grub menu. So I assumed arch didn’t auto-uninstall last version of the kernel when there is a major update. But it seems that both the linux options boot-into the same version of linux kernel.

So I removed them from grub-customizer.
image

We don’t recommend using GRUB customizer. It breaks things more than it fixes stuff. You can do everything this does by using a text editor it’s not that hard.

Hmm I have been using grub-customizer as a front-end for the grub config. If it’s not recommended could you recommend other similar project that provide a gui for grub customizations?

I find using GUI rather than editing config files directly much easier.
Also I just do basic customisation like editing the boot order or removing some boot options.

image
So from this image (grub-customizer) it seems like other kernels are just backup of main ones

You have 2 kernels. Frist 2 is the normal kernel and its fallback. The second is the LTS kernel and its fallback.

You might have installed the LTS kernel at some point in time that’s why there are 4 entries. And that’s not old it’s just the LTS current version. If you don’t want it then just uninstall it.

sudo pacman -R kernel-name kernel-name-headers

We don’t recommend any GUI to edit the GRUB and its options because editing .cfg file directly with a text editor is much safer.

It’s all in the perspective. Both are in line when it comes to easiness. But when it comes to controlling and being safe using the config file route is much better because we know what we did if something goes wrong. GUI’s you might click an option and then apply but you don’t if it has changed something else which might break the system.

It’s your system you can use whatever you want. I was just informing you about GUI-based GRUB editors.

2 Likes

Check this folder to see how many versions are there:
/usr/lib/modules/

There are only two versions which I want, one of lts and one normal. Idk why then the grub menu shows 8 entries sometimes after kernel updates. But I just removed the other ones from grub config.

You have 2 kernels. Frist 2 is the normal kernel and its fallback. The second is the LTS kernel and its fallback.

I expect the lts and the linux-kernel so there should only be 4 grub menu boot options(lts, lts-fallback, linux, linux-fallback), but it was showing rather 8 options which lead me to think that pacman doesn’t removes the last kernel after major kernel update.
image

Thanks for clarifying

Did you try this:

2 Likes

That’s messed up. I think it’s repeating the same entry twice (4x2=8). According to your earlier screenshot, you seem to have only 2 installed.

I think it’s best you check the folder @manuel suggested and he would be the best person to get help to clean up the GRUB.

manuel never entered the chat.
Its @EOS

:upside_down_face:

2 Likes

:man_facepalming: both have penguins and it too early for me :stuck_out_tongue:

5 Likes

Why would you want to customize the grub configuration with a GUI? I dont understand your use case.

grub.cfg is created automatically during kernel install/update/remove activities. The system automatically checks for installed kernels and creates the appropriate grub.cfg.

If the automatism fails, e.g. because you have messed with custom kernels, grub.cfg can be created manually via

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

And all you want to customize regarding special kernel parameters or grub menu behaviour or look&feel has to be done by editing /etc/default/grub anyways.

5 Likes

Thanks I would try that

There seems to be a couple of similar cases recently where Grub creates duplicate boot menu entries:

:thinking:

3 Likes

Given you want a GUI for low-level configuration, a terminal centric distro like EndeavourOS seems like an odd choice.

no one asks for the file that would give all the info needed … the grub.cfg file :wink:

cat /boot/grub/grub.cfg | eos-sendlog

2 Likes

We left it for you Mr. Der Doktor.

1 Like