Monday, September 09, 2013

CentOS 6.3 - Module ipv6 not found


If you accidentally messed up your Linux server kernel (like me) and got the following message during the system booting:

iptables: Applying firewall rules: FATAL: Module ip_tables not found.
iptables-restore v1.4.7: iptables-restore: unable to initialize table 'filter'
Error occurred at line: 2
Try `iptables-restore -h' or 'iptables-restore --help' for more information.
                                                           [FAILED]
FATAL: Module ipv6 not found.
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Device eth0 does not seem to be present, delaying initialization.
                                                           [FAILED]
FATAL: Module ipv6 not found.

You can fix it by either disable ipv6 module or reinstall your Linux server kernel.

To disable ipv6:
1. Check if the module is loaded:
If you are getting "Module ipv6 not found" error message, you already know that ipv6 module is not loaded, but just to be safe:
# lsmod | grep ipv6


2. Disable ipv6:
You can prevent a module from being inserted into the kernel by either blacklisting it or by completely disabling it. The way blacklist works is blacklist indicates that a module’s aliases should be ignored.

To blacklist the module, simply save the following line in a file inside /etc/modprobe.d/blacklist.conf
blacklist ipv6

But if there is an application requires to load ipv6, ipv6 will still be loaded even it is in the blacklist.

3. Completely disable the ipv6 module:
To completely disable IPv6 in your system, all you have to do is save the following line in a file inside /etc/modprobe.d/.
install ipv6 /bin/true

The above line means: whenever the system needs to load the ipv6 kernel module, it is forced to execute the command true instead of actually loading the module. Since /bin/true, does absolutely nothing, the module never gets loaded.
Again, it is required to reboot for the changes to take effect.

4. Other Configuration Tasks:
Since the IPv6 functionality has been disabled, you can disable the ip6tables service (IPv6 Firewall). Issue the following command as root:

# chkconfig ip6tables off


It is also a good idea, since the ip6tables service has been turned off, to disable any IPv6-related functionality in the network interface configuration. Even if you do not do this, the IPv6 stack will not be initialized because the ipv6 module cannot be loaded. But, generally, you could set the following options to “no” inside your network interface scripts, for example: /etc/sysconfig/network-scripts/ifcfg-eth0

IPV6INIT=no
IPV6_AUTOCONF=no

Finally, In fedora 8 or newer you can safely remove the following option from the /etc/sysconfig/network file, if it exists:
NETWORKING_IPV6=no

By implementing the above steps, you disabled ipv6 module in your kernel. Do a system reboot and see if you can have your eth0 up.

But disable ipv6 module din't solove my problem, in the boot.log, I still see errors:
Bringing up interface eth0:  Device eth0 does not seem to be present, delaying initialization.

                                                                  [FAILED]
At this point, probably it is better to just reinstall the whole kernel instead of figuring out why we can't bring up eth0 (maybe the kernel itself is damaged, or some other modules are missing, reinstall your kernel it probably the quickest way). Since I only have loopback interface up, I don't have the internet, so I had to use a lower version of installed kernel in order to get internet access:

1. Check the current kernel version:
kernel-2.6.32-279.5.2.el6.x86_64
2. Check all installed kernels:
# rpm -qa | grep "kernel" | sort
dracut-kernel-004-284.el6_3.noarch
kernel-2.6.32-220.13.1.el6.x86_64
kernel-2.6.32-220.el6.x86_64
kernel-2.6.32-279.5.2.el6.x86_64
kernel-firmware-2.6.32-279.5.2.el6.noarch
kernel-headers-2.6.32-279.5.2.el6.x86_64

So I can use kernel-2.6.32-220.el6.x86_64 or kernel-2.6.32-220.13.1.el6.x86_64.

3. Boot into different kernel:
# reboot

In grub boot interface, choose kernel-2.6.32-220.13.1.el6.x86_64, if you don't see the boot menu, probably you have "hidemenu" in your /boot/grub/grub.conf file, comment it out.

4. The "eth0" error message is gone after kernel switching, now I have my eth0 interface up and running.
# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 1C:6F:65:4F:54:6B 
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::1e6f:65ff:fe4f:546b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2910 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2708 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2005944 (1.9 MiB)  TX bytes:364993 (356.4 KiB)
          Interrupt:26 Base address:0xe000


5. Now we reinstall the broken kernel "2.6.32-220.13.1.el6.x86_64"
# yum remove kernel-2.6.32-279.5.2.el6.x86_64

Confirm that kernel is actually removed:
# rpm -qa | grep "kernel" | sort
dracut-kernel-004-284.el6_3.noarch
kernel-2.6.32-220.13.1.el6.x86_64
kernel-2.6.32-220.el6.x86_64
kernel-firmware-2.6.32-279.5.2.el6.noarch
kernel-headers-2.6.32-279.5.2.el6.x86_64

Install it again:
# yum install kernel-2.6.32-279.5.2.el6.x86_64


Or you can take this chance to upgrade your kernel, download the latest kernel from: http://mirror.centos.org/centos/6/updates/x86_64/Packages/
# rpm -i kernel-2.6.32-358.18.1.el6.x86_64.rpm


Now reboot and choose the lastest kernel.

No comments: