我升级了Ubuntu 15.10到16.04,并且在那里发生了我的麻烦。
我第一次意识到我的麻烦,当我想做sudo iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT 。 我得到了:
modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.2.0-25-generic/modules.dep.bin' modprobe: FATAL: Module ip_tables not found in directory /lib/modules/4.2.0-25-generic iptables v1.6.0: can't initialize iptables table `filter': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded.
好,所以有一个问题/lib/modules/4.2.0-25-generic …
然后我尝试用sudo depmod进行修复。 但是我得到了:
depmod: ERROR: could not open directory /lib/modules/4.2.0-25-generic: No such file or directory depmod: FATAL: could not search modules: No such file or directory
现在我想用sudo apt-get install --reinstall linux-...来重build内核,这里有一些版本,比如:
linux-image-3.13.0-24-generic linux-image-3.4.0-4-goldfish linux-image-4.4.0-21-generic linux-image-4.4.0-21-lowlatency linux-image-4.4.0-22-generic linux-image-4.4.0-22-lowlatency
但是没有linux-image-4.2.0-25-generic 。 奇怪的事情。 所以通过升级Linux,设置了内核的旧版本和错版本。
现在我想看看这个版本保存在哪里。我在uname -r命令中find了它。 所以apt-get install linux-image-'uname -r'-dbgsym ,就像:
Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package linux-image-4.2.0-25-generic-dbgsym E: Couldn't find any package by glob 'linux-image-4.2.0-25-generic-dbgsym' E: Couldn't find any package by regex 'linux-image-4.2.0-25-generic-dbgsym'
但我不知道如何用手改变uname -r 。 而且我也不知道为什么我得到这个错误的版本。 最重要的是,如果改变uname是个好主意。
顺便说一句,我使用Digitalocean和升级通过do-release-upgrade 。
我只是想看看我目前的内核。 而实际上它是4.4.0-22:
sudo update-grub Generating grub configuration file ... Found linux image: /boot/vmlinuz-4.4.0-22-generic Found initrd image: /boot/initrd.img-4.4.0-22-generic Found memtest86+ image: /boot/memtest86+.elf Found memtest86+ image: /boot/memtest86+.bin done
但是un still还说:
uname -r 4.2.0-25-generic
有人能解释我可能发生了什么,以及如何解决?
您不能在VPS上安装您自己的内核或内核模块。 如果您绝对需要某些内核模块,您应该咨询您的主机。
我认为filter模块当然应该包括在内。
我只需要在Digitalocean中设置 内核 。 现在我有了正确的内核(4.4.0.22),iptables也在工作。