How to get UFW in Ubuntu 20.10 (Perhaps iptables or your kernel needs to be upgraded)

This is my Ubuntu 20.10, if I understand uname show wrong version

# uname -r
4.15.0-60-generic

because

# ls -la /boot
total 147492
drwxr-xr-x 4 root root 4096 Feb 11 21:21 .
drwxr-xr-x 19 root root 4096 Feb 11 01:07 ..
-rw-r--r-- 1 root root 248258 Jan 18 17:01 config-5.8.0-41-generic
-rw-r--r-- 1 root root 248258 Feb 5 03:41 config-5.8.0-43-generic
drwxr-xr-x 4 root root 4096 Feb 11 21:21 grub
lrwxrwxrwx 1 root root 27 Feb 11 21:21 initrd.img -> initrd.img-5.8.0-43-generic
-rw-r--r-- 1 root root 55795996 Feb 11 01:07 initrd.img-5.8.0-41-generic
-rw-r--r-- 1 root root 55798352 Feb 11 21:21 initrd.img-5.8.0-43-generic
lrwxrwxrwx 1 root root 27 Jan 28 07:27 initrd.img.old -> initrd.img-5.8.0-41-generic
drwx------ 2 root root 16384 Feb 11 01:07 lost+found
-rw------- 1 root root 5635676 Jan 18 17:01 System.map-5.8.0-41-generic
-rw------- 1 root root 5635676 Feb 5 03:41 System.map-5.8.0-43-generic
lrwxrwxrwx 1 root root 24 Feb 11 21:21 vmlinuz -> vmlinuz-5.8.0-43-generic
-rw------- 1 root root 13715296 Jan 18 17:08 vmlinuz-5.8.0-41-generic
-rw------- 1 root root 13715296 Feb 5 04:04 vmlinuz-5.8.0-43-generic
lrwxrwxrwx 1 root root 24 Jan 28 07:27 vmlinuz.old -> vmlinuz-5.8.0-41-generic
 # dpkg -l | grep linux-
ii linux-base 4.5ubuntu4 all Linux image base package
ii linux-firmware 1.190.3 all Firmware for Linux kernel drivers
ii linux-generic 5.8.0.43.48 amd64 Complete Generic Linux kernel and headers
ii linux-headers-5.8.0-41 5.8.0-41.46 all Header files related to Linux kernel version 5.8.0
ii linux-headers-5.8.0-41-generic 5.8.0-41.46 amd64 Linux kernel headers for version 5.8.0 on 64 bit x86 SMP
ii linux-headers-5.8.0-43 5.8.0-43.49 all Header files related to Linux kernel version 5.8.0
ii linux-headers-5.8.0-43-generic 5.8.0-43.49 amd64 Linux kernel headers for version 5.8.0 on 64 bit x86 SMP
ii linux-headers-generic 5.8.0.43.48 amd64 Generic Linux kernel headers
ii linux-image-5.8.0-41-generic 5.8.0-41.46 amd64 Signed kernel image generic
ii linux-image-5.8.0-43-generic 5.8.0-43.49 amd64 Signed kernel image generic
ii linux-image-generic 5.8.0.43.48 amd64 Generic Linux kernel image
ii linux-modules-5.8.0-41-generic 5.8.0-41.46 amd64 Linux kernel extra modules for version 5.8.0 on 64 bit x86 SMP
ii linux-modules-5.8.0-43-generic 5.8.0-43.49 amd64 Linux kernel extra modules for version 5.8.0 on 64 bit x86 SMP
ii linux-modules-extra-5.8.0-41-generic 5.8.0-41.46 amd64 Linux kernel extra modules for version 5.8.0 on 64 bit x86 SMP
ii linux-modules-extra-5.8.0-43-generic 5.8.0-43.49 amd64 Linux kernel extra modules for version 5.8.0 on 64 bit x86 SMP
 # ls -lha /lib/modules
total 16K
drwxr-xr-x 4 root root 4.0K Feb 11 21:21 .
drwxr-xr-x 47 root root 4.0K Feb 11 21:22 ..
drwxr-xr-x 5 root root 4.0K Jan 28 07:27 5.8.0-41-generic
drwxr-xr-x 5 root root 4.0K Feb 11 21:21 5.8.0-43-generic

When I try to install UFW, I receive errorerror: couldn't determine iptables versionI have seen iptables version

# update-alternatives --list iptables /usr/sbin/iptables-legacy /usr/sbin/iptables-nft

and switch to old version

# update-alternatives --set iptables /usr/sbin/iptables-legacy 

and reboot. But UFW still don't working.

 # sudo iptables --list
modprobe: FATAL: Module ip_tables not found in directory /lib/modules/4.15.0-60-generic
iptables v1.8.5 (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.
# depmod
depmod: ERROR: could not open directory /lib/modules/4.15.0-60-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
 # ufw status verbose
ERROR: problem running iptables: modprobe: FATAL: Module ip_tables not found in directory /lib/modules/4.15.0-60-generic
iptables v1.8.5 (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.

How to repair this ubuntu (see Uname) and install UFW in correct way?

6

1 Answer

and finally I have understand this issue. This is all we know about cloud providers, their scripts set up operation system to one disk (in my case /dev/sdb Ubuntu 20.10) than booting system from another disk (in my case /dev/sda with Ubuntu 16.04)

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like