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

12,275

Solution 1

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

Solution 2

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

Solution 3

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
Share:
12,275
Code-Guru
Author by

Code-Guru

I primarily program in C++ and Java. Recently I started learning Haskell. My current mathematical interests are group theory, graph theory, category theory, and type theory. I also enjoy playing chess and Go. My Amazon wishlist

Updated on September 18, 2022

Comments

  • Code-Guru
    Code-Guru almost 2 years

    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?

    • jasonwryan
      jasonwryan over 6 years
      From the chroot, what is the output of uname -r && pacman -Q linux?
    • Code-Guru
      Code-Guru over 6 years
      @jasonwryan 4.12.8-2-ARCH and linux 4.13.3-1
    • jasonwryan
      jasonwryan over 6 years
      So /boot wasn't mounted when you upgraded your kernel. Make sure it is, re-run the kernel upgrade and you should be good.
    • Code-Guru
      Code-Guru over 6 years
      @jasonwryan Thanks. Some digging finally lead me to the same conclusion. I believe I am back in business.
  • Kero
    Kero over 6 years
    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.
  • Jonathan Komar
    Jonathan Komar about 4 years
    And now you‘ll likely need linux-headers too.