BiteDasher / kesboot

Script for automating work with EFI Kernel Stub (linux)
MIT License
30 stars 3 forks source link

Clears CMDLINES array elements on kernel upgrades #3

Open JamiKettunen opened 2 years ago

JamiKettunen commented 2 years ago

Every time I upgrade my kernel packages, e.g. linux, the CMDLINES element for that kernel simply is removed and replaced with 'linux' '' at the end of the array.

Relevant parts of upgrade log where this issue happened:

:: Running pre-transaction hooks...
(1/3) Removing linux booster images...
(2/3) Updating EFI variables (remove)...
===> Removed linux
(3/3) Remove DKMS modules
:: Processing package changes...
...
(13/16) upgrading linux
...
:: Running post-transaction hooks...
(1/8) Reloading device manager configuration...
(2/8) Arming ConditionNeedsUpdate...
(3/8) Updating module dependencies...
(4/8) Install DKMS modules
==> dkms install --no-depmod vendor-reset/r112.7d43285 -k 5.17.6-arch1-1.1
==> depmod 5.17.6-arch1-1.1
(5/8) Updating linux booster images...
(6/8) Updating EFI variables (install)...
---> New kernel: linux
===> Kernel: vmlinuz-linux
     cmdline: rw root=PARTUUID=<xyz> 
     initrd: booster-linux.img
===> Kernel: vmlinuz-linux-mainline
     cmdline: rw root=PARTUUID=<xyz> loglevel=3 quiet systemd.show_status=0 audit=0 usbcore.autosuspend=-1
     initrd: booster-linux-mainline.img
...

My current /etc/kesboot.conf:

# A directory containing kernels and mounted as FAT32
#BOOT_DIR=/boot

# The path to the efibootmgr command
##EFIBOOTMGR_PATH=/usr/bin/efibootmgr

# Additional parameters for the efibootmgr command
##EFIBOOTMGR_EXTRA_FLAGS="-q"

# A hook for the package manager when installing kernels
##INSTALL_HOOK=1

# A hook for the package manager when removing kernels
##REMOVE_HOOK=1

# The script that will be run before kesboot (variable, can accept arguments)
##PRE_SCRIPT=

# The script that will be run after kesboot (variable, can accept arguments)
##POST_SCRIPT=

# default kernel cmdline
#CMDLINE_DEFAULT="rw"

# The prefix and suffix specified by mkinitcpio by default (leave blank so as not to substitute initrd= for cmdline)
INITRD_NAME='booster-@kernel@.img'

# Prefix to the name of the kernel located in $BOOT_DIR (leave blank so as not to substitute $KERNEL_PREFIX for CMDLINES)
#KERNEL_PREFIX=vmlinuz-

# Insert CMDLINE_DEFAULT at the beginning of each CMDLINES variable by default (set 0 to disable it, and use @def@ to insert it)
#USE_DEF=1

# Substitute NAME= from the /etc/os-release file to the headers of the created EFI variables
#EFIVAR_PREFIX=1

# Substitute the path to the root directory of the system in cmdline
#SUB_ROOT=1

# initrd/microcode to be loaded before initrd
MICROCODE=amd-ucode.img

# Add the kernel and its cmdline to the array in pairs
CMDLINES=(
'linux-mainline' 'loglevel=3 quiet systemd.show_status=0 audit=0'
'linux' ''
)
BiteDasher commented 2 years ago

Sorry for such a late response, there were some things to do. So far, I do not know how to solve this problem, since during the Upgrade operation, the pacman launches the Remove hook anyway. The only solution at the moment is to disable the kernel removal hook. REMOVE_HOOK=1

JamiKettunen commented 2 years ago

I found out about CMDLINE_DEFAULT afterwards and since I planned to use same cmdline for both I'm happy enough with using that instead; this still remains an issue though indeed if you want to use different cmdlines