How can I fix the iptables error message “unable to initialize table 'filter'”?











up vote
6
down vote

favorite
1












When I try to use iptables command on one of my Rackspace cloud server, I'm getting the following error.



In an attempt to apply iptables rules with iptables-apply -t 120 /etc/iptables.rules and iptables-restore < /etc/iptables.rules I got the next error:



FATAL: Could not load /lib/modules/2.6.32.4-rscloud/modules.dep: No such file or directory
iptables-restore v1.4.4: iptables-restore: unable to initialize table 'filter'

Error occurred at line: 2
Try `iptables-restore -h' or 'iptables-restore --help' for more information.


How do I fix this?



EDIT 1:



uname -r :



2.6.32.4-rscloud


modprobe /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/iptable_filter.ko :



FATAL: Could not load /lib/modules/2.6.32.4-rscloud/modules.dep: No such file or directory


ls /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/ :



ls: cannot access /lib/modules/2.6.32.4-rscloud/kernel/net/ipv4/netfilter/: No such file or directory


EDIT 2:



apt-cache search linux-image-* :



alsa-base - ALSA driver configuration files
linux-image-2.6.31-14-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-14-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-14-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-302-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-9-rt - Linux kernel image for version 2.6.31 on Ingo Molnar's full real time preemption patch
linux-image-rt - Rt Linux kernel image
rt2400-source - source for rt2400 wireless network driver
rt2500-source - source for rt2500 wireless network driver
rt2570-source - source for rt2570 wireless network driver
linux-image - Generic Linux kernel image.
linux-image-2.6.31-15-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-15-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-15-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-16-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-16-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-16-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-17-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-17-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-17-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-19-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-19-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-19-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-20-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-20-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-20-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-21-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-21-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-21-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-304-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-305-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-306-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-ec2 - Linux kernel image for ec2 machines
linux-image-generic - Generic Linux kernel image
linux-image-server - Linux kernel image on Server Equipment.
linux-image-virtual - Linux kernel image for virtual machines
linux-image-2.6.31-22-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-22-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-22-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-307-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64









share|improve this question




















  • 2




    The modules.dep file should have been generated when you installed the kernel. What kernel are you running (uname -r) and how did you install it (Ubuntu package, pre-installed by your hosting provider, other)? What do you have in /lib/modules, in /lib/modules/$(uname -r)?
    – Gilles
    Feb 26 '11 at 19:21










  • I have updated my question!
    – user3215
    Feb 28 '11 at 5:51










  • Can you also show the output of ls /lib/modules/ ?
    – Lekensteyn
    Feb 28 '11 at 8:39










  • @Lekensteyn: ls /lib/modules/ listed only 2.6.32.1-rscloud
    – user3215
    Feb 28 '11 at 9:05






  • 2




    You can tell them the problem you have: you need to load an iptables (netfilter) kernel module, but the kernel image files on your system is different from the loaded kernel.
    – Lekensteyn
    Mar 1 '11 at 1:47















up vote
6
down vote

favorite
1












When I try to use iptables command on one of my Rackspace cloud server, I'm getting the following error.



In an attempt to apply iptables rules with iptables-apply -t 120 /etc/iptables.rules and iptables-restore < /etc/iptables.rules I got the next error:



FATAL: Could not load /lib/modules/2.6.32.4-rscloud/modules.dep: No such file or directory
iptables-restore v1.4.4: iptables-restore: unable to initialize table 'filter'

Error occurred at line: 2
Try `iptables-restore -h' or 'iptables-restore --help' for more information.


How do I fix this?



EDIT 1:



uname -r :



2.6.32.4-rscloud


modprobe /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/iptable_filter.ko :



FATAL: Could not load /lib/modules/2.6.32.4-rscloud/modules.dep: No such file or directory


ls /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/ :



ls: cannot access /lib/modules/2.6.32.4-rscloud/kernel/net/ipv4/netfilter/: No such file or directory


EDIT 2:



apt-cache search linux-image-* :



alsa-base - ALSA driver configuration files
linux-image-2.6.31-14-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-14-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-14-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-302-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-9-rt - Linux kernel image for version 2.6.31 on Ingo Molnar's full real time preemption patch
linux-image-rt - Rt Linux kernel image
rt2400-source - source for rt2400 wireless network driver
rt2500-source - source for rt2500 wireless network driver
rt2570-source - source for rt2570 wireless network driver
linux-image - Generic Linux kernel image.
linux-image-2.6.31-15-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-15-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-15-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-16-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-16-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-16-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-17-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-17-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-17-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-19-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-19-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-19-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-20-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-20-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-20-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-21-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-21-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-21-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-304-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-305-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-306-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-ec2 - Linux kernel image for ec2 machines
linux-image-generic - Generic Linux kernel image
linux-image-server - Linux kernel image on Server Equipment.
linux-image-virtual - Linux kernel image for virtual machines
linux-image-2.6.31-22-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-22-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-22-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-307-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64









