Thursday, September 18, 2008

Getting the most out of Atom with Ubuntu - upgrading it the right binary architecture

From most howtos I find it appears that people tend to run i386 Ubuntu (if they run Ubuntu) on their Atom devices. I may have stopped using Gentoo because it was too much work, but I'd still like to get my Atom box faster - without going as far as compiling the whole environment myself.

For ages I've heard people go on about how cool it is to bootstrap e.g. Xen hosts or do interesting things in chroot environments on Debian and Ubuntu. Not having worked with or even played with Xen I at least finaly get to play chroot games.

The scenario is that I have:

  • A rather freshly installed PPC machine with faulty memory. I put quite a lot of hours into installing and configuring all the software: Apache, postfix with tweaks, courier, squirrelmail, squarecircle web mail, a caldav server using postgresql, lots of stuff. Hours. If I could transfer the disk image from the PPC machine to the Atom machine and replace the PPC binaries and libraries with ditto Atom ones, then the new machine will work exactly like the old one without any further configuration.
  • A new Atom machine up and networked with a Live CD (or Live SD as the case may be). This new machine is LPIA architecture (Low Power Intel Architecture), e.g. Atom. The Live CD has the machine up on the network and it has the address The new filesystems are mounted under /mnt.
All this will apply equally for a transfer from i386 to Atom, or PPC to Atom for that matter.

Before you start. This is not a "supported" upgrade procedure. If you break your computer and can't fix it again you get to keep both parts. Proceed only if you accept this.

To prepare on the PPC I installed and ran debfoster, a program that can enforce your package choices. It will throw out the programs you don't want and install those you want that are missing. It keeps a file called keepers to account for these. After running debfoster I know all the packages I need to install - everything will follow these. Make a backup copy of it called keepers-keep.

Then I transfer the old machine to the new one by running this as root on the old machine:

  rsync -avHx --numeric-ids --progress --delete \
  -e ssh / root@

The first thing you should know about this command is that it can wipe out whole systems if you type the command a bit wrong. By all means, be careful, and read the whole man page unless you're already familiar with rsync.
This command can be repeated later if mistakes are made on the new machine.

Now the machine is transferred, but the PPC binaries won't run on either i386 or lpia. The executable disk contents have to be reinstalled with packages that are the correct binary architecture.

Here is a little transcript:

# from another architecture causes problems
rm /mnt/etc/
# That this is missing distresses dpkg no end

touch /mnt/var/run/motd
# Old dpkg database can be tricky
mv /mnt/var/lib/dpkg /mnt/var/lib/dpkg.old
mkdir /mnt/var/lib/dpkg
# And so we go!

debootstrap --arch lpia hardy /mnt

That was the easy bit. Now to fix some things, and install the rest of the packages we used to have:

# Some fixes
mount -o bind /dev /mnt/dev
mount -o bind /sys /mnt/sys
mount -o bind /proc /mnt/proc
LC_ALL=C chroot /mnt bash
ln -sf mawk /usr/bin/awk
apt-get -f install
cat >/etc/apt/sources.list <EOF

deb hardy main restricted universe multiverse
deb-src hardy main restricted universe multiverse

deb hardy-updates main restricted universe multiverse
deb-src hardy-updates main restricted universe multiverse

deb hardy-backports main restricted universe multiverse
deb-src hardy-backports main restricted universe multiverse

deb hardy-security main restricted universe multiverse
deb-src hardy-security main restricted universe multiverse

apt-get update
apt-get install localepurge
for f in $(cat /var/lib/debfoster/keepers); do
apt-get --yes install $f

Now check that grub, linux-image and such boot-time necessities are installed, and install the boot loader in MBR and get it configured:

grub-install /dev/sda

If it complains about not being able to figure out your BIOS devices you may want to create /boot/grub/ with these contents:

(hd0) /dev/sda
(hd1) /dev/sdb

At this time it might boot if you try. My next problem was that udev had taken away eth0 and named it eth2. On a Debian(Ubuntu machine the file that decides what the interface name is is named /etc/udev/rules.d/70-persistent-net.rules. You can edit that file. You may find that the two first lines are some sample stuff ending in NAME="eth0" and NAME="eth1" and that your ethernet device is at the end and named eth2. Remove the two first lines, change the NAME to eth0 for the correct last line. Then reboot again. Now the ethernet should be at eth0 and you can configure it with NetworkManager or in /etc/network/interfaces or whatever.

And now it should be working. If you want the wireless to work follow the usual instructions.

SD-cards reach their true potential

SD cards used to be toys used with small cameras and mp3 players that are too easy to loose between the sofa coushins (much less MicroSD!)

Then I got an Acer Aspire One with 120Gb harddisk. Along with the harddisk comes Windows Home Edition. Let it install so I can see if the machine works. It works. Amazing what the chinese can manage for such a nice price. The whole "small portable PC sold very cheaply" concept works for me. The largest problem in the picture is the teeny weeny small screen.

Now, how to get Linux (Ubuntu 8.04.1 which supports the Atom architecture) on it? No CD/DVD-drive in the beast, and I have no USB-CD/DVD drives. I do have some spare SD cards though.

Turns out that I can download a Live CD ISO image (the Ubuntu desktop CD is also a live CD), and the very nifty UNetbootin and get a Live SD card to boot live environment or install from. Then I need a memory card reader for the SD card since the AAO (apparently) can't boot from any of its builtin SD card slots (why is that?). Then you can persue the AAO documentation in the Ubuntu Wiki to get the OS installed and all the different bits working.

Didn't even have to waste a CDR.

And, somewhat to my amazement (not having read everything about it beforehand...) the Atom CPU is hyperthreaded too, almost as good as two cores.

Let me (once again) state the obvious: Something is afoot here. It's cheap and good.

Now to get the install "transmigrated" to "lpia" which is the formal architecture name for the Atom boxes. There are lpia repositories at, and i386 and lpia are binary compatible. I also have some other Ubuntu boxes where I can debotstrap a disk image that I can transfer. Will probably post about that later.

Thursday, September 11, 2008

Travel by SMS

I've recently traveled some between Oslo and Copenhagen for work. Whatever company I fly the tickets will be electronic, and I can check in using machines and my credit card or a printed paper with a barcode or somesuch. This is cool.

But when I fly SAS ("Scandinavian Airlines System" originaly, not "Special Air Service", the British special forces) I can check in by SMS, no need to get on the Internet or visit a machine. Even cooler.

Now all I have to navigate is the security line. If I fly SAS. If only they weren't so expensive.