Duct Tape – Unix Style

ducttape x

So this fix is going into the Beta3 image, which is being made and uploaded overnight tonight… I’m going to delete the old betas once its up as they just give you a soft fuzzy brick without a serial console to clean up the boo-boo.

So I wrote a script that runs during shutdown or reboot of the system, and clears the contents of the following file…


That will force the system during the next start-up to re-add the Ethernet adapter each time so if a SD card moves to another Sheeva, or someone images an SD card it’ll work anywhere, assuming they image AFTER shutting down. YES that’s right, if you don’t cleanly shutdown a system (or the host hardware blows up) – and then you move the SD card, you’ll have to reboot the system again to ‘clean’ it up – hence the serial console. Rare but can happen, I know it sucks hence why its duct tape..not pretty.

So whats the ‘clean way’ of fixing this?

That file is generated by udev which handles things like detecting devices and other wonders of science *cough*. Dear udev can be built to store things non-persistently, which is the preferred way to use it in a embedded environments such as the Sheeva and its ability to be moved between boards. I don’t have the time to explore this in great detail, but would love for someone else to take charge(Hey, I’m married, Kids and all… heh) It should be as easy as a mount point change and a config switch prior to compiling udev perhaps?

Beta1 and Beta2, get nuked. They violate the first rule of ease of us – it makes a brick.

I can’t nuke this file during start-up as the system is in read only mode then, and I didn’t feel like messing around with it anymore tonight. If anyone has a cleaner hack I’d love to hear it!

So What Exactly Did I do?

Want to be able to fix your own without having to re-flash and download? Don’t blame ya. Here is what I did after playing around with a few tricks…

Follow these steps below from a serial or ssh session on your system…

cd /etc/init.d

Using your favorite text editor (nano or vi perhaps?) make this file and save it

#!/bin/sh -e
# Clear old the existing eth0 binding to internal NIC on Sheeva
# This allows the SD card to be used in another host on reboot

echo "Resetting UDEV Ethernet Settings to Empty..."
echo -n > /etc/udev/rules.d/70-persistent-net.rules
exit 0

Make sure it has these permissions… (OR just copy an existing init script, and rename if you are lazy alternately to have the right permissions – its what I did heheh)

-rwxr-xr-x 1 root root   resetpersistentnic

Finally Lets make it run during shutdown and reboots. I named the script resetpersistentnic ’cause I’m a jerk 

cd /etc/rc0.d
ln -s ../init.d/resetpersistentnic K03resetpersistentnic
cd /etc/rc6.d
ln -s ../init.d/resetpersistentnic K03resetpersistentnic

That’s it!

You’ll know it works when you see this on the serial console during shutdown… (red text below to stand out)

Stopping NTP server: ntpd.
Stopping Postfix Mail Transport Agent: postfix.
Stopping Samba daemons: nmbd smbd.
Stopping MySQL database server: mysqld
mpg123: no process found
Resetting UDEV Ethernet Settings to Empty...
Close Menu