如何修复 Linux 内核/模块版本不匹配的问题?

如何修复 Linux 内核/模块版本不匹配的问题?

我有一个 Wandboard Quad,从 SD 卡启动并刷入 Ubuntu 15.10。

在我升级我的发行版后:

$> sudo apt-get update && sudo apt-get upgrade

我的魔杖板看起来像这样:

root@smog:~# uname -a
Linux smog 3.10.17-1.0.2-wandboard+gbe8d687 #1 SMP PREEMPT Wed Apr 1 08:46:23 UTC 2015 armv7l armv7l armv7l GNU/Linux
root@smog:~# cat /proc/version
Linux version 3.10.17-1.0.2-wandboard+gbe8d687 (tjakowit@hikalxplm30) (gcc version 4.9.1 (GCC) ) #1 SMP PREEMPT Wed Apr 1 08:46:23 UTC 2015
root@smog:~# ls -l /lib/modules/
total 4
drwxr-xr-x 4 root root 4096 May 21 20:05 4.2.0-42-generic
root@smog:~#
root@smog:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 15.10
Release:        15.10
Codename:       wily

正如您所看到的,内核版本和模块版本(来自升级后的 rootfs)之间不匹配,因此 iptables 这样的命令将不起作用:

root@smog:~# iptables -L
modprobe: ERROR: ../libkmod/libkmod.c:578 kmod_search_moddep() could not open moddep file '/lib/modules/3.10.17-1.0.2-wandboard+gbe8d687/modules.dep.bin'
iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

请注意,此命令在我的情况下不起作用(来自这里):

$> sudo apt-get install linux-image-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-image-3.10.17-1.0.2-wandboard+gbe8d687
E: Couldn't find any package by regex 'linux-image-3.10.17-1.0.2-wandboard+gbe8d687'

除了使用干净的映像重新刷新我的主板(并且从不升级它)之外,如何解决此问题?

编辑:命令 apt-cache search linux-image 的输出:

$> apt-cache search linux-image
alsa-base - ALSA driver configuration files
linux-image-generic - Generic Linux kernel image
linux-image-4.2.0-16-generic - Linux kernel image for version 4.2.0 on ARM (hard float) SMP
linux-image-4.2.0-16-generic-lpae - Linux kernel image for version 4.2.0 on ARM (hard float) SMP
linux-image-generic-lpae - Generic Linux kernel image
linux-image-3.4.0-1-hammerhead - Linux kernel image for version 3.4.0 on Nexus 5
linux-image-3.4.0-4-goldfish - Linux kernel image for version 3.4.0 on Android touch emulation
linux-image-3.4.0-5-chromebook - Linux kernel image for version 3.4.0 on Samsung Chromebook
linux-image-3.4.0-5-flo - Linux kernel image for version 3.4.0 on Nexus 10
linux-image-3.4.0-7-mako - Linux kernel image for version 3.4.0 on Nexus 4
linux-image-3.4.0-7-manta - Linux kernel image for version 3.4.0 on Nexus 10
linux-image-4.2.0-1013-raspi2 - Linux kernel image for version 4.2.0 on ARM (hard float) SMP
linux-image-chromebook - Linux kernel image for the Samsung ARM Chromebook.
linux-image-flo - Linux kernel image for the Nexus7 (flo).
linux-image-goldfish - Linux kernel image for the goldfish kernel.
linux-image-hammerhead - Linux kernel image for the Nexus 5 (hammerhead).
linux-image-mako - Linux kernel image for the Nexus4 (mako).
linux-image-manta - Linux kernel image for the Nexus10 (manta).
linux-image-nexus4 - Transitional package
linux-image-raspi2 - Linux kernel image for the BCM2709 architecture.
linux-image-4.2.0-42-generic - Linux kernel image for version 4.2.0 on ARM (hard float) SMP
linux-image-4.2.0-42-generic-lpae - Linux kernel image for version 4.2.0 on ARM (hard float) SMP
linux-image-4.2.0-1034-raspi2 - Linux kernel image for version 4.2.0 on ARM (hard float) SMP

相关内容