I modified the vanilla manjaro installation to use shim + systemd-boot in order to get secure boot working to comply with my comanies PC policies. In order to do that I used Unified Kernel Images as per arch wiki.
I know that mkinitcpio comes with a pacman script to generate .preset files (/etc/mkinitcpio.d/<kernel base>.preset) which is placed under /usr/share/libalpm/scripts/mkinitcpio and called by the according pacman hook after updates to certain usr/lib directories and of course /usr/lib/modules/*/vmlinuz. Since I want to have a fully automated setup when I install a newer kernel I edited /usr/share/mkinitcpio/hook.preset (which is used by the mkinitcpio script to generate the actual presets). But this file is changed by pacman during updates to mkinitcpio.
Now my question is: Is there an easy way to automate the process of installing new kernel images while using UKIs? I know there is this special /etc/mkinitcpio.d/linux.preset which won’ be overwritten during updates to the mkinitcpio.d package but this will only allow me to have a single kernel present since there are no placeholders for the kernel version.
I speculated - as I use an encrypted root and verifying boot by enrolling the certificate in TPM using secureboot - do I really want to maintain more than one kernel?
I came to the conclusion - I do not want that.
Yes - that is how it works.
If you want to override use /etc/mkinicpio.d.
I use a somewhat similar setup - by using sbctl to generate a signed efistub with a generic name which I symlink to the kernel I am using - usually LTS.
This prevents mkinitcpio updates from overwriting or resetting your custom hook.present.
However, this is not recommended, as major mkinitcpio changes could break compatibility with your permanent custom config without you realizing where a issue is.
However, this is not recommended, as major mkinitcpio changes could break compatibility with your permanent custom config without you realizing where a issue is.
I use a somewhat similar setup - by using sbctl to generate a signed efistub with a generic name which I symlink to the kernel I am using - usually LTS.
How do u symlink the kernel? Any scripts u can share? With the linux-xxx packages the kernel that’s installed will have a suffix (e.g. vmlinuz-6.12) for the version which won’t work with a .preset that references a generic name (vmlinuz)
I don’t use grub - I don’t use systemd-boot - instead I have a unified kernel named main.efi
$ ls -l /efi
total 142492
drwxr-xr-x 3 root root 4096 Jan 23 10:04 EFI
drwxr-xr-x 2 root root 4096 Feb 20 12:46 loader
-rwxr-xr-x 1 root root 145903224 Feb 20 08:14 main.efi
main.efi is generated by sbctl - by unifying the files vmlinuz-linuxand initramfs-linux.img and this is where the symlink comes in.
Only when I need to switch kernel - like from 6.6LTS to 6.12LTS - I change the symlink reference.
$ ls -l /boot
total 271492
-rw-r--r-- 1 root root 153600 Feb 12 01:25 amd-ucode.img
-rw------- 1 root root 132018654 Feb 20 08:14 initramfs-6.12-x86_64-fallback.img
-rw------- 1 root root 132018654 Feb 20 08:14 initramfs-6.12-x86_64.img
lrwxrwxrwx 1 root root 25 Feb 2 08:44 initramfs-linux.img -> initramfs-6.12-x86_64.img
-rw-r--r-- 1 root root 22 Feb 18 21:10 linux612-x86_64.kver
-rw-r--r-- 1 root root 13793912 Feb 20 08:14 vmlinuz-6.12-x86_64
lrwxrwxrwx 1 root root 19 Feb 2 08:44 vmlinuz-linux -> vmlinuz-6.12-x86_64
There is no magick or scripting involved - my scripting dates back to earlier sbctl so I could utilize the sbctl configuration to achieve the same thing (/var/lib/sbctl) - that is what I meant above - the improving by looking closer into - that I have not got around to do.
All right thanks so far @linux-aarhus The part about the symlinking is the one that I want to automate since I know I’ll forget about that when switching to a new kernel :'D
I’ll move this problem to future me since I don’t have time for that now. I’ll update the post when I find a solution.
Yes I saw that (I think I even stumbled upon that in my initial research) in your former post but unfortunately I’m on a Lenovo Thinkpad T14, which, last time I checked the lenovo support forums, might break if one uses custom secure boot keys