Systemd-bootloader won't remember latest kernel, part 2

Greetings lovely people,

From my original post here: https://forum.endeavouros.com/t/systemd-bootloader-wont-remember-latest-kernel/79267 I had some issues with booting up into a preferred kernel automatically, which I was able to adjust with the help from the community here.

But now I’m dealing with the exact same problem all over again and I could really use some guidance again. I have both linux and linux-lts kernels installed. It used to work that when I changed my loader.conf I could have the latest/newest kernel selected. Now that seems to not work anymore with the release of kernel 7.0.2. Right now I have one linux-lts kernel and now I have two linux kernels, the new 7.0 and still on my system the old 6.19 EOL kernel. I had thought with my current setup and configs, I could also boot into the latest kernel, but even with 7.0 installed, it still defaults to selecting the 6.19 kernel. I thought old kernels got deleted or cleaned up or something, but now I have 3 kernels and ideally I’m really only going to want to use one.

What can I do so that I can boot into the latest kernel like before?

Here’s what I have for my system:

scott@endeavourOS:~$ sudo nano /efi/loader/loader.conf

default default a718c5c3b60c42aa9332ecb00ebf37f6-*-arch?-?.conf
timeout 5
console-mode auto
reboot-for-bitlocker 1
scott@endeavourOS:~$ sudo ls /efi/loader/entries/
a718c5c3b60c42aa9332ecb00ebf37f6-6.18.25-1-lts.conf
a718c5c3b60c42aa9332ecb00ebf37f6-6.18.25-1-lts-fallback.conf
a718c5c3b60c42aa9332ecb00ebf37f6-6.19.14-arch1-1.conf
a718c5c3b60c42aa9332ecb00ebf37f6-6.19.14-arch1-1-fallback.conf
a718c5c3b60c42aa9332ecb00ebf37f6-7.0.2-arch1-1.conf
a718c5c3b60c42aa9332ecb00ebf37f6-7.0.2-arch1-1-fallback.conf

I just want two kernels installed, not this mess. Ideally I’d like everything automated if I could keep all this hands off so to speak. Appreciate any help as this issue has been a reoccurring problem.

The issue is that you have multiples installed somehow. It should be hands off. That is the whole point.

Did you rollback a snapshot or something?

Nope, never used a snapshot or rollback, this system was freshly installed like a month ago.

I had originally pressed “D” during boot during the kernel selection process when I was using 6.19. and that allowed me to auto select 6.19 on boot. I don’t know if selecting the “D” option for default I think like “protected” the 6.19 kernel or prevented it from being removed, but I am unsure. I cleared the “D” key setting and used the approach you suggested in my last post and that did seem to work.

But now it’s defaulting to the 6.18-lts kernel instead of the 7.0 (or even the 6.19 which is also a higher kernel) kernel which is what I want, and I feel like I have more kernels than need be installed at the current moment. If there’s any additional info needed, feel free to ask.

Honestly, I’m quite confused myself.

Can you share the output of:

find /usr/lib/modules -name vmlinuz
scott@endeavourOS:~$ find /usr/lib/modules -name vmlinuz
/usr/lib/modules/6.18.25-1-lts/vmlinuz
/usr/lib/modules/7.0.2-arch1-1/vmlinuz

So you don’t actually have 3 kernels installed.

It looks like the old kernel didn’t get removed for some reason.

:thinking:

This has happened a few times already this month. I think I’ve had to remove an older kernel and old conf files like 3 separate times already in the last month. Never had to manually do that stuff before. Maybe there’s like a kernel hook that’s not working or missing maybe. I feel like I’m an enigma right now huh :face_exhaling:

The hook that removes those is: /usr/share/libalpm/hooks/90-kernel-remove.hook

scott@endeavourOS:~$ sudo nano /usr/share/libalpm/hooks/90-kernel-remove.hook

  GNU nano 9.0       /usr/share/libalpm/hooks/90-kernel-remove.hook                 
