HP Microserver – NIC Problems

James Young · November 8, 2011

I came across a peculiar bug with my CentOS build, which apparently also happens with Fedora, RHEL and Debian, but mysteriously didn’t happen with my Ubuntu install.

In short, sometimes when I reboot, my network card starts up, but doesn’t pass packets.  Grepping dmesg shows “ADDRCONF(NETDEV_UP): eth0: link is not ready”, which never gets followed up with a ready.  Doing a service network restart usually solves the problem, but that’s no good for something that’s remote control only.

The solution (for now), appears to be to add the following into a new file in /etc/modprobe.d/tg3.conf;

install tg3 /sbin/modprobe broadcom; /sbin/modprobe –ignore-install tg3
remove broadcom /sbin/modprobe -r tg3; /sbin/modprobe –ignore-remove -r broadcom

It appears that the force install of the broadcom driver does “something” that allows the tg3 driver to actually work properly.  After doing this, I’ve rebooted my Microserver a few times and it’s come up fine each time.  dmesg results for the tg3 driver now look a lot more normal.

Edit 9th May 2012:  Turns out that this fix didn’t actually fully resolve the problem for me.  But what has resolved the problem entirely is putting the following script into /etc/rc.local so it gets run after boot;

#!/bin/bash
# Restarts NIC if the link did not come up properly</p>

function testnic()
{
        local result=`dmesg | grep ADDRCONF | tail -1 | grep "link becomes ready"`
        if [ "$result" != "" ]; then
                # echo NIC is available
                testnic=0
        else
                #echo NIC is unavailable
                testnic=1
        fi
}</span>


for i in {1..5}; do
        testnic
        if [ "$testnic" = "0" ]; then
                echo NIC is available.  Exiting.
                break
        else
                echo NIC is unavailable.  Restarting.
                /sbin/ifdown eth0
                /sbin/ifup eth0

                /bin/sleep 3
        fi
done</p>

exit $testnic</span>

</blockquote>

The above solution is horribly rough and I hate it, but it does the job.  It basically just tries restarting eth0 up to five times if it doesn't report as up.

Twitter, Facebook