share|improve this question




















  • 2




    The modules.dep file should have been generated when you installed the kernel. What kernel are you running (uname -r) and how did you install it (Ubuntu package, pre-installed by your hosting provider, other)? What do you have in /lib/modules, in /lib/modules/$(uname -r)?
    – Gilles
    Feb 26 '11 at 19:21










  • I have updated my question!
    – user3215
    Feb 28 '11 at 5:51










  • Can you also show the output of ls /lib/modules/ ?
    – Lekensteyn
    Feb 28 '11 at 8:39










  • @Lekensteyn: ls /lib/modules/ listed only 2.6.32.1-rscloud
    – user3215
    Feb 28 '11 at 9:05






  • 2




    You can tell them the problem you have: you need to load an iptables (netfilter) kernel module, but the kernel image files on your system is different from the loaded kernel.
    – Lekensteyn
    Mar 1 '11 at 1:47













up vote
6
down vote

favorite
1









up vote
6
down vote

favorite
1






1





When I try to use iptables command on one of my Rackspace cloud server, I'm getting the following error.



In an attempt to apply iptables rules with iptables-apply -t 120 /etc/iptables.rules and iptables-restore < /etc/iptables.rules I got the next error:



FATAL: Could not load /lib/modules/2.6.32.4-rscloud/modules.dep: No such file or directory
iptables-restore v1.4.4: iptables-restore: unable to initialize table 'filter'

Error occurred at line: 2
Try `iptables-restore -h' or 'iptables-restore --help' for more information.


How do I fix this?



EDIT 1:



uname -r :



2.6.32.4-rscloud


modprobe /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/iptable_filter.ko :



FATAL: Could not load /lib/modules/2.6.32.4-rscloud/modules.dep: No such file or directory


ls /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/ :



ls: cannot access /lib/modules/2.6.32.4-rscloud/kernel/net/ipv4/netfilter/: No such file or directory


EDIT 2:



apt-cache search linux-image-* :



alsa-base - ALSA driver configuration files
linux-image-2.6.31-14-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-14-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-14-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-302-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-9-rt - Linux kernel image for version 2.6.31 on Ingo Molnar's full real time preemption patch
linux-image-rt - Rt Linux kernel image
rt2400-source - source for rt2400 wireless network driver
rt2500-source - source for rt2500 wireless network driver
rt2570-source - source for rt2570 wireless network driver
linux-image - Generic Linux kernel image.
linux-image-2.6.31-15-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-15-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-15-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-16-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-16-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-16-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-17-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-17-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-17-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-19-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-19-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-19-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-20-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-20-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-20-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-21-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-21-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-21-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-304-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-305-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-306-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-ec2 - Linux kernel image for ec2 machines
linux-image-generic - Generic Linux kernel image
linux-image-server - Linux kernel image on Server Equipment.
linux-image-virtual - Linux kernel image for virtual machines
linux-image-2.6.31-22-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-22-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-22-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-307-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64









share|improve this question















When I try to use iptables command on one of my Rackspace cloud server, I'm getting the following error.



In an attempt to apply iptables rules with iptables-apply -t 120 /etc/iptables.rules and iptables-restore < /etc/iptables.rules I got the next error:



FATAL: Could not load /lib/modules/2.6.32.4-rscloud/modules.dep: No such file or directory
iptables-restore v1.4.4: iptables-restore: unable to initialize table 'filter'

Error occurred at line: 2
Try `iptables-restore -h' or 'iptables-restore --help' for more information.


How do I fix this?



EDIT 1:



uname -r :



2.6.32.4-rscloud


modprobe /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/iptable_filter.ko :



FATAL: Could not load /lib/modules/2.6.32.4-rscloud/modules.dep: No such file or directory


ls /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/ :



ls: cannot access /lib/modules/2.6.32.4-rscloud/kernel/net/ipv4/netfilter/: No such file or directory


EDIT 2:



apt-cache search linux-image-* :



alsa-base - ALSA driver configuration files
linux-image-2.6.31-14-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-14-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-14-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-302-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-9-rt - Linux kernel image for version 2.6.31 on Ingo Molnar's full real time preemption patch
linux-image-rt - Rt Linux kernel image
rt2400-source - source for rt2400 wireless network driver
rt2500-source - source for rt2500 wireless network driver
rt2570-source - source for rt2570 wireless network driver
linux-image - Generic Linux kernel image.
linux-image-2.6.31-15-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-15-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-15-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-16-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-16-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-16-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-17-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-17-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-17-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-19-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-19-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-19-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-20-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-20-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-20-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-21-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-21-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-21-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-304-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-305-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-306-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-ec2 - Linux kernel image for ec2 machines
linux-image-generic - Generic Linux kernel image
linux-image-server - Linux kernel image on Server Equipment.
linux-image-virtual - Linux kernel image for virtual machines
linux-image-2.6.31-22-generic - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-22-server - Linux kernel image for version 2.6.31 on x86_64
linux-image-2.6.31-22-virtual - Linux kernel image for version 2.6.31 on x86/x86_64
linux-image-2.6.31-307-ec2 - Linux kernel image for version 2.6.31 on x86/x86_64






server 9.10 iptables






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 18 '12 at 7:16

























asked Feb 26 '11 at 17:42









user3215

2,058124459