[Trigger]
Type = Path
Operation = Remove
Target = usr/lib/modules/*/vmlinuz

[Action]
Description = Removing kernel...
When = PreTransaction
Exec = /usr/share/libalpm/scripts/kernel-install-hook remove
NeedsTargets

Hope this looks like defaults? I don’t think I’ve ever changed this file.

Can I see the pacman logs from the update where the kernel updated to 7.0.2?

Sure, what can I run for you to get those logs exactly?

Just go to the bottom of /var/log/pacman.log and find the lines from that update. Alternatively, you can use the paclog command.

[2026-04-29T15:39:36-0400] [ALPM] running '10-linux-modules-pre.hook'...
[2026-04-29T15:39:40-0400] [ALPM] running '71-dkms-remove.hook'...
[2026-04-29T15:39:41-0400] [ALPM-SCRIPTLET] ==> dkms remove --no-depmod nvidia/580.142 -k 6.19.14-arch1-1
[2026-04-29T15:39:41-0400] [ALPM-SCRIPTLET] ==> depmod 6.19.14-arch1-1
[2026-04-29T15:39:44-0400] [ALPM] running '90-kernel-remove.hook'...
[2026-04-29T15:39:44-0400] [ALPM-SCRIPTLET] :: kernel-install removing kernel 6.19.14-arch1-1
[2026-04-29T15:39:44-0400] [ALPM] transaction started
[2026-04-29T15:39:45-0400] [ALPM] upgraded firefox (150.0-1 -> 150.0.1-1)
[2026-04-29T15:39:47-0400] [ALPM] upgraded linux (6.19.14.arch1-1 -> 7.0.2.arch1-1)
[2026-04-29T15:39:50-0400] [ALPM] upgraded linux-headers (6.19.14.arch1-1 -> 7.0.2.arch1-1)
[2026-04-29T15:39:50-0400] [ALPM] upgraded wireless-regdb (2026.02.04-1 -> 2026.03.18-1)
[2026-04-29T15:39:50-0400] [ALPM] transaction completed
[2026-04-29T15:39:51-0400] [ALPM] running '10-linux-modules-post.hook'...
[2026-04-29T15:39:51-0400] [ALPM-SCRIPTLET] ++ uname -r
[2026-04-29T15:39:51-0400] [ALPM-SCRIPTLET] + KVER=6.19.14-arch1-1
[2026-04-29T15:39:51-0400] [ALPM-SCRIPTLET] + test -e /usr/lib/modules/backup/6.19.14-arch1-1
[2026-04-29T15:39:51-0400] [ALPM-SCRIPTLET] + rsync -AHXal --ignore-existing /usr/lib/modules/backup/6.19.14-arch1-1 /usr/lib/modules/
[2026-04-29T15:39:54-0400] [ALPM-SCRIPTLET] + rm -rf /usr/lib/modules/backup
[2026-04-29T15:39:55-0400] [ALPM] running '35-systemd-udev-reload.hook'...
[2026-04-29T15:39:56-0400] [ALPM] running '35-systemd-update.hook'...
[2026-04-29T15:39:56-0400] [ALPM] running '60-depmod.hook'...
[2026-04-29T15:39:59-0400] [ALPM] running '70-dkms-install.hook'...
[2026-04-29T15:39:59-0400] [ALPM-SCRIPTLET] ==> dkms install --no-depmod nvidia/580.142 -k 7.0.2-arch1-1
[2026-04-29T15:41:37-0400] [ALPM-SCRIPTLET] ==> depmod 7.0.2-arch1-1
[2026-04-29T15:41:40-0400] [ALPM] running '90-kernel-install.hook'...
[2026-04-29T15:41:40-0400] [ALPM-SCRIPTLET] Running kernel-install for 6.18.25-1-lts
[2026-04-29T15:42:11-0400] [ALPM-SCRIPTLET] Running kernel-install for 7.0.2-arch1-1
[2026-04-29T15:42:41-0400] [ALPM-SCRIPTLET] Running kernel-install for 6.19.14-arch1-1
[2026-04-29T15:43:11-0400] [ALPM] running 'check-pacnew.hook'...
[2026-04-29T15:43:11-0400] [ALPM] running 'gtk-update-icon-cache.hook'...
[2026-04-29T15:43:11-0400] [ALPM] running 'rebuild-detector.hook'...
[2026-04-29T15:43:12-0400] [ALPM] running 'update-desktop-database.hook'...
[2026-04-29T15:45:58-0400] [PACMAN] Running 'pacman -S -y --config /etc/pacman.conf --'
[2026-04-29T15:45:58-0400] [PACMAN] synchronizing package lists

let me know if that’s enough or if I got it right, there’s like 10k lines in that file so far for me lol

Hmm…it looks like it removed it. I wonder if there was an error. Next time the kernel updates, scroll back to this part before closing the terminal and see if there is anything interesting around the part where it says : :: kernel-install removing kernel

Yeah I always check the terminal output during yay updates, but haven’t seen anything noticeable there during kernel updates, but I can double check the next time. It’s just so strange if it is indeed removed, it still shows all 3 kernels during systemds bootloader. I don’t know why my system is being so strange. Even if I uninstalled the lts kernel, I feel like I’d probably still have this issue with kernel updates.

I mean, it definitely didn’t remove them from your EFI partition because they are still there.

so if I don’t have the 6.19 kernel anymore, but I still see 6.19 systemd boot entries when I boot, I guess I just have stale entry files that I assume are not getting autoremoved when they should be is my guess. It’s good to know it’s not a show stopper, but strange that my old kernel boot entries never seem to get deleted. Well the 6.18-lts kernel old boot entries get autoremoved, but for whatever reason the 6.19 and now 7.0 kernel updates, don’t seem to remove either older efi entries for the kernel and the fallback kernel. I guess I can must manually remove them for now and see what happens next update.

Yes, you should manually remove those for now.

Also look in /efi/<machine id>/ and remove any old files there as well.

scott@endeavourOS:~$ sudo ls /efi/a718c5c3b60c42aa9332ecb00ebf37f6/
[sudo] password for scott: 
6.18.25-1-lts  6.19.14-arch1-1	7.0.3-arch1-1

Just got the latest 7.0.3 update, saw I still have 6.19 as shown above so I deleted that, just forgot about it until now.

/var/log/pacman.log: looks normal to me. I did reinstall both kernels in an attempt to “fix” the hooks or something, but it seems to have maybe resolved itself. I haven’t rebooted just yet, but I think when I do it’ll be on the latest.

[2026-04-30T21:53:52-0400] [PACMAN] starting full system upgrade
[2026-04-30T21:55:11-0400] [ALPM] running '10-linux-modules-pre.hook'...
[2026-04-30T21:55:15-0400] [ALPM] running '71-dkms-remove.hook'...
[2026-04-30T21:55:15-0400] [ALPM-SCRIPTLET] ==> dkms remove --no-depmod nvidia/580.142 -k 7.0.2-arch1-1
[2026-04-30T21:55:16-0400] [ALPM-SCRIPTLET] ==> depmod 7.0.2-arch1-1
[2026-04-30T21:55:17-0400] [ALPM] running '90-kernel-remove.hook'...
[2026-04-30T21:55:17-0400] [ALPM-SCRIPTLET] :: kernel-install removing kernel 7.0.2-arch1-1
[2026-04-30T21:55:17-0400] [ALPM] transaction started
[2026-04-30T21:55:17-0400] [ALPM] upgraded libgsf (1.14.57-1 -> 1.14.58-1)
[2026-04-30T21:55:19-0400] [ALPM] upgraded linux (7.0.2.arch1-1 -> 7.0.3.arch1-1)
[2026-04-30T21:55:22-0400] [ALPM] upgraded linux-headers (7.0.2.arch1-1 -> 7.0.3.arch1-1)
[2026-04-30T21:55:22-0400] [ALPM] upgraded mesa (1:26.0.5-1 -> 1:26.0.6-1)
[2026-04-30T21:55:22-0400] [ALPM] upgraded vulkan-mesa-implicit-layers (1:26.0.5-1 -> 1:26.0.6-1)
[2026-04-30T21:55:22-0400] [ALPM] upgraded vulkan-intel (1:26.0.5-1 -> 1:26.0.6-1)
[2026-04-30T21:55:22-0400] [ALPM] upgraded vulkan-nouveau (1:26.0.5-1 -> 1:26.0.6-1)
[2026-04-30T21:55:22-0400] [ALPM] transaction completed
[2026-04-30T21:55:23-0400] [ALPM] running '10-linux-modules-post.hook'...
[2026-04-30T21:55:23-0400] [ALPM-SCRIPTLET] ++ uname -r
[2026-04-30T21:55:23-0400] [ALPM-SCRIPTLET] + KVER=7.0.2-arch1-1
[2026-04-30T21:55:23-0400] [ALPM-SCRIPTLET] + test -e /usr/lib/modules/backup/7.0.2-arch1-1
[2026-04-30T21:55:23-0400] [ALPM-SCRIPTLET] + rsync -AHXal --ignore-existing /usr/lib/modules/backup/7.0.2-arch1-1 /usr/lib/modules/
[2026-04-30T21:55:26-0400] [ALPM-SCRIPTLET] + rm -rf /usr/lib/modules/backup
[2026-04-30T21:55:26-0400] [ALPM] running '35-systemd-update.hook'...
[2026-04-30T21:55:26-0400] [ALPM] running '60-depmod.hook'...
[2026-04-30T21:55:30-0400] [ALPM] running '70-dkms-install.hook'...
[2026-04-30T21:55:30-0400] [ALPM-SCRIPTLET] ==> dkms install --no-depmod nvidia/580.142 -k 7.0.3-arch1-1
[2026-04-30T21:57:11-0400] [ALPM-SCRIPTLET] ==> depmod 7.0.3-arch1-1
[2026-04-30T21:57:14-0400] [ALPM] running '90-kernel-install.hook'...
[2026-04-30T21:57:14-0400] [ALPM-SCRIPTLET] :: kernel-install installing kernel 7.0.3-arch1-1
[2026-04-30T21:57:46-0400] [ALPM] running 'check-pacnew.hook'...
[2026-04-30T21:57:46-0400] [ALPM] running 'rebuild-detector.hook'...

Did the entries for 7.02 get removed?