After a release upgrade from Ubuntu 18.04 to 20.04 (focal), the iptables kernel module is missing:
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.
I tried the following, but it did not fix the problem:
sudo apt-get install --reinstall iptables
sudo apt-get install --reinstall linux-headers-$(uname -r)
sudo dpkg-reconfigure iptables
dkms autoinstall
linux-modules-extra is also installed
output of ls -R /var/lib/dkms
is:
/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
Any ideas how I can reactivate iptables?
Best Answer
On my Ubuntu 20.04 installation the file
/lib/modules/5.4.0-40-generic/kernel/net/ipv4/netfilter/ip_tables.ko
belongs to thelinux-modules
package, notlinux-modules-extra
. Reinstallinglinux-modules
should do the trick: