Mittwoch, 5. Dezember 2012

If you are having trouble with the network interface on your CuBox (running openSUSE)

This blog post is a slight deviation from the main series that I'm doing on running openSUSE on CuBox as it relates to a very small (but very important) area - the network interface. If you've been following the posts I've been doing and maybe also the opensuse-arm@opensuse.org mailing list, you'll have seen that I was having issues with how the network interface doesn't come up after each reboot.

The CuBox network interface hardware has a so-called 'hardware address' - also called 'MAC address'. When openSUSE boots, it looks for network hardware with a MAC address that it recognises. For example, if openSUSE has already set up MAC address 00:50:4B:B7:1B:23 as eth0 with static IP 192.168.178.20 etc, as soon as that MAC address is seen when booting, the same network interface - eth0 - can be set up with those settings.

The problem actually occurred before openSUSE even booted - during the uboot stage. If you enter the uboot commandline interface (by pressing any key quickly when watching the CuBox start over a serial connection) you will see when you enter the printenv command that the CuBox saves some network relevant data to its own flash (i.e. permanently saves). One of the key value pairs that the CuBox saves is ethaddr. If there is a problem with the key value pair stored (e.g. uboot detects a bad signature in the flash etc), a new random MAC is generated and assigned to the hardware before control is handed over to openSUSE. That means that openSUSE will not recognise the network hardware as it has a different MAC address. This then means that the network interface will not be brought up. You will need to go through YaST -> Network Devices to setup a "new" interface. This will probably be eth1 (or ethn+1 where n is the number of the interface before your last reboot - I was on eth5 before I went to work on the problem).

The solution is to enter uboot and to save the current environment. Before reboot, check what the value of the MAC address of the the hardware is (ifconfig will help). After a reboot, press the infamous 'any' key quickly to enter the commandline interface. Then check what value is stored as ethaddr using the commant printenv ethaddr. It should be the same as the one that ifconfig showed. If not, fix it with setenv ethaddr <MAC address that ifconfig showed>. In my example above, that would be setenv ethaddr 00:50:4B:B7:1B:23. If you want you can also change the ip address with setenv ipaddr <whatever ip you want>. Check the rest of the output of printenv to see if you'll need to change anything else as well. Next, the really important command is: saveenv - that will unprotect the CuBox flash, write the relevant key value pairs and then reprotect the flash.

The result of the above should be that openSUSE will now recognise the MAC address of the hardware again - meaning that it will be able to setup the network interface automatically at boot time - saving you the bother of needing to reattach the serial cable to do it through YaST.

Have fun!

Keine Kommentare: