You are not logged in.

#1 2020-10-03 19:22:04

Frousties
Member
Registered: 2020-10-03
Posts: 7

[Solved] Linux kernel version mismatch

Hello,

I recently migrated my Arch install to a new SSD, and I noticed that my kernel version did not match Arch's

# uname -r
5.8.12-arch1-1
# pacman -Q linux 
linux 5.8.13.arch1-1

As you can see the versions are different and it causes problems with mkinitcpio since it can't find "/lib/module/5.8.13.arch1-1"

I managed to downgrade my kernel using pacman but I'm still very curious as to what could have caused this problem (and it also prevents me from installing nvidia-dkms and using wine so there's that)

Last edited by Frousties (2020-10-03 22:30:53)

Offline

#2 2020-10-03 19:28:59

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [Solved] Linux kernel version mismatch

I believe this can be caused if /boot isn't mounted at the time of package update.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2020-10-03 19:35:27

Frousties
Member
Registered: 2020-10-03
Posts: 7

Re: [Solved] Linux kernel version mismatch

Well, /boot (if we're talking of the same /boot) definitely is mounted so I don't think this issue comes from there

Offline

#4 2020-10-03 19:41:40

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [Solved] Linux kernel version mismatch

If you have 5.8.13 installed and /boot mounted try regenerating the kernel image and reboot (mkinitcpio -p linux).  After that is finished, unmount /boot and then see if there are files on the root filesystem under /boot (ie you didn't have it mounted at some point).  There should be nothing there.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2020-10-03 19:47:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,452
Website

Re: [Solved] Linux kernel version mismatch

That mismatch would be expected if you hadn't rebooted since you upgraded.

Frousties wrote:

... it causes problems with mkinitcpio since it can't find "/lib/module/5.8.13.arch1-1"

Post the actual command and output.  That summary is likely wrong in two ways, but it's hard to be sure.  First, there is no directory /lib/module/, but there is /lib/modules/, and if the error was that /lib/modules/5.8.12.arch1-1 was missing that would be expected and would make sense as that's what the process should be looking for.  If instead it was actually missing the 5.18.13 modules, then you have bigger problems as pacman is reporting that package is installed while it isn't properly installed.

Graysky's suspicion about the boot partition not being mounted may be relevant, but only after we rule out the much simpler and much more likely cause of simply not having rebooted into the new kernel.

Last edited by Trilby (2020-10-03 19:53:48)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2020-10-03 19:50:14

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
Website

Re: [Solved] Linux kernel version mismatch

True ... (trilby's hypothesis about the reboot).  I assumed the OP would have rebooted after.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#7 2020-10-03 20:06:48

Frousties
Member
Registered: 2020-10-03
Posts: 7

Re: [Solved] Linux kernel version mismatch

graysky wrote:

If you have 5.8.13 installed and /boot mounted try regenerating the kernel image and reboot (mkinitcpio -p linux).  After that is finished, unmount /boot and then see if there are files on the root filesystem under /boot (ie you didn't have it mounted at some point).  There should be nothing there.

Been doing that ad nauseum, "mkinitcpio -p linux" keeps failing

==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> ERROR: '/lib/modules/5.8.13-arch1-1' is not a valid kernel module directory
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> ERROR: '/lib/modules/5.8.13-arch1-1' is not a valid kernel module directory

Also if I reboot after installing "linux-5.8.13.arch1-1" (which automatically does "mkinitcpio -p linux"), since it fails to create a functioning "/boot/initramfs-linux.img", I can't boot anymore and I'm getting tired of using the live boot key to fix that.

Trilby wrote:

there is no directory /lib/module/, but there is /lib/modules/

Yeah that was a typo, it is indeed '/lib/modules/5.8.13-arch1-1' that is missing

Here's the detailed ouput of the error that happens when I try to install "linux-5.8.13.arch1-1"

(2/4) Updating module dependencies...
depmod: ERROR: could not open directory /lib/modules/5.8.13-arch1-1: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
error: command failed to execute correctly
(3/4) Install DKMS modules
==> dkms install --no-depmod -m v4l2loopback -v 0.12.5 -k 5.8.13-arch1-1
==> dkms install --no-depmod -m nvidia -v 455.23.04 -k 5.8.13-arch1-1
Error! Bad return status for module build on kernel: 5.8.13-arch1-1 (x86_64)
Consult /var/lib/dkms/nvidia/455.23.04/build/make.log for more information.
==> Warning, `dkms install --no-depmod -m nvidia -v 455.23.04 -k 5.8.13-arch1-1' returned 10
==> depmod 5.8.13-arch1-1
depmod: ERROR: could not open directory /lib/modules/5.8.13-arch1-1: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
==> Warning, `depmod 5.8.13-arch1-1' returned 1
(4/4) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> ERROR: '/lib/modules/5.8.13-arch1-1' is not a valid kernel module directory
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'fallback'
  -> -k /boot/vmlinuz-linux -c /etc/mkinitcpio.conf -g /boot/initramfs-linux-fallback.img -S autodetect
==> ERROR: '/lib/modules/5.8.13-arch1-1' is not a valid kernel module directory
error: command failed to execute correctly

Last edited by Frousties (2020-10-03 20:12:08)

Offline

#8 2020-10-03 20:19:08

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,452
Website

Re: [Solved] Linux kernel version mismatch

Your kernel package is broken / corrupted somehow.  Please post the output of each of the following:

pacman -Qkk linux mkinitcpio
stat /lib/modules/5.8.13-arch1-1
ls /lib/modules/5.8.13-arch1-1/
md5sum /var/cache/pacman/pkg/linux-5.8.13.arch1-1-x86_64.pkg.tar.zst

FYI, mkinitcpio isn't failing because the versions don't match - rather the versions don't match because mkinitcpio is failing.  Because it fails, the new kernel is not copied to /boot/ and so when you reboot the old kernel that is still there is booted which in turn provides the response to `uname`.  The failure of mkinitcpio is the problem, not a symptom.  And some oddity with the /lib/modules/5.8.13--arch1-1 seems to be the cause of the failure.

Last edited by Trilby (2020-10-03 20:24:19)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#9 2020-10-03 21:13:54

Frousties
Member
Registered: 2020-10-03
Posts: 7

Re: [Solved] Linux kernel version mismatch

Trilby wrote:

Your kernel package is broken / corrupted somehow.  Please post the output of each of the following:

pacman -Qkk linux mkinitcpio
stat /lib/modules/5.8.13-arch1-1
ls /lib/modules/5.8.13-arch1-1/
md5sum /var/cache/pacman/pkg/linux-5.8.13.arch1-1-x86_64.pkg.tar.zst
# pacman -Qkk linux mkinitcpio
linux: 7021 total files, 0 altered files
backup file: mkinitcpio: /etc/mkinitcpio.conf (Modification time mismatch)
backup file: mkinitcpio: /etc/mkinitcpio.conf (Size mismatch)
mkinitcpio: 81 total files, 0 altered files
# stat /lib/modules/5.8.13-arch1-1
stat: cannot statx '/lib/modules/5.8.13-arch1-1': No such file or directory
# ls /lib/modules/5.8.13-arch1-1/
ls: cannot access '/lib/modules/5.8.13-arch1-1/': No such file or directory
# md5sum /var/cache/pacman/pkg/linux-5.8.13.arch1-1-x86_64.pkg.tar.zst
2460a9cd81dd10b589fb89841aae8dc1  /var/cache/pacman/pkg/linux-5.8.13.arch1-1-x86_64.pkg.tar.zst

Offline

#10 2020-10-03 21:18:02

loqs
Member
Registered: 2014-03-06
Posts: 17,198

Re: [Solved] Linux kernel version mismatch

What is the output of `stat /lib`

Offline

#11 2020-10-03 21:27:31

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,452
Website

Re: [Solved] Linux kernel version mismatch

Odd: pacman doesn't report any missing files from the linux package, yet a directory belonging to the package is clearly missing, and the package you installed has the correct checksum.  In addition to  above-requested `stat /lib`, please include `ls /lib/modules/`.  I'd also be curious to see the output of `pacman -Ql linux`.  It should be quite long, and there's no need to post it all, but check it and see if /usr/lib/modules/5.8.13-arch1-1/* files are listed.

Last edited by Trilby (2020-10-03 21:28:15)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#12 2020-10-03 21:32:05

Frousties
Member
Registered: 2020-10-03
Posts: 7

Re: [Solved] Linux kernel version mismatch

loqs wrote:

What is the output of `stat /lib`

# stat /lib
  File: /lib
  Size: 176128    	Blocks: 352        IO Block: 4096   directory
Device: 803h/2051d	Inode: 25034753    Links: 211
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2020-10-03 20:39:09.651799345 +0200
Modify: 2020-10-01 22:37:40.955479400 +0200
Change: 2020-10-01 22:37:40.955479400 +0200
 Birth: 2020-10-01 22:45:20.289857584 +0200
Trilby wrote:

Odd: pacman doesn't report any missing files from the linux package, yet a directory belonging to the package is clearly missing, and the package you installed has the correct checksum.  In addition to  above-requested `stat /lib`, please include `ls /lib/modules/`.  I'd also be curious to see the output of `pacman -Ql linux`.  It should be quite long, and there's no need to post it all, but check it and see if /usr/lib/modules/5.8.13-arch1-1/* files are listed.

I checked and /usr/lib/modules/5.8.13-arch1-1/* files are indeed listed.

Offline

#13 2020-10-03 21:37:11

loqs
Member
Registered: 2014-03-06
Posts: 17,198

Re: [Solved] Linux kernel version mismatch

/lib should be a link to usr/lib
Something overwrote that link creating an actual /lib directory.  Have you executed a script or make install e.t.c. with sudo or as root?

Last edited by loqs (2020-10-03 21:37:37)

Offline

#14 2020-10-03 21:41:22

Frousties
Member
Registered: 2020-10-03
Posts: 7

Re: [Solved] Linux kernel version mismatch

loqs wrote:

/lib should be a link to usr/lib
Something overwrote that link creating an actual /lib directory.  Have you executed a script or make install e.t.c. with sudo or as root?

Ah! That would make a lot of sense since I just recently migrated my Arch install to a new drive, I might've messed up that link and the problem only showed when I was tinkering with nvidia stuff.
How should I remake that link? Erasing /lib? If yes, do I create a hard or soft link?

Offline

#15 2020-10-03 21:45:12

loqs
Member
Registered: 2014-03-06
Posts: 17,198

Re: [Solved] Linux kernel version mismatch

I would rename the directory then reinstall the filesystem package which will create the link.
Edit:
Also check the output of pacman -Qkk to see if any other symlinks have been converted to directories such as /bin,/sbin,/usr/sbin.

Last edited by loqs (2020-10-03 21:47:09)

Offline

#16 2020-10-03 21:48:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,452
Website

Re: [Solved] Linux kernel version mismatch

The check for other similar problems.  I'd bet that /bin, /sbin, and /lib64 at least would also be problematic.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#17 2020-10-03 22:30:12

Frousties
Member
Registered: 2020-10-03
Posts: 7

Re: [Solved] Linux kernel version mismatch

loqs wrote:

I would rename the directory then reinstall the filesystem package which will create the link.
Edit:
Also check the output of pacman -Qkk to see if any other symlinks have been converted to directories such as /bin,/sbin,/usr/sbin.

Thank you so much! That fixed it
It also helped fixed several other small problems in my system, thank you!

Offline

Board footer

Powered by FluxBB