Older lts kernels are reinstalled along with the newer lts kernel

I just updated my EndeavourOS system which included upgrades for the lts and non-lts kernels. During the upgrade I noticed the system was reinstalling older lts kernels in addition to the newer one. It did not do this with the non-lts kernel, it just installed the new one and removed the old one. When the upgrade was complete I rebooted and selected the newer lts kernel to open the system, but I still have the older lts kernels on my system. This happens every time I upgrade and there is a kernel modification involved. I end up having to manually remove them. Can anyone tell me how to get EndeavourOS to clear the old kernels automatically? Many thanks!

I’m running EndeavourOS with systemd-boot, Dracut, Wayland, and Gnome desktop.

System kernels BEFORE upgrade:

  • 6.18.53-1-lts;
  • 7.2.6-arch2-1;

AFTER UPGRADE (2026-09-28):
❯ uname -r
6.18.54-1-lts

❯ pacman -Q linux linux-lts
linux 7.2.7.arch1-1
linux-lts 6.18.54-1

❯ sudo ls -laH /efi/loader/entries/
total 40
drwxr-x— 2 root root 4096 Sep 28 08:22 .
drwxr-x— 4 root root 4096 Sep 28 08:23 ..
-rw-r----- 1 root root 611 Sep 28 08:21 <my machine i>-6.18.52-1-lts.conf
-rw-r----- 1 root root 642 Sep 28 08:21 <my machine i>-6.18.52-1-lts-fallback.conf
-rw-r----- 1 root root 611 Sep 28 08:21 <my machine i>-6.18.53-1-lts.conf
-rw-r----- 1 root root 642 Sep 28 08:21 <my machine i>-6.18.53-1-lts-fallback.conf
-rw-r----- 1 root root 611 Sep 28 08:21 <my machine i>-6.18.54-1-lts.conf
-rw-r----- 1 root root 642 Sep 28 08:21 <my machine i>-6.18.54-1-lts-fallback.conf
-rw-r----- 1 root root 611 Sep 28 08:22 <my machine i>-7.2.7-arch1-1.conf
-rw-r----- 1 root root 642 Sep 28 08:22 <my machine i>-7.2.7-arch1-1-fallback.conf

If you’re not booted into the 7.2.7 kernel, reboot and select the current kernel.
Then open a terminal and run sudo dracut-rebuild

That should clean up the older LTS kernels.

Thanks for your help MrSmartepants! Unfortunately sudo dracut-rebuild` didn't work, the old kernels are still there. Any idea as to why this keeps happening?

I have no idea why you’ve got leftovers. The system is usually very good at pruning the old kernel files. Best way is to remove the LTS kernel entirely, then reinstall (if you want it).

You can remove the LTS kernel entirely with AKM or via the terminal. sudo pacman -Rs linux-lts

Alternatively, If there are only the folders for the current kernel versions (stable & LTS), then it’s probably safe to delete the defunct boot entries.

*Edit, double check after uninstalling LTS for leftovers in /boot/* and /usr/lib/modules/* directories.

Before I remove anything completely, do the directories you mentioned look correct to you? There are still directories for older kernels in `/usr/lib/modules/*` that weren't listed above.

❯ sudo ls -laH /boot/*
-rw-r–r-- 1 root root 15265792 Sep 25 18:53 /boot/intel-ucode.img

/boot/efi:
total 8
drwxr-xr-x 2 root root 4096 Sep 23 13:49 .
drwxr-xr-x 3 root root 4096 Sep 28 08:20 ..

❯ sudo ls -laH /usr/lib/modules/* (I’m just listing the directory names only here)
/usr/lib/modules/6.18.49-3-lts:
total 84
…

/usr/lib/modules/6.18.50-2-lts:
total 84
…

/usr/lib/modules/6.18.51-1-lts:
total 84
…

/usr/lib/modules/6.18.52-1-lts:
total 23704
…

/usr/lib/modules/6.18.53-1-lts:
total 23744
…

/usr/lib/modules/6.18.54-1-lts:
total 23744
…

/usr/lib/modules/7.2.7-arch1-1:
total 24692
…

Before you remove things, we should troubleshoot a bit here.

There is a likely a reason your old conf files are hanging around

If you’ve already uninstalled the LTS kernels with AKM or Pacman, then yeah it’s safe to delete all those LTS folders from /usr/lib/modules/* (leave the /boot/ or /efi/ alone unless you KNOW what you’re doing)

Using AKM/Pacman will clean up the boot entries as well, so you’re just deleting old files. To be absolutely sure they’re not somehow dependencies/owned by an app, you could run sudo pacman -Qo /lib/modules/ because (I think) sometimes virtual machines store their kernels in there.

Saying that, you should wait for a more experienced member to chime in though. I’ve been using EnOS for less than two years. :wink:

Can you share the output of pacman -Q | grep -E "linux|kernel|dracut"

❯ pacman -Q | grep -E “linux|kernel|dracut”
archlinux-appstream-data 20260910-1
archlinux-keyring 20260909-1
dracut 112_eos-1
kernel-install-for-dracut 1.14.2-1
kernel-modules-hook 0.1.7-3
linux 7.2.7.arch1-1
linux-api-headers 7.2-1
linux-firmware 20260916-1
linux-firmware-amd 20260916-1
linux-firmware-amdgpu 20260916-1
linux-firmware-atheros 20260916-1
linux-firmware-broadcom 20260916-1
linux-firmware-cirrus 20260916-1
linux-firmware-intel 20260916-1
linux-firmware-mediatek 20260916-1
linux-firmware-nvidia 20260916-1
linux-firmware-other 20260916-1
linux-firmware-radeon 20260916-1
linux-firmware-realtek 20260916-1
linux-firmware-ti 20260916-1
linux-firmware-whence 20260916-1
linux-headers 7.2.7.arch1-1
linux-lts 6.18.54-1
linux-lts-headers 6.18.54-1
python-proton-keyring-linux 0.2.3-1
util-linux 2.42.4-1
util-linux-libs 2.42.4-1

This is the problem.

This packages makes copies of the old kernel files. So when kernel-install looks for kernels, it finds all the old files.

Great that you’ve identified the problem! Any suggestions as to how best to correct it? Many thanks to you both!

You need to uninstall that package and then clean everything up.

Check /efi/<machine id>, /efi/loader/entries and /usr/lib/modules

Then it should stop happening in the future.

I’ve deleted the problem package with sudo pacman -Rn kernel-modules-hook, and removed older lts-kernels with:

❯ sudo rm /efi/loader/entries/<my machine i>-6.18.52-1-lts.conf
❯ sudo rm /efi/loader/entries/<my machine i>-6.18.52-1-lts-fallback.conf
❯ sudo rm /efi/loader/entries/<my machine i>-6.18.53-1-lts.conf
❯ sudo rm /efi/loader/entries/<my machine i>-6.18.53-1-lts-fallback.conf

Output of the following ‘check’ files:

❯ sudo ls /efi/loader/entries/ | sort GOOD!
<my machine i>-6.18.54-1-lts.conf
<my machine i>-6.18.54-1-lts-fallback.conf
<my machine i>-7.2.7-arch1-1.conf
<my machine i>-7.2.7-arch1-1-fallback.conf

Still showing old kernel directories
❯ sudo ls /usr/lib/modules/ | sort
6.18.49-3-lts
6.18.50-2-lts
6.18.51-1-lts
6.18.52-1-lts
6.18.53-1-lts
6.18.54-1-lts
7.2.7-arch1-1

Still showing old kernel directories
❯ sudo ls /efi/<my machine i> | sort
6.18.49-3-lts
6.18.50-2-lts
6.18.52-1-lts
6.18.53-1-lts
6.18.54-1-lts
7.2.4-arch1-2
7.2.7-arch1-1

What’s the best way to safely clean up the old kernel directories still showing in `/efi/<my machine i>` and `/usr/lib/modules` ? NOTE - there are no vmlinuz files in these older kernel directories, but there are various modules.xxx files.

I would just delete them all with rm -r or a file manager if your file manager support admin:// or similar.

Just be careful not to delete your in use kernels.

Okay. Thanks again to both of you! I’ll post again after the next kernel update to let you know that everything’s working.

Just updated my system which included updates to the linux-lts 6.18.54-2 and linux 7.2.8.arch1-2 kernels. Both installed fine and there were no redundant kernels remaining, so the solution provided worked great!

please mark @dalto’s thread as the solution for others who may have this issue