Mkinitcpio tries to work on uninstalled kernels

If I understand well, mkinitcpio tries to build images for linux kernels that are not installed (have been uninstalled).
These warnings are shown basically every time a kernel update is insalled through pacman

$ sudo mkinitcpio -P
==> Building image from preset: /etc/mkinitcpio.d/linux510.preset: 'default'
  -> -k /boot/vmlinuz-5.10-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.10-x86_64.img
==> Starting build: 5.10.15-1-MANJARO
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [filesystems]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-5.10-x86_64.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux510.preset: 'fallback'
  -> -k /boot/vmlinuz-5.10-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.10-x86_64-fallback.img -S autodetect
==> Starting build: 5.10.15-1-MANJARO
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [filesystems]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-5.10-x86_64-fallback.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux57.preset: 'default'
  -> -k /boot/vmlinuz-5.7-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.7-x86_64.img
==> ERROR: '/lib/modules/5.7.19-2-MANJARO' is not a valid kernel module directory
==> Building image from preset: /etc/mkinitcpio.d/linux57.preset: 'fallback'
  -> -k /boot/vmlinuz-5.7-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.7-x86_64-fallback.img -S autodetect
==> ERROR: '/lib/modules/5.7.19-2-MANJARO' is not a valid kernel module directory
==> Building image from preset: /etc/mkinitcpio.d/linux58.preset: 'default'
  -> -k /boot/vmlinuz-5.8-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.8-x86_64.img
==> ERROR: '/lib/modules/5.8.18-1-MANJARO' is not a valid kernel module directory
==> Building image from preset: /etc/mkinitcpio.d/linux58.preset: 'fallback'
  -> -k /boot/vmlinuz-5.8-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.8-x86_64-fallback.img -S autodetect
==> ERROR: '/lib/modules/5.8.18-1-MANJARO' is not a valid kernel module directory
==> Building image from preset: /etc/mkinitcpio.d/linux59.preset: 'default'
  -> -k /boot/vmlinuz-5.9-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.9-x86_64.img
==> Starting build: 5.9.16-1-MANJARO
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [autodetect]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [filesystems]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-5.9-x86_64.img
==> Image generation successful
==> Building image from preset: /etc/mkinitcpio.d/linux59.preset: 'fallback'
  -> -k /boot/vmlinuz-5.9-x86_64 -c /etc/mkinitcpio.conf -g /boot/initramfs-5.9-x86_64-fallback.img -S autodetect
==> Starting build: 5.9.16-1-MANJARO
  -> Running build hook: [base]
  -> Running build hook: [udev]
  -> Running build hook: [modconf]
  -> Running build hook: [block]
  -> Running build hook: [keyboard]
  -> Running build hook: [keymap]
  -> Running build hook: [filesystems]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-5.9-x86_64-fallback.img
==> Image generation successful

As far as I’m concerned, I only did defaults regarding linux-latest changes and always run default kernel version (5.10 now).

This may be useful

$ mhwd-kernel -li
Currently running: 5.10.15-1-MANJARO (linux510)
The following kernels are installed in your system:
   * linux510
   * linux59
$ ls -l /boot
total 183456
-rw-r--r-- 1 root root    40960  8 févr. 15:52 amd-ucode.img
drwx------ 4 root root     4096  1 janv.  1970 efi
drwxr-xr-x 6 root root     4096 19 févr. 17:09 grub
-rw-r--r-- 1 root root 28343495 19 févr. 17:10 initramfs-5.10-x86_64-fallback.img
-rw-r--r-- 1 root root  7257722 19 févr. 17:10 initramfs-5.10-x86_64.img
-rw-r--r-- 1 root root 31537473 15 sept. 16:04 initramfs-5.7-x86_64-fallback.img
-rw-r--r-- 1 root root  9456783 15 sept. 16:04 initramfs-5.7-x86_64.img
-rw-r--r-- 1 root root 31250422  1 nov.  21:18 initramfs-5.8-x86_64-fallback.img
-rw-r--r-- 1 root root  9701360  1 nov.  21:18 initramfs-5.8-x86_64.img
-rw-r--r-- 1 root root 29145780 19 févr. 17:10 initramfs-5.9-x86_64-fallback.img
-rw-r--r-- 1 root root  7497903 19 févr. 17:10 initramfs-5.9-x86_64.img
-rw-r--r-- 1 root root  3621888 19 nov.  08:58 intel-ucode.img
-rw-r--r-- 1 root root       22 10 févr. 11:42 linux510-x86_64.kver
-rw-r--r-- 1 root root       21 21 déc.  22:59 linux59-x86_64.kver
drwxr-xr-x 2 root root     4096  6 juin   2020 memtest86+
-rw-r--r-- 1 root root  8332704 10 févr. 22:17 vmlinuz-5.10-x86_64
-rw-r--r-- 1 root root  6681472 11 sept. 15:11 vmlinuz-5.7-x86_64
-rw-r--r-- 1 root root  6804736  1 nov.  21:18 vmlinuz-5.8-x86_64
-rw-r--r-- 1 root root  8141120  9 févr. 17:49 vmlinuz-5.9-x86_64

For the questions:

  • is it normal that this happens or did I do something wrong?
  • how do I remove these warnings? Simply removing the files with 5.7/5.8 in /boot or is some command better suited?

Check what you got under /use/lib/modules. If no linux57-58 folders there, then you can remove related files in /boot and /etc/mkinitcpio.d manually. Otherwise, you need to uninstall linux57-58 with pacman.

Ok thanks.

$ ls -l /usr/lib/modules
total 16
drwxr-xr-x 4 root root 4096 10 févr. 22:17 5.10.15-1-MANJARO
drwxr-xr-x 4 root root 4096  9 févr. 17:49 5.9.16-1-MANJARO
drwxr-xr-x 2 root root 4096 10 févr. 22:17 extramodules-5.10-MANJARO
drwxr-xr-x 2 root root 4096  9 févr. 17:48 extramodules-5.9-MANJARO

I guess I can remove manually then.

BTW, do you have an idea about why they were not removed automatically?

Well I can only guess that it’s something to do with some bugs in software you used to remove those kernels. Only guess.
I’ve never had such problems by now. I always install / remove kernels with pacman commands or Octopi and never use mhwd.

Actually it is the same for me, I only ever used pacman (as far as I can remember) to manage kernels.

My original guess is that when linux57 and linux58 were removed from the repos, the uninstallation that ensued was incomplete, but if I’m the only user who had a problem it might be something that I did and forgot about.
The thing is I didn’t play with kernels and kernel versions at all, so I don’t really understand.

Anyways, it is now fixed, thanks again.

check also about /etc/mkinitcpio.d/*.preset
and number kernels installed ( sudo mhwd-kernel -li )
see this

@openminded already told about /etc/mkinitcpio.d and I dealt with these files. BTW these files are not removed by pacman, they are renamed *.preset.pacsave, so I did the same for the ones I wanted gone.

Thanks anyways

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.