7

I am attempting to repair and upgrade an Arch Linux system. I boot off of a Live USB which is a newer version than the original install. Then I mount the sda and chroot to its mount point. When I run mkinitcpio -p linux, I get the error from the title:

'/lib/modules/4.9.8-1-ARCH' is not a valid kernel module directory

lib/modules/ has 4.13.3-1-ARCH. How do I tell mkinitcpio to use this directory instead?

Code-Guru
  • 699
  • 3
  • 6
  • 19

3 Answers3

10

The problem is that I forgot to mount my boot partition to /boot when I upgraded my entire system, including the Linux kernel. After dealing with some issues with pacman and PGP keys, I finally ran pacman -S filesystem linux and I am able to boot off of my HDD. (I'm not sure if filesystem was required to fix this problem, but it was referenced in other sources.)

Code-Guru
  • 699
  • 3
  • 6
  • 19
7

Just fyi, I had a similar issue and fixed it with just pacman -S linux. I don't think filesystem was needed.

GAD3R
  • 63,407
  • 31
  • 131
  • 192
2

I had the same issue and reinstalling with pacman -S linux did not help. In fact the error appeared when updating linux-aarch64 in the first place because that triggers the post-transaction hook for mkinitcpio!

The problem in my case was that /etc/mkinitcpio.d/linux-aarch64.preset was not replaced by the update but a .pacnew file was installed. So the preset still pointed to the old modules directory. Moving the new preset in place fixed it:

# mv /etc/mkinitcpio.d/linux-aarch64.preset{.pacnew,}
# pacman -S linux-aarch64