2,058124459








  • 2




    The modules.dep file should have been generated when you installed the kernel. What kernel are you running (uname -r) and how did you install it (Ubuntu package, pre-installed by your hosting provider, other)? What do you have in /lib/modules, in /lib/modules/$(uname -r)?
    – Gilles
    Feb 26 '11 at 19:21










  • I have updated my question!
    – user3215
    Feb 28 '11 at 5:51










  • Can you also show the output of ls /lib/modules/ ?
    – Lekensteyn
    Feb 28 '11 at 8:39










  • @Lekensteyn: ls /lib/modules/ listed only 2.6.32.1-rscloud
    – user3215
    Feb 28 '11 at 9:05






  • 2




    You can tell them the problem you have: you need to load an iptables (netfilter) kernel module, but the kernel image files on your system is different from the loaded kernel.
    – Lekensteyn
    Mar 1 '11 at 1:47














  • 2




    The modules.dep file should have been generated when you installed the kernel. What kernel are you running (uname -r) and how did you install it (Ubuntu package, pre-installed by your hosting provider, other)? What do you have in /lib/modules, in /lib/modules/$(uname -r)?
    – Gilles
    Feb 26 '11 at 19:21










  • I have updated my question!
    – user3215
    Feb 28 '11 at 5:51










  • Can you also show the output of ls /lib/modules/ ?
    – Lekensteyn
    Feb 28 '11 at 8:39










  • @Lekensteyn: ls /lib/modules/ listed only 2.6.32.1-rscloud
    – user3215
    Feb 28 '11 at 9:05






  • 2




    You can tell them the problem you have: you need to load an iptables (netfilter) kernel module, but the kernel image files on your system is different from the loaded kernel.
    – Lekensteyn
    Mar 1 '11 at 1:47








2




2




The modules.dep file should have been generated when you installed the kernel. What kernel are you running (uname -r) and how did you install it (Ubuntu package, pre-installed by your hosting provider, other)? What do you have in /lib/modules, in /lib/modules/$(uname -r)?
– Gilles
Feb 26 '11 at 19:21




The modules.dep file should have been generated when you installed the kernel. What kernel are you running (uname -r) and how did you install it (Ubuntu package, pre-installed by your hosting provider, other)? What do you have in /lib/modules, in /lib/modules/$(uname -r)?
– Gilles
Feb 26 '11 at 19:21












I have updated my question!
– user3215
Feb 28 '11 at 5:51




I have updated my question!
– user3215
Feb 28 '11 at 5:51












Can you also show the output of ls /lib/modules/ ?
– Lekensteyn
Feb 28 '11 at 8:39




Can you also show the output of ls /lib/modules/ ?
– Lekensteyn
Feb 28 '11 at 8:39












@Lekensteyn: ls /lib/modules/ listed only 2.6.32.1-rscloud
– user3215
Feb 28 '11 at 9:05




@Lekensteyn: ls /lib/modules/ listed only 2.6.32.1-rscloud
– user3215
Feb 28 '11 at 9:05




2




2




You can tell them the problem you have: you need to load an iptables (netfilter) kernel module, but the kernel image files on your system is different from the loaded kernel.
– Lekensteyn
Mar 1 '11 at 1:47




You can tell them the problem you have: you need to load an iptables (netfilter) kernel module, but the kernel image files on your system is different from the loaded kernel.
– Lekensteyn
Mar 1 '11 at 1:47










7 Answers
7






active

oldest

votes

















up vote
5
down vote













You need to load a kernel module for enabling the filter table. Run the next command as root:



modprobe /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/iptable_filter.ko


(uname -r gives the current kernel version)





For a list of available modules for iptables, list the directory containing iptables modules:



ls /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/


To get information on all modules:



