View previous topic :: View next topic |
Author |
Message |
Screenager n00b
Joined: 26 Nov 2023 Posts: 37
|
Posted: Wed Jan 03, 2024 3:07 am Post subject: Guide: LUKS LVM and custom dracut module gentoo-UKI install |
|
|
I documented my default gentoo base install as a handbook extension and added some explanations. The main goal was to have a unified install routine that works great from a business latptop over to a gaming pc and all the way up to a rootserver. The only changes done on a machine to machine basis would be the partitioning scheme and security strategy. So I only really need to change the disk partitioning and the startup script from machine to machine. My guide is using an example where a detached luks header will be placed in another luks container in order to allow safe removal via cryptsetup erase command.
Check it out here: https://wiki.gentoo.org/wiki/User:Screenager/install/encrypted_detached_header_lvm_unified_gentoo_kernel_image_customized_dracut
Also for people who just want to play around with a gentoo-kernel build as a unified kernel image without fancy extras here is the fastest way to set one up:
Skip the 'Configuring the kernel' section in the offical handbook until you reach the 'Configuring the bootloader' section. Instead of following the handbook. First emerge dracut:
Code: | emerge --ask sys-kernel/dracut |
edit /etc/dracut.conf to
Code: | add_dracutmodules+=" resume "
hostonly="yes"
uefi="yes"
kernel_cmdline="resume=UUID=<your-swap-UUID-here>"
i18n_vars="/etc/conf.d/keymaps:KEYMAP /etc/rc.conf:UNICODE"
i18n_install_all="yes" |
then just follow the steps starting from here |
|
Back to top |
|
|
Screenager n00b
Joined: 26 Nov 2023 Posts: 37
|
Posted: Mon Jan 08, 2024 8:31 am Post subject: |
|
|
I wrote a script to automate the kernel update. It moves the old kernel image to /efi/EFI/Boot/bootx64.efi as a backup if something goes wrong.
SCRIPT IS DEPRECATED - CHECK WIKI FOR NEW VERSION
Code: | #!/bin/bash
if [ ! -d /efi/EFI/Boot ]
then
mkdir /efi/EFI/Boot
fi
string=$(efibootmgr | grep "Gentoo")
boot=${string:4:4}
bootnumi=$(expr $(expr index "$boot" [1-9]) - 1)
bootnum=${boot:$bootnumi}
ckernel=$(echo $string | grep -o "gentoo-kernel.\{0,20\}")
ckernel=${ckernel:14}
ckernel=${ckernel%.*}
ckfile=${string##*\\}
ckfile=${ckfile%\)*}
string=$(ls -t /boot | grep "vmlinuz")
stringarray=($string)
nkfile=${stringarray[0]}
nkernel=${nkfile%-*}
nkernel=${nkernel%-*}
nkernel=${nkernel#*-}
if [ "$ckernel" == "$nkernel" ]
then
echo "No new kernel version found. No automatic actions taken $nkfile left in /boot untouched"
else
echo "Installing new kernel image..."
mv /efi/EFI/gentoo/$ckfile /efi/EFI/Boot/bootx64.efi
cp /boot/$nkfile /efi/EFI/gentoo/gentoo-kernel-$nkernel.efi
efibootmgr -b $bootnum -B
efibootmgr -c -d /dev/sda -p 1 -L "Gentoo" -l 'EFI/gentoo/gentoo-kernel-'"$nkernel"'.efi' -u
echo "Kernel Update to $nkernel complete, remember to reboot"
fi
unset nkernel
unset nkfile
unset ckfile
unset stringarray
unset string
unset boot
unset bootnumi
unset bootnum
unset ckernel |
Simply save this as a sh file to /etc/kernel/postinst.d and make it executable with chmod +x |
|
Back to top |
|
|
Screenager n00b
Joined: 26 Nov 2023 Posts: 37
|
Posted: Thu Jan 11, 2024 5:29 am Post subject: |
|
|
I noticed an update to installkernel-gentoo: Refactored the automation script, updated the UKI naming convention to fit to the defaults and included a section for optional plymouth integration. |
|
Back to top |
|
|
|