6

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?

4
  • From the chroot, what is the output of uname -r && pacman -Q linux?
    – jasonwryan
    Oct 1, 2017 at 1:12
  • @jasonwryan 4.12.8-2-ARCH and linux 4.13.3-1
    – Code-Guru
    Oct 1, 2017 at 3:46
  • So /boot wasn't mounted when you upgraded your kernel. Make sure it is, re-run the kernel upgrade and you should be good.
    – jasonwryan
    Oct 1, 2017 at 4:46
  • @jasonwryan Thanks. Some digging finally lead me to the same conclusion. I believe I am back in business.
    – Code-Guru
    Oct 1, 2017 at 4:52

3 Answers 3

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.)

2
  • I had this problem with Arch Linux 4.14.3-1-ARCH. Your solution worked. I was not able to boot before, then I reinstalled filesystem linux and everything worked. Dec 5, 2017 at 23:29
  • And now you‘ll likely need linux-headers too. May 31, 2020 at 10:00
7

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

0
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.