modinfo /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/*.ko





share|improve this answer



















  • 1




    Use modprobe not insmod since its more safe with dependencies.
    – mathepic
    Feb 27 '11 at 2:00










  • Should I replace $(uname -r) with my kernel or it will understand?
    – user3215
    Feb 28 '11 at 1:01












  • I have updated the question!
    – user3215
    Feb 28 '11 at 4:24










  • @user3215: This article could help you creating the modules.
    – Lekensteyn
    Mar 6 '11 at 11:10










  • This didn't work for me. I searched and found this answer, which implied I should use modprobe iptable_filter. That worked.
    – GregRos
    Mar 11 at 18:18


















up vote
1
down vote













It is possible that the linux kernel you are using wasn't built with loadable module support.
A good way to find out if your kernel has module support is to check the existence of the file /proc/modules. If it is there but you don't have a /lib/modules/$(uname -r)/modules.dep file, it means that your kernel has support for modules but that they were not correctly installed.
It look like your kernel was built by your provider Rackspace, you should ask them about the kernel configuration.






share|improve this answer























  • Already suggested in the comments :) OP should indeed contact his provider.
    – Lekensteyn
    Mar 3 '11 at 16:28












  • ok, just saw that. @user3215 you should ask them to install the modules or to build a kernel which has the iptables functionality build-in
    – Pierre
    Mar 3 '11 at 17:09




















up vote
1
down vote













Another way to get proper iptables support is to install xtables-addons, you need to have quite a lot of tools to get this working though (module-assistant, build-essential etc.), but the advantage is that at the end you have ipset as well as iptables and (IMHO) using ipset as well is much better for large complex rulesets



apt-get install xtables-addons-common

apt-get install xtables-addons-source

m-a prepare

m-a build xtables-addons

m-a install xtables-addons





share|improve this answer




























    up vote
    1
    down vote













    I also use the Rackspace Cloud, with kernel 2.6.35.4-rscloud. I have multiple instances with this kernel and iptables works fine on some and I have the same problem as you on a couple others.



    Therefore I believe this kernel does have the support it needs for iptables, and the issue is caused by something else (I'm still looking for the solution myself)



    EDIT: I solved my issue by scp -r copying the /lib/modules/2.6.35.4-rscloud from the working iptables server to the non-working one.



    For some reason uname -r shows 2.6.35.4-rscloud and ls /lib/modules/ only contained the previous version like /lib/modules/2.6.31-302-rs.



    I'm not sure why this can fall out of synch, or what to do if you don't have a working server to copy these files from, but hopefully this points you in the right direction.



    I did not need to recompile a kernel or anything like that.






    share|improve this answer























    • I should give a try...
      – user3215
      Jul 12 '11 at 16:48


















    up vote
    1
    down vote













    I had the same error, but I found a stray comment in an unrelated article (http://articles.slicehost.com/2007/11/6/ubuntu-gutsy-setup-page-1) that identified the silly molecular error that was at fault in my case. The problem was that I had created the iptables.rules file using a text editor (Notepad++), but because the file type wasn't recognized, Notepad++ defaulted to using Windows End-of-Line and End-of-File characters. iptables rejects these characters, requiring their Unix equivalents, and was thus throwing an error upon the first occurrence: the end of the *filter line -- giving the false impression that there was something wrong with the *filter syntax. Ah, the ever-present joys of character-encoding-related errors!



    Two Solutions




    • The commenter I mentioned above installed (sudo aptitude install tofrodos) and ran (fromdos /etc/iptables.rules) a little conversion utility on the file.


    ---OR---




    • What I did was, in Notepad++, Edit > EOL Conversion > UNIX Format, and then Save and re-upload the file. That took care of the End-of-Line characters, but not the End-of-File character (despite what one might expect). So once I had it uploaded to the server, I opened it up in nano and created a newline at the end of the file and saved. Then everything worked perfectly.


    It might also be possible that merely opening the file in nano and resaving, without actually changing the characters manually, would do the trick, but I haven't tested.






    share|improve this answer




























      up vote
      1
      down vote













      You can also get errors with iptables if you've installed a new version of the Kernel but you haven't rebooted yet (quite common if you're building a new server using, for example, an Ansible playbook, and an earlier task is an apt-get upgrade)



      See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=829269#41 re: "Unknown symbol in module, or unknown parameter" error.






      share|improve this answer




























        up vote
        0
        down vote













        it turns out that it was just a missing sudo!



        sudo iptables-restore < /etc/iptables.rules



        instead of



        iptables-restore < /etc/iptables.rules






        share|improve this answer





















          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f28215%2fhow-can-i-fix-the-iptables-error-message-unable-to-initialize-table-filter%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          7 Answers
          7






          active

          oldest

          votes








          7 Answers
          7






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          5
          down vote













          You need to load a kernel module for enabling the filter table. Run the next command as root:



          modprobe /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/iptable_filter.ko


          (uname -r gives the current kernel version)





          For a list of available modules for iptables, list the directory containing iptables modules:



          ls /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/


          To get information on all modules:



          modinfo /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/*.ko





          share|improve this answer



















          • 1




            Use modprobe not insmod since its more safe with dependencies.
            – mathepic
            Feb 27 '11 at 2:00










          • Should I replace $(uname -r) with my kernel or it will understand?
            – user3215
            Feb 28 '11 at 1:01












          • I have updated the question!
            – user3215
            Feb 28 '11 at 4:24










          • @user3215: This article could help you creating the modules.
            – Lekensteyn
            Mar 6 '11 at 11:10










          • This didn't work for me. I searched and found this answer, which implied I should use modprobe iptable_filter. That worked.
            – GregRos
            Mar 11 at 18:18















          up vote
          5
          down vote













          You need to load a kernel module for enabling the filter table. Run the next command as root:



          modprobe /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/iptable_filter.ko


          (uname -r gives the current kernel version)





          For a list of available modules for iptables, list the directory containing iptables modules:



          ls /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/


          To get information on all modules:



          modinfo /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/*.ko





          share|improve this answer



















          • 1




            Use modprobe not insmod since its more safe with dependencies.
            – mathepic
            Feb 27 '11 at 2:00










          • Should I replace $(uname -r) with my kernel or it will understand?
            – user3215
            Feb 28 '11 at 1:01












          • I have updated the question!
            – user3215
            Feb 28 '11 at 4:24










          • @user3215: This article could help you creating the modules.
            – Lekensteyn
            Mar 6 '11 at 11:10










          • This didn't work for me. I searched and found this answer, which implied I should use modprobe iptable_filter. That worked.
            – GregRos
            Mar 11 at 18:18













          up vote
          5
          down vote










          up vote
          5
          down vote









          You need to load a kernel module for enabling the filter table. Run the next command as root:



          modprobe /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/iptable_filter.ko


          (uname -r gives the current kernel version)





          For a list of available modules for iptables, list the directory containing iptables modules:



          ls /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/


          To get information on all modules:



          modinfo /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/*.ko





          share|improve this answer














          You need to load a kernel module for enabling the filter table. Run the next command as root:



          modprobe /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/iptable_filter.ko


          (uname -r gives the current kernel version)





          For a list of available modules for iptables, list the directory containing iptables modules:



          ls /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/


          To get information on all modules:



          modinfo /lib/modules/$(uname -r)/kernel/net/ipv4/netfilter/*.ko






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 27 '11 at 8:52

























          answered Feb 26 '11 at 18:01









          Lekensteyn

          119k47262354




          119k47262354








          • 1




            Use modprobe not insmod since its more safe with dependencies.
            – mathepic
            Feb 27 '11 at 2:00










          • Should I replace $(uname -r) with my kernel or it will understand?
            – user3215
            Feb 28 '11 at 1:01












          • I have updated the question!
            – user3215
            Feb 28 '11 at 4:24










          • @user3215: This article could help you creating the modules.
            – Lekensteyn
            Mar 6 '11 at 11:10










          • This didn't work for me. I searched and found this answer, which implied I should use modprobe iptable_filter. That worked.
            – GregRos
            Mar 11 at 18:18














          • 1




            Use modprobe not insmod since its more safe with dependencies.
            – mathepic
            Feb 27 '11 at 2:00










          • Should I replace $(uname -r) with my kernel or it will understand?
            – user3215
            Feb 28 '11 at 1:01












          • I have updated the question!
            – user3215
            Feb 28 '11 at 4:24










          • @user3215: This article could help you creating the modules.
            – Lekensteyn
            Mar 6 '11 at 11:10










          • This didn't work for me. I searched and found this answer, which implied I should use modprobe iptable_filter. That worked.
            – GregRos
            Mar 11 at 18:18








          1




          1




          Use modprobe not insmod since its more safe with dependencies.
          – mathepic
          Feb 27 '11 at 2:00




          Use modprobe not insmod since its more safe with dependencies.
          – mathepic
          Feb 27 '11 at 2:00












          Should I replace $(uname -r) with my kernel or it will understand?
          – user3215
          Feb 28 '11 at 1:01






          Should I replace $(uname -r) with my kernel or it will understand?
          – user3215
          Feb 28 '11 at 1:01














          I have updated the question!
          – user3215
          Feb 28 '11 at 4:24




          I have updated the question!
          – user3215
          Feb 28 '11 at 4:24












          @user3215: This article could help you creating the modules.
          – Lekensteyn
          Mar 6 '11 at 11:10




          @user3215: This article could help you creating the modules.
          – Lekensteyn
          Mar 6 '11 at 11:10












          This didn't work for me. I searched and found this answer, which implied I should use modprobe iptable_filter. That worked.
          – GregRos
          Mar 11 at 18:18




          This didn't work for me. I searched and found this answer, which implied I should use modprobe iptable_filter. That worked.
          – GregRos
          Mar 11 at 18:18












          up vote
          1
          down vote













          It is possible that the linux kernel you are using wasn't built with loadable module support.
          A good way to find out if your kernel has module support is to check the existence of the file /proc/modules. If it is there but you don't have a /lib/modules/$(uname -r)/modules.dep file, it means that your kernel has support for modules but that they were not correctly installed.
          It look like your kernel was built by your provider Rackspace, you should ask them about the kernel configuration.






          share|improve this answer























          • Already suggested in the comments :) OP should indeed contact his provider.
            – Lekensteyn
            Mar 3 '11 at 16:28












          • ok, just saw that. @user3215 you should ask them to install the modules or to build a kernel which has the iptables functionality build-in
            – Pierre
            Mar 3 '11 at 17:09

















          up vote
          1
          down vote













          It is possible that the linux kernel you are using wasn't built with loadable module support.
          A good way to find out if your kernel has module support is to check the existence of the file /proc/modules. If it is there but you don't have a /lib/modules/$(uname -r)/modules.dep file, it means that your kernel has support for modules but that they were not correctly installed.
          It look like your kernel was built by your provider Rackspace, you should ask them about the kernel configuration.






          share|improve this answer























          • Already suggested in the comments :) OP should indeed contact his provider.
            – Lekensteyn
            Mar 3 '11 at 16:28












          • ok, just saw that. @user3215 you should ask them to install the modules or to build a kernel which has the iptables functionality build-in
            – Pierre
            Mar 3 '11 at 17:09















          up vote
          1
          down vote










          up vote
          1
          down vote









          It is possible that the linux kernel you are using wasn't built with loadable module support.
          A good way to find out if your kernel has module support is to check the existence of the file /proc/modules. If it is there but you don't have a /lib/modules/$(uname -r)/modules.dep file, it means that your kernel has support for modules but that they were not correctly installed.
          It look like your kernel was built by your provider Rackspace, you should ask them about the kernel configuration.






          share|improve this answer














          It is possible that the linux kernel you are using wasn't built with loadable module support.
          A good way to find out if your kernel has module support is to check the existence of the file /proc/modules. If it is there but you don't have a /lib/modules/$(uname -r)/modules.dep file, it means that your kernel has support for modules but that they were not correctly installed.
          It look like your kernel was built by your provider Rackspace, you should ask them about the kernel configuration.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 3 '11 at 14:31

























          answered Mar 3 '11 at 14:08









          Pierre

          112




          112












          • Already suggested in the comments :) OP should indeed contact his provider.
            – Lekensteyn
            Mar 3 '11 at 16:28












          • ok, just saw that. @user3215 you should ask them to install the modules or to build a kernel which has the iptables functionality build-in
            – Pierre
            Mar 3 '11 at 17:09




















          • Already suggested in the comments :) OP should indeed contact his provider.
            – Lekensteyn
            Mar 3 '11 at 16:28












          • ok, just saw that. @user3215 you should ask them to install the modules or to build a kernel which has the iptables functionality build-in
            – Pierre
            Mar 3 '11 at 17:09


















          Already suggested in the comments :) OP should indeed contact his provider.
          – Lekensteyn
          Mar 3 '11 at 16:28






          Already suggested in the comments :) OP should indeed contact his provider.
          – Lekensteyn
          Mar 3 '11 at 16:28














          ok, just saw that. @user3215 you should ask them to install the modules or to build a kernel which has the iptables functionality build-in
          – Pierre
          Mar 3 '11 at 17:09






          ok, just saw that. @user3215 you should ask them to install the modules or to build a kernel which has the iptables functionality build-in
          – Pierre
          Mar 3 '11 at 17:09












          up vote
          1
          down vote













          Another way to get proper iptables support is to install xtables-addons, you need to have quite a lot of tools to get this working though (module-assistant, build-essential etc.), but the advantage is that at the end you have ipset as well as iptables and (IMHO) using ipset as well is much better for large complex rulesets



          apt-get install xtables-addons-common

          apt-get install xtables-addons-source

          m-a prepare

          m-a build xtables-addons

          m-a install xtables-addons





          share|improve this answer

























            up vote
            1
            down vote













            Another way to get proper iptables support is to install xtables-addons, you need to have quite a lot of tools to get this working though (module-assistant, build-essential etc.), but the advantage is that at the end you have ipset as well as iptables and (IMHO) using ipset as well is much better for large complex rulesets



            apt-get install xtables-addons-common

            apt-get install xtables-addons-source

            m-a prepare

            m-a build xtables-addons

            m-a install xtables-addons





            share|improve this answer























              up vote
              1
              down vote










              up vote
              1
              down vote









              Another way to get proper iptables support is to install xtables-addons, you need to have quite a lot of tools to get this working though (module-assistant, build-essential etc.), but the advantage is that at the end you have ipset as well as iptables and (IMHO) using ipset as well is much better for large complex rulesets



              apt-get install xtables-addons-common

              apt-get install xtables-addons-source

              m-a prepare

              m-a build xtables-addons

              m-a install xtables-addons





              share|improve this answer












              Another way to get proper iptables support is to install xtables-addons, you need to have quite a lot of tools to get this working though (module-assistant, build-essential etc.), but the advantage is that at the end you have ipset as well as iptables and (IMHO) using ipset as well is much better for large complex rulesets



              apt-get install xtables-addons-common

              apt-get install xtables-addons-source

              m-a prepare

              m-a build xtables-addons

              m-a install xtables-addons






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jul 12 '11 at 6:15









              Francis Turner

              311




              311






















                  up vote
                  1
                  down vote













                  I also use the Rackspace Cloud, with kernel 2.6.35.4-rscloud. I have multiple instances with this kernel and iptables works fine on some and I have the same problem as you on a couple others.



                  Therefore I believe this kernel does have the support it needs for iptables, and the issue is caused by something else (I'm still looking for the solution myself)



                  EDIT: I solved my issue by scp -r copying the /lib/modules/2.6.35.4-rscloud from the working iptables server to the non-working one.



                  For some reason uname -r shows 2.6.35.4-rscloud and ls /lib/modules/ only contained the previous version like /lib/modules/2.6.31-302-rs.



                  I'm not sure why this can fall out of synch, or what to do if you don't have a working server to copy these files from, but hopefully this points you in the right direction.



                  I did not need to recompile a kernel or anything like that.






                  share|improve this answer























                  • I should give a try...
                    – user3215
                    Jul 12 '11 at 16:48















                  up vote
                  1
                  down vote













                  I also use the Rackspace Cloud, with kernel 2.6.35.4-rscloud. I have multiple instances with this kernel and iptables works fine on some and I have the same problem as you on a couple others.



                  Therefore I believe this kernel does have the support it needs for iptables, and the issue is caused by something else (I'm still looking for the solution myself)



                  EDIT: I solved my issue by scp -r copying the /lib/modules/2.6.35.4-rscloud from the working iptables server to the non-working one.



                  For some reason uname -r shows 2.6.35.4-rscloud and ls /lib/modules/ only contained the previous version like /lib/modules/2.6.31-302-rs.



                  I'm not sure why this can fall out of synch, or what to do if you don't have a working server to copy these files from, but hopefully this points you in the right direction.



                  I did not need to recompile a kernel or anything like that.






                  share|improve this answer























                  • I should give a try...
                    – user3215
                    Jul 12 '11 at 16:48













                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  I also use the Rackspace Cloud, with kernel 2.6.35.4-rscloud. I have multiple instances with this kernel and iptables works fine on some and I have the same problem as you on a couple others.



                  Therefore I believe this kernel does have the support it needs for iptables, and the issue is caused by something else (I'm still looking for the solution myself)



                  EDIT: I solved my issue by scp -r copying the /lib/modules/2.6.35.4-rscloud from the working iptables server to the non-working one.



                  For some reason uname -r shows 2.6.35.4-rscloud and ls /lib/modules/ only contained the previous version like /lib/modules/2.6.31-302-rs.



                  I'm not sure why this can fall out of synch, or what to do if you don't have a working server to copy these files from, but hopefully this points you in the right direction.



                  I did not need to recompile a kernel or anything like that.






                  share|improve this answer














                  I also use the Rackspace Cloud, with kernel 2.6.35.4-rscloud. I have multiple instances with this kernel and iptables works fine on some and I have the same problem as you on a couple others.



                  Therefore I believe this kernel does have the support it needs for iptables, and the issue is caused by something else (I'm still looking for the solution myself)



                  EDIT: I solved my issue by scp -r copying the /lib/modules/2.6.35.4-rscloud from the working iptables server to the non-working one.



                  For some reason uname -r shows 2.6.35.4-rscloud and ls /lib/modules/ only contained the previous version like /lib/modules/2.6.31-302-rs.



                  I'm not sure why this can fall out of synch, or what to do if you don't have a working server to copy these files from, but hopefully this points you in the right direction.



                  I did not need to recompile a kernel or anything like that.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jul 12 '11 at 13:25









                  Thomas Ward

                  43k23119169




                  43k23119169










                  answered Jul 11 '11 at 23:35









                  codercake

                  112




                  112












                  • I should give a try...
                    – user3215
                    Jul 12 '11 at 16:48


















                  • I should give a try...
                    – user3215
                    Jul 12 '11 at 16:48
















                  I should give a try...
                  – user3215
                  Jul 12 '11 at 16:48




                  I should give a try...
                  – user3215
                  Jul 12 '11 at 16:48










                  up vote
                  1
                  down vote













                  I had the same error, but I found a stray comment in an unrelated article (http://articles.slicehost.com/2007/11/6/ubuntu-gutsy-setup-page-1) that identified the silly molecular error that was at fault in my case. The problem was that I had created the iptables.rules file using a text editor (Notepad++), but because the file type wasn't recognized, Notepad++ defaulted to using Windows End-of-Line and End-of-File characters. iptables rejects these characters, requiring their Unix equivalents, and was thus throwing an error upon the first occurrence: the end of the *filter line -- giving the false impression that there was something wrong with the *filter syntax. Ah, the ever-present joys of character-encoding-related errors!



                  Two Solutions




                  • The commenter I mentioned above installed (sudo aptitude install tofrodos) and ran (fromdos /etc/iptables.rules) a little conversion utility on the file.


                  ---OR---




                  • What I did was, in Notepad++, Edit > EOL Conversion > UNIX Format, and then Save and re-upload the file. That took care of the End-of-Line characters, but not the End-of-File character (despite what one might expect). So once I had it uploaded to the server, I opened it up in nano and created a newline at the end of the file and saved. Then everything worked perfectly.


                  It might also be possible that merely opening the file in nano and resaving, without actually changing the characters manually, would do the trick, but I haven't tested.






                  share|improve this answer

























                    up vote
                    1
                    down vote













                    I had the same error, but I found a stray comment in an unrelated article (http://articles.slicehost.com/2007/11/6/ubuntu-gutsy-setup-page-1) that identified the silly molecular error that was at fault in my case. The problem was that I had created the iptables.rules file using a text editor (Notepad++), but because the file type wasn't recognized, Notepad++ defaulted to using Windows End-of-Line and End-of-File characters. iptables rejects these characters, requiring their Unix equivalents, and was thus throwing an error upon the first occurrence: the end of the *filter line -- giving the false impression that there was something wrong with the *filter syntax. Ah, the ever-present joys of character-encoding-related errors!



                    Two Solutions




                    • The commenter I mentioned above installed (sudo aptitude install tofrodos) and ran (fromdos /etc/iptables.rules) a little conversion utility on the file.


                    ---OR---




                    • What I did was, in Notepad++, Edit > EOL Conversion > UNIX Format, and then Save and re-upload the file. That took care of the End-of-Line characters, but not the End-of-File character (despite what one might expect). So once I had it uploaded to the server, I opened it up in nano and created a newline at the end of the file and saved. Then everything worked perfectly.


                    It might also be possible that merely opening the file in nano and resaving, without actually changing the characters manually, would do the trick, but I haven't tested.






                    share|improve this answer























                      up vote
                      1
                      down vote










                      up vote
                      1
                      down vote









                      I had the same error, but I found a stray comment in an unrelated article (http://articles.slicehost.com/2007/11/6/ubuntu-gutsy-setup-page-1) that identified the silly molecular error that was at fault in my case. The problem was that I had created the iptables.rules file using a text editor (Notepad++), but because the file type wasn't recognized, Notepad++ defaulted to using Windows End-of-Line and End-of-File characters. iptables rejects these characters, requiring their Unix equivalents, and was thus throwing an error upon the first occurrence: the end of the *filter line -- giving the false impression that there was something wrong with the *filter syntax. Ah, the ever-present joys of character-encoding-related errors!



                      Two Solutions




                      • The commenter I mentioned above installed (sudo aptitude install tofrodos) and ran (fromdos /etc/iptables.rules) a little conversion utility on the file.


                      ---OR---




                      • What I did was, in Notepad++, Edit > EOL Conversion > UNIX Format, and then Save and re-upload the file. That took care of the End-of-Line characters, but not the End-of-File character (despite what one might expect). So once I had it uploaded to the server, I opened it up in nano and created a newline at the end of the file and saved. Then everything worked perfectly.


                      It might also be possible that merely opening the file in nano and resaving, without actually changing the characters manually, would do the trick, but I haven't tested.






                      share|improve this answer












                      I had the same error, but I found a stray comment in an unrelated article (http://articles.slicehost.com/2007/11/6/ubuntu-gutsy-setup-page-1) that identified the silly molecular error that was at fault in my case. The problem was that I had created the iptables.rules file using a text editor (Notepad++), but because the file type wasn't recognized, Notepad++ defaulted to using Windows End-of-Line and End-of-File characters. iptables rejects these characters, requiring their Unix equivalents, and was thus throwing an error upon the first occurrence: the end of the *filter line -- giving the false impression that there was something wrong with the *filter syntax. Ah, the ever-present joys of character-encoding-related errors!



                      Two Solutions




                      • The commenter I mentioned above installed (sudo aptitude install tofrodos) and ran (fromdos /etc/iptables.rules) a little conversion utility on the file.


                      ---OR---




                      • What I did was, in Notepad++, Edit > EOL Conversion > UNIX Format, and then Save and re-upload the file. That took care of the End-of-Line characters, but not the End-of-File character (despite what one might expect). So once I had it uploaded to the server, I opened it up in nano and created a newline at the end of the file and saved. Then everything worked perfectly.


                      It might also be possible that merely opening the file in nano and resaving, without actually changing the characters manually, would do the trick, but I haven't tested.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Feb 28 '12 at 2:33









                      David Michael Gregg

                      1316




                      1316






















                          up vote
                          1
                          down vote













                          You can also get errors with iptables if you've installed a new version of the Kernel but you haven't rebooted yet (quite common if you're building a new server using, for example, an Ansible playbook, and an earlier task is an apt-get upgrade)



                          See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=829269#41 re: "Unknown symbol in module, or unknown parameter" error.






                          share|improve this answer

























                            up vote
                            1
                            down vote













                            You can also get errors with iptables if you've installed a new version of the Kernel but you haven't rebooted yet (quite common if you're building a new server using, for example, an Ansible playbook, and an earlier task is an apt-get upgrade)



                            See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=829269#41 re: "Unknown symbol in module, or unknown parameter" error.






                            share|improve this answer























                              up vote
                              1
                              down vote










                              up vote
                              1
                              down vote









                              You can also get errors with iptables if you've installed a new version of the Kernel but you haven't rebooted yet (quite common if you're building a new server using, for example, an Ansible playbook, and an earlier task is an apt-get upgrade)



                              See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=829269#41 re: "Unknown symbol in module, or unknown parameter" error.






                              share|improve this answer












                              You can also get errors with iptables if you've installed a new version of the Kernel but you haven't rebooted yet (quite common if you're building a new server using, for example, an Ansible playbook, and an earlier task is an apt-get upgrade)



                              See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=829269#41 re: "Unknown symbol in module, or unknown parameter" error.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered May 2 at 22:11









                              William Turrell

                              1266




                              1266






















                                  up vote
                                  0
                                  down vote













                                  it turns out that it was just a missing sudo!



                                  sudo iptables-restore < /etc/iptables.rules



                                  instead of



                                  iptables-restore < /etc/iptables.rules






                                  share|improve this answer

























                                    up vote
                                    0
                                    down vote













                                    it turns out that it was just a missing sudo!



                                    sudo iptables-restore < /etc/iptables.rules



                                    instead of



                                    iptables-restore < /etc/iptables.rules






                                    share|improve this answer























                                      up vote
                                      0
                                      down vote










                                      up vote
                                      0
                                      down vote









                                      it turns out that it was just a missing sudo!



                                      sudo iptables-restore < /etc/iptables.rules



                                      instead of



                                      iptables-restore < /etc/iptables.rules






                                      share|improve this answer












                                      it turns out that it was just a missing sudo!



                                      sudo iptables-restore < /etc/iptables.rules



                                      instead of



                                      iptables-restore < /etc/iptables.rules







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Mar 8 at 9:25









                                      Anona112

                                      614




                                      614






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Ask Ubuntu!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.





                                          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                          Please pay close attention to the following guidance:


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f28215%2fhow-can-i-fix-the-iptables-error-message-unable-to-initialize-table-filter%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          How did Captain America manage to do this?

                                          迪纳利

                                          南乌拉尔铁路局