AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 780980
Accepted
kwoxer
kwoxer
Asked: 2016-06-05 09:57:49 +0800 CST2016-06-05 09:57:49 +0800 CST 2016-06-05 09:57:49 +0800 CST

错误:无法打开目录/lib/modules/4.2.0-25-generic:没有这样的文件或目录

  • 772

我将 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-...,这里有一些版本,例如:

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命令中找到了它。所以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.

编辑#1

我只是想看看我当前的内核。它实际上是 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

但 uname 仍然说:

uname -r
4.2.0-25-generic

有人可以解释一下可能发生了什么以及如何解决吗?

linux ubuntu iptables
  • 2 2 个回答
  • 13714 Views

2 个回答

  • Voted
  1. Julie Pelletier
    2016-06-05T10:32:43+08:002016-06-05T10:32:43+08:00

    您不能在 VPS 上安装自己的内核或内核模块。如果您绝对需要某些内核模块,您应该咨询您的主机。

    我认为该filter模块当然应该包括在内。

    • 2
  2. Best Answer
    kwoxer
    2016-06-09T22:59:35+08:002016-06-09T22:59:35+08:00

    我只需要在Digitalocean中设置内核。现在我有了正确的内核(4.4.0.22)并且 iptables 也可以工作了。 在此处输入图像描述

    • 1

相关问题

  • 更改 PHP 的默认配置设置?

  • 保护新的 Ubuntu 服务器 [关闭]

  • (软)Ubuntu 7.10 上的 RAID 6,我应该迁移到 8.10 吗?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve