You are not logged in.

#1 2020-03-07 02:30:43

praetorxyn
Member
Registered: 2014-05-20
Posts: 7

Proper way to relocate kernel / initramfs without breaking upgrades

Hello all, this seems to be a relatively minor issue I'm having.

I use rEFInd as my boot manager, and I want it to use the appropriate Arch icon for my kernel. Since the kernel doesn't have Arch in its name, the easiest way to do that (without having to put Arch in the FS labels or something, which I don't like doing) is to have the kernel in a subdirectory called arch underneath where rEFInd scans for kernels, for example ESP:\EFI\arch

Since I am using LUKS, I've mounted the ESP at /boot, so I need the kernel / initramfs to be in /boot/EFI/arch. I am also using the linux-zen kernel if that makes a difference.

When I installed Arch, I edited /etc/mkinitcpio.d/linux-zen.preset and changed the paths from /boot/* to /boot/EFI/arch/*, then manually moved the kernel there before running mkinitcpio and everything seemed to work fine.
Then tonight when I tried to upgrade, I ran into an issue  where it was trying to use old kernel modules. I eventually figured out that the new kernel was in /boot and it was trying to use the old kernel at /boot/EFI/arch before automatically running mkinitcpio.
To make the upgrade work, I changed /etc/mkinitcpio.d/linux-zen.preset back to look for everything in /boot and then the upgrade worked fine. After this, I manually moved the files  over to /boot/EFI/arch and after reboot everything works as expected.

But I don't want to have to manually move the kernels every time, so what is the correct way to do this?
If pacman -S linux-zen didn't run mkinitcpio by itself I would setup a pacman hook to move the files for me I suppose. With the automatic mkinitcpio in there I am not sure how to do a hook for this, can anyone advise?

Sorry if this is a n00bish or repeated question, but I couldn't find anything similar on searching.

Offline

#2 2020-03-08 06:48:51

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Proper way to relocate kernel / initramfs without breaking upgrades

You could make a manual boot stanza. Also, refind supports reading your kernel from ext4 partitions and so on, but it doesn't support reading from a LUKS-encrypted partition... however, grub does, and it can be manually configured pretty easily: https://wiki.archlinux.org/index.php/Us … figuration

(Keeping the kernel in its original location will simplify the boot process, and also, making the kernel be LUKS-encrypted as well is probably a good thing.)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB