Can't initialize iptables table `filter': Table does not exist (do you need to insmod?)

33,542

Solution 1

These commands solved the problem for me (change the versions respectively):

 601  ls -lha /lib/modules
  602  pwd
  603  cp -R /lib/modules/4.1.18+ /lib/modules/4.1.17+
  604  sudo cp -R /lib/modules/4.1.18+ /lib/modules/4.1.17+
  605  sudo cp -R /lib/modules/4.1.18-v7+/ /lib/modules/4.1.17-v7+
  606  sudo apt-get install rpi-update
  607  sudo iptables --list
  608  sudo iptables -I INPUT -p udp --dport 1900 -j ACCEPT

Solution 2

This is a common error on old raspberry pi devices specialy if you install any additional iptable plugins (in my case it was PSAD which is not quite a plugin it just read logs) ,Jalal answer is correct but it don't need those module coping and it skipped a few steps.

As error says , iptable or raspberry pi firmware needs to update , mostly firmware needs to be updated, so you need to install rpi-update and run it but you must gave execute permission to /sbin/depmod first.

All you need to do is :

sudo apt-get install rpi-update
sudo chmod +x /sbin/depmod
sudo sudo rpi-update
Share:
33,542

Related videos on Youtube

Mona Jalal
Author by

Mona Jalal

contact me at [email protected] I am a 5th-year computer science Ph.D. Candidate at Boston University advised by Professor Vijaya Kolachalama in computer vision as the area of study. Currently, I am working on my proposal exam and thesis on the use of efficient computer vision and deep learning for cancer detection in H&E stained digital pathology images.

Updated on September 18, 2022

Comments

  • Mona Jalal
    Mona Jalal over 1 year

    I'm trying to open up port 1900 for UDP in order for the Echo to be able to discover the HA Bridge using the following command but I get errors. What is the best solution to fix this?

    pi@raspberrypi:~/hue $ sudo iptables -I INPUT -p udp --dport 1900 -j ACCEPT
    modprobe: ERROR: ../libkmod/libkmod.c:557 kmod_search_moddep() could not open moddep file '/lib/modules/4.1.17-v7+/modules.dep.bin'
    iptables v1.4.21: can't initialize iptables table `filter': Table does not exist (do you need to insmod?)
    Perhaps iptables or your kernel needs to be upgraded.
    pi@raspberrypi:~/hue $ sudo depmod
    depmod: ERROR: could not open directory /lib/modules/4.1.17-v7+: No such file or directory
    depmod: FATAL: could not search modules: No such file or directory
    
    pi@raspberrypi:~/hue $ sudo apt-get install --reinstall linux-image-4.1.17
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    E: Unable to locate package linux-image-4.1.17
    E: Couldn't find any package by regex 'linux-image-4.1.17'
    
    pi@raspberrypi:~/hue $ uname -a
    Linux raspberrypi 4.1.17-v7+ #838 SMP Tue Feb 9 13:15:09 GMT 2016 armv7l GNU/Linux