Ubuntu
從 Ubuntu 18.04 -> 20.04 升級後缺少 iptables 核心模組
從 Ubuntu 18.04 升級到 20.04 (focal) 後,缺少 iptables 核心模組:
root@server:~# iptables -L modprobe: FATAL: Module ip_tables not found in directory /lib/modules/5.4.0-42-generic iptables v1.8.4 (legacy): 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 --reinstall iptables
sudo apt-get install --reinstall linux-headers-$(uname -r)
sudo dpkg-reconfigure iptables dkms autoinstall
還安裝了 linux-modules-extra
的輸出
ls -R /var/lib/dkms
是:/var/lib/dkms: dkms_dbversion wireguard /var/lib/dkms/wireguard: 1.0.20200611 kernel-5.4.0-42-generic-x86_64 /var/lib/dkms/wireguard/1.0.20200611: 5.4.0-42-generic source /var/lib/dkms/wireguard/1.0.20200611/5.4.0-42-generic: x86_64 /var/lib/dkms/wireguard/1.0.20200611/5.4.0-42-generic/x86_64: log module /var/lib/dkms/wireguard/1.0.20200611/5.4.0-42-generic/x86_64/log: make.log /var/lib/dkms/wireguard/1.0.20200611/5.4.0-42-generic/x86_64/module: wireguard.ko
有什麼想法可以重新啟動 iptables 嗎?
在我的 Ubuntu 20.04 安裝中,該文件
/lib/modules/5.4.0-40-generic/kernel/net/ipv4/netfilter/ip_tables.ko
屬於linux-modules
包,而不是linux-modules-extra
. 重新安裝linux-modules
應該可以解決問題:sudo apt-get install --reinstall linux-modules-5.4.0-42-generic