I have to manually run mkinitcpio after every kernel upgrade

When I update linux or linux-lts (and headers) with pacman -Syu, the initramfs.img is deleted, and it’s not generated automatically, making the system unable to boot, unless I manually run mkinitcpio -p linux / linux-lts to solve this problem.

The linux.preset / linux-lts.preset files exists and are correct.
/boot is mounted during update.

pacman -Syuv linux

Root      : /
Conf File : /etc/pacman.conf
DB Path   : /var/lib/pacman/
Cache Dirs: /var/cache/pacman/pkg/  
Hook Dirs : /usr/share/libalpm/hooks/  /etc/pacman.d/hooks/  
Lock File : /var/lib/pacman/db.lck
Log File  : /var/log/pacman.log
GPG Dir   : /etc/pacman.d/gnupg/
Targets   : linux

resolving dependencies...
looking for conflicting packages...

Package (1)  Old Version      New Version      Net Change  Download Size

core/linux   5.14.14.arch1-1  5.14.15.arch1-1   -0,01 MiB     110,33 MiB

Total Download Size:   110,33 MiB
Total Installed Size:  131,25 MiB
Net Upgrade Size:       -0,01 MiB


: Proceed with installation? [Y/n] y
:: Retrieving packages...
 linux-5.14.15.ar...   110,3 MiB   176 KiB/s 10:42 [----------------------] 100%
(1/1) checking keys in keyring                     [----------------------] 100%
(1/1) checking package integrity                   [----------------------] 100%
(1/1) loading package files                        [----------------------] 100%
(1/1) checking for file conflicts                  [----------------------] 100%
:: Running pre-transaction hooks...
(1/2) Removing linux initcpios...
(2/2) Remove DKMS modules
==> depmod 5.14.14-arch1-1
:: Processing package changes...
(1/1) upgrading linux                              [----------------------] 100%
:: Running post-transaction hooks...
(1/6) Arming ConditionNeedsUpdate...
(2/6) Updating module dependencies...
(3/6) Install DKMS modules
(4/6) Updating linux initcpios...
(5/6) Check if user should be informed about rebooting after certain system package upgrades.
(6/6) Checking which packages need to be rebuilt
pacman -Qikk mkinitcpio                                          ✔ 
Name            : mkinitcpio
Version         : 30-2
Description     : Modular initramfs image creation utility
Architecture    : any
URL             : https://github.com/archlinux/mkinitcpio
Licenses        : GPL
Groups          : None
Provides        : initramfs
Depends On      : awk  mkinitcpio-busybox>=1.19.4-2  kmod  util-linux>=2.23
                  libarchive  coreutils  bash  diffutils  findutils  grep
                  filesystem>=2011.10-1  zstd  systemd
Optional Deps   : gzip: Use gzip compression for the initramfs image [installed]
                  xz: Use lzma or xz compression for the initramfs image
                  [installed]
                  bzip2: Use bzip2 compression for the initramfs image
                  [installed]
                  lzop: Use lzo compression for the initramfs image [installed]
                  lz4: Use lz4 compression for the initramfs image [installed]
                  mkinitcpio-nfs-utils: Support for root filesystem on NFS
                  [installed]
Required By     : linux  linux-lts  mkinitcpio-archiso  mkinitcpio-openswap
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 102,77 KiB
Packager        : Christian Hesse <arch@eworm.de>
Build Date      : mié 14 jul 2021 09:28:46
Install Date    : sáb 23 oct 2021 11:10:48
Install Reason  : Explicitly installed
Install Script  : Yes
Validated By    : Signature

backup file: mkinitcpio: /etc/mkinitcpio.conf (Modification time mismatch)
backup file: mkinitcpio: /etc/mkinitcpio.conf (Size mismatch)
backup file: mkinitcpio: /etc/mkinitcpio.conf (MD5 checksum mismatch)
backup file: mkinitcpio: /etc/mkinitcpio.conf (SHA256 checksum mismatch)
mkinitcpio: 81 total files, 0 altered files
grep -ri initcpio /{etc/pacman.d/hooks,/usr/share/libalpm}/      ✔ 
/etc/pacman.d/hooks/90-mkinitcpio-install.hook:Target = usr/lib/initcpio/*
/etc/pacman.d/hooks/90-mkinitcpio-install.hook:Description = Updating linux initcpios...
/etc/pacman.d/hooks/90-mkinitcpio-install.hook:Exec = /usr/share/libalpm/scripts/mkinitcpio-install-calamares
//usr/share/libalpm/hooks/60-mkinitcpio-remove.hook:Target = mkinitcpio
//usr/share/libalpm/hooks/60-mkinitcpio-remove.hook:Target = mkinitcpio-git
//usr/share/libalpm/hooks/60-mkinitcpio-remove.hook:Description = Removing linux initcpios...
//usr/share/libalpm/hooks/60-mkinitcpio-remove.hook:Exec = /usr/share/libalpm/scripts/mkinitcpio-remove
//usr/share/libalpm/hooks/90-mkinitcpio-install.hook:Target = usr/lib/initcpio/*
//usr/share/libalpm/hooks/90-mkinitcpio-install.hook:Description = Updating linux initcpios...
//usr/share/libalpm/hooks/90-mkinitcpio-install.hook:Exec = /usr/share/libalpm/scripts/mkinitcpio-install
//usr/share/libalpm/scripts/mkinitcpio-install-calamares:        # triggers when it's a change to usr/lib/initcpio/*
//usr/share/libalpm/scripts/mkinitcpio-install-calamares:    preset="/etc/mkinitcpio.d/${pkgbase}.preset"
//usr/share/libalpm/scripts/mkinitcpio-install-calamares:            sed "s|%PKGBASE%|${pkgbase}|g" /usr/share/mkinitcpio/hook.preset \
//usr/share/libalpm/scripts/mkinitcpio-install-calamares:if (( all )) && compgen -G /etc/mkinitcpio.d/"*.preset" > /dev/null; then
//usr/share/libalpm/scripts/mkinitcpio-remove:        if ! cmp $preset > /dev/null 2>&1 <(sed "s|%PKGBASE%|${pkgbase}|g" /usr/share/mkinitcpio/hook.preset); then
//usr/share/libalpm/scripts/mkinitcpio-remove:        # triggers when it's a change to usr/lib/initcpio/*
//usr/share/libalpm/scripts/mkinitcpio-remove:    preset="/etc/mkinitcpio.d/${pkgbase}.preset"
//usr/share/libalpm/scripts/mkinitcpio-remove:if (( package )) && compgen -G /etc/mkinitcpio.d/"*.preset" > /dev/null; then
//usr/share/libalpm/scripts/mkinitcpio-remove:    for preset in /etc/mkinitcpio.d/*.preset; do
//usr/share/libalpm/scripts/mkinitcpio-install:        # triggers when it's a change to usr/lib/initcpio/*
//usr/share/libalpm/scripts/mkinitcpio-install:    preset="/etc/mkinitcpio.d/${pkgbase}.preset"
//usr/share/libalpm/scripts/mkinitcpio-install:            sed "s|%PKGBASE%|${pkgbase}|g" /usr/share/mkinitcpio/hook.preset \
//usr/share/libalpm/scripts/mkinitcpio-install:if (( all )) && compgen -G /etc/mkinitcpio.d/"*.preset" > /dev/null; then
//usr/share/libalpm/scripts/mkinitcpio-install:    mkinitcpio "${args[@]}"

Delete /etc/pacman.d/hooks/90-mkinitcpio-install.hook

It looks like somehow an installer file got installed into your system.

2 Likes
pacman -Qo /etc/pacman.d/hooks/90-mkinitcpio-install.hook
/etc/pacman.d/hooks/90-mkinitcpio-install.hook is owned by eos-systemd-boot 0.92-1

2021-11-01_15-34

1 Like

That isn’t the file the OP has above. Their file has this:

Exec = /usr/share/libalpm/scripts/mkinitcpio-install-calamares

That isn’t from eos-systemd-boot :wink:

2 Likes

yea this is an installer file we use in process to not run mkinitcpio all the time…

https://github.com/endeavouros-team/EndeavourOS-calamares/blob/main/calamares/modules/shellprocess_reset_mk_hook.conf
should remove that from target…

3 Likes

Thanks! I renamed those two scripts to *.bak, and upgrading linux kernel now seems to generate kernel images correctly.

So… just to understand, that shellprocess_reset did not execute during my Calamares install, as it should be?

1 Like

yes somehow it does not remove that file… you have the other one too?

/usr/share/libalpm/scripts/mkinitcpio-install-calamares

The most strange thing is that installer should have stopped installation if shellprocess fails…

2 Likes

Yes, I have that other file too.
I installed EOS like a month ago, and this was my only problem… So it is curious that did happen!

2 Likes

you could send your install log a sit is still saved on your system:
cat /var/log/endeavour-install.log | eos-sendlog
Could give a hint on what was going nuts on installation…

2 Likes

Sure!
Here it is: https://clbin.com/f44S0

I’m very curious as well to find out.

i see where it fails…

cleaner scripts failed to cleanup installation:

error: failed to init transaction (unable to lock database)
error: could not lock database: File exists
  if you're sure a package manager is not already
  running, you can remove /var/lib/pacman/db.lck

never saw this happen on any log …

That would mean the previous update didn’t go well. But what previous update?
From where did you download the ISO?

From the official https://endeavouros.com/latest-release/

1 Like