As I wrote back in December, I switched from running Ubuntu 10.10 to Angstrom on my Beagleboard XM because I was unhappy with Ubuntu’s speed. Some of Ubuntu’s code isn’t ready for the XM’s 1 gigahertz processor, so the processor is automatically throttled back to 800 Mhz during Ubuntu’s bootup. To make matters worse, Ubuntu’s code is compiled with cross-platform compatibility in mind, and therefore lacks some optimizations that would take advantage of the XM’s more advanced OMAP processor.
I’ve been pretty happy with Angstrom – it has proven to be fast, stable and low maintenance. When Ubuntu’s Natty Narwal release arrived in April, I didn’t jump at the chance to try it. However, when I finally got around to checking it out, something in the release notes caught my eye:
OMAP3 CPUs don’t run at full speed by default. While we set the required mpurate cmdline parameter on our images, the values for the different OMAP3 CPUs are not always correct, to work around this you can edit the cmdline in /boot/boot.script and call “sudo flash-kernel”, the change will take effect on next reboot. This should only affect BeagleXM users
Ah, now you tell me! It was all a misunderstanding – just a typo in the boot parameters. Ubuntu baby, here I come. Nice knowing ya, Angstrom.
Alas, it was not to be. Ubuntu 11.04 is no faster on the XM than Ubuntu 10.10 was. The release notes actually refer to the fact that, by default, the processor is now throttled back to 600 Mhz (!), but you can change the boot parameters to lift it back to 800 Mhz.
However, Ubuntu does have some nice new features that Angstrom lacks, and I came across a couple of not-so-nice “features” that might trip up others who try out Ubuntu on the Beagleboard XM. So, here’s the full story of getting Ubuntu 11.04 up and running loping.
Preparing the Boot Image
One of the new features in Ubuntu 11.04 is that the official images from Canonical Inc. include a version intended for “headless” configurations: where you intend to use the Beagleboard as a server with no monitor or keyboard.
Unlike other Linux images for the Beagleboard, Canonical’s images automatically run an installation program the first time you boot. In Ubuntu 10.10 and earlier this install program required a physically connected monitor: now there is a text version that can be run in a serial terminal program like WinPutty.
An alternative (and the method I used when installing earlier Ubuntu releases) is Robert Nelson’s preconfigured “demo” Ubuntu image.
A short digression… If I was going to install Ubuntu 11.04 again, I would actually go with Robert Nelson’s version over Canonical’s. He updates the image quite often (and it now sports the shiny new version 3.0 Linux kernel – still no 1 Ghz support
). Canonical’s image is now a few months out of date, and the first time you update the packages to their latest version you’ll get 100s of megabytes of data that take hours (no exaggeration) to install.
If you decide to use Robert Nelson’s image, then you can skip ahead to the “Getting on the Network” section.
Canonical’s instructions for downloading their image and copying it to the microSD card are a little confusing, since you get directed to a download page that includes builds for all the processors they support.
The correct file for the Beagleboard (both XM and earlier) is this one: http://cdimage.ubuntu.com/releases/11.04/release/ubuntu-11.04-preinstalled-headless-armel+omap.img.gz. It’s a 204M file.
You’ll also need to download the updated kernel for the XM from http://people.canonical.com/~tobin/natty/beagleXM-natty.tgz
Windows users will probably need to find a way to use Linux in order to configure the microSD card. Canonical’s install instructions for their oddly-named ”Netbook” image – the one you would use if you have a monitor, mouse and keyboard connected to your Beagleboard – mentions that a Windows package like Image Writer can be used to write the .img file to the microSD card. True enough, but then you’ll have to figure out how to mount the ext3 partition on the card to transfer over the kernel patch. Personally, I used VMPlayer running the PC version of Ubuntu.
As usual, you’ll need to know what the device name of your card is before you start. Generally, the best method is to run “dmesg” immediately after connecting the microSD card to the PC – the messages at the end of the output will identify the device name. In my case, it was /dev/sde.
To copy the Ubuntu download to the microSD card:
dwatts@ubuntu:~$ sudo umount /dev/sde? dwatts@ubuntu:~$ gunzip -c ubuntu-11.04-preinstalled-headless-armel+omap.img.gz | sudo dd bs=4M of=/dev/sde 0+48794 records in 0+48794 records out 1675173888 bytes (1.7 GB) copied, 310.701 s, 5.4 MB/s dwatts@ubuntu:/mnt/hgfs/download/Beagleboard$ sync
You’ll also need to install the updated kernel for the XM, as described at the bottom of the install instructions.
The quickest way to mount the 2 partitions on the microSD card is to remove the card are reconnect it, Ubuntu – and most other OSes — will automatically mount them. Otherwise:
dwatts@ubuntu: sudo mkdir /media/boot dwatts@ubuntu: sudo mkdir /media/ubuntu dwatts@ubuntu: sudo mount –t vfat /dev/sde1 /media/boot dwatts@ubuntu: sudo mount /dev/sde2 /media/ubuntu
Then extract and copy over the 2 files. Note that the 2nd file should be copied as root
dwatts@ubuntu: tar -zxf beagleXM-natty.tgz dwatts@ubuntu: cp uImage /media/boot dwatts@ubuntu: sudo cp vmlinuz-2.6.38-8-omap /media/ubuntu/boot dwatts@ubuntu: sync dwatts@ubuntu: sudo umount /dev/sde?
Booting Ubuntu
As mentioned earlier, the first boot will automatically launch an install program. You can’t bypass it, and you can’t connect to the Beagleboard over a network until the installer completes. So, if you don’t have a monitor physically connected to the Beagleboard, you’ll need to connect a PC to its serial port.
A USB-serial adapter should work well. Mine is a generic brand that, when inserted into Windows, loads the common “Prolific” driver.
I used WinPutty as the serial terminal.
The serial settings are 115200 bps, N-8-1 with no Flow Control. In order for the pseudo-graphics in the Canonical installer to appear correctly, you’ll need to change the character set from the default of Latin-1 to UTF8, as shown below:
In its full glory, the install program looks like this. The lovely magenta background is, as far as I know, a design choice, not a bug:
The installer lets you enter the a machine name, as well as your user-ID and password. Beyond that, I selected the default on most menus.
In the screen that allows you to select software, shown above, I selected Basic Ubuntu Server, OpenSSH Server and Samba File Server. Don’t go crazy with your software selections. At this point your XM’s processor has been throttled down to an extra slow 600Mhz, so you don’t want to give the installer any more work than necessary.
Fixing the Processor Speed
After the install program runs and the Beagleboard XM is rebooted, the first thing you’ll want to do is fix the processor speed. If you look at the processor info, you’ll see
dwatts@bigdog:~$ cat /proc/cpuinfo Processor : ARMv7 Processor rev 2 (v7l) BogoMIPS : 471.61 Features : swp half thumb fastmult vfp edsp neon vfpv3 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x3 CPU part : 0xc08 CPU revision : 2 Hardware : OMAP3 Beagle Board Revision : 0020 Serial : 0000000000000000
The BogoMIPS rating, a crude performance benchmark, is actually slightly lower than I get with an original (non-XM) Beagleboard.
To fix this you’ll need to change the mpurate setting from 1000 to 800 in /boot/boot.script, as marked in bold below.
fatload mmc 0:1 0x80000000 uImage fatload mmc 0:1 0x81600000 uInitrd setenv bootargs ro elevator=noop vram=12M omapfb.mode=dvi:1280x720MR-16@60 _ mpurate=800 root=UUID=25210e81-e728-4a73-96ff-06df5c29216f fixrtc _ quiet splash console=ttyO2,115200n8 bootm 0x80000000 0x81600000
The not-terribly-user-friendly vi editor is good enough for this. Just :
- launch vi (sudo vi /boot/boot.script)
- cursor down to the beginning of the “1000″ after “mpurate=”
- press x twice to erase the 1 and the 0
- press I once to enter insert mode
- type 8
- press Esc
- Enter w
- Enter q
Crude, but effective. If you mess up, you can exit vi at any time without saving by pressing Esc and entering q!.
After updating the file, enter
dwatts@bigdog:~$ sudo flash-kernel dwatts@bigdog:~$ sudo shutdown –r now
After rebooting, the BogoMIPs score should be about 630, which is the same as with Ubuntu 10.10.
Unfortunately, based on this post by Robert Nelson in Beagleboard Google Groups, it isn’t clear when (or if) Ubuntu is going to be able to run at 1 Ghz.
Getting on the Network
The default network configuration needs to handle the Beagleboard XM’s non-standard Ethernet device name of usb0. The /etc/network/interfaces file should contain the 2 lines marked in bold below:
dwatts@bigdog:~ cat :/etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto usb0 iface usb0 inet dhcp
If they aren’t there, you’ll need to add them. If you were traumatized by using the vi editor earlier, another approach to editing the file is :
dwatts@bigdog:~ sudo –i root@bigdog:~# echo auto usb0 >> /etc/network interfaces root@bigdog:~# echo iface usb0 inet dhcp >>/etc/network interfaces
Then activate the Ethernet port:
root@bigdog:~# ifup usb0
The Beagleboard XM’s Ethernet adapter uses a dynamic MAC address, so if you are using DHCP to assign the IP address (as the above configuration will do), the IP address will change each time it’s rebooted. This can be rather frustrating if your Beagleboard is going to be used as a server. You can change this by using the same settings as explained in my blog post about Angstrom– the interface file in Ubuntu has the same format as in Angstrom. (A more advanced solution to the problem, which I haven’t tried, is to patch the kernel so that the same MAC address is used each time: see this post on the Electrons on Radio blog).
Updating Ubuntu
Now you get an opportunity to fully and completely appreciate how slowly the Ubuntu package updater runs on the Beagleboard XM. You’ll need to download and install a few month’s (or more) worth of Ubuntu updates.
root@bigdog:~# aptitude update root@bigdog:~#: aptidude upgrade
Unless you’re practicing to be a Buddhist monk, you’ll probably not want to sit and watch aptitude crawl along for the next couple of hours.
Speed issues aside, Ubuntu’s package installer software works the same on the Beagleboard as it does on a full PC. Here are some of the more useful options (though you might end up using Webmin rather than the command line for this — see the Webmin section below):
To list the packages that are currently installed:
root@bigdog:~#: dpkg --get-selections
To find a package based on text in its name or description:
root@bigdog:~#: aptitude search <text>
To get more info on a specific package
root@bigdog:~#: aptitude show <packagename>
Updating the Date and Time
If you enter the ”date” command you’ll likely find that the date is correct, but the time is off by a few hours or more. Ubuntu has already installed the NTP software needed to automatically set the time, but it needs to know where you live:
To display the current timezone:
root@bigdog:~#: cat /etc/timezone America/North_Dakota/Center
To change the timezone
root@bigdog:~#: dpkg-reconfigure tzdata
You’ll then see a pop-up dialog to guide you through the process.
WebMin
After going through the indignity of manually hobbling your processor, then watching it take a couple of hours to slog through the software updates, you might be wondering why any sane person would choose Ubuntu over Angstrom. Here’s why: Webmin!
WebMin is the tops. It’s the thing. All the girls get up when it sings (yeah).
And Angstrom doesn’t have it.
Installing WebMin isn’t as easy as “aptitude install webmin”, but trust me: it’s worth it. Full instructions are here: http://www.webmin.com/deb.html, but you should need just 2 or 3 commands:
root@bigdog:~#: wget http://www.webmin.com/download/deb/webmin-current.deb root@bigdog:~#: dpkg –install webmin-current.deb
Unless you’ve installed a bunch of Perl-specific packages, you’ll get a bunch of errors due to missing dependencies. It looks messy, but it’s actually quite simple to fix:
root@bigdog:~#: aptitude install perl libnet-ssleay-perl openssl _ libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python
Don’t worry if not all of those packages are missing. Ubuntu’s updater might be slow, but it’s no dummy. Not only will it sort out what’s needed, but it will automatically install webmin for you once all of the missing packages are there.
Once it’s installed, you can load Webmin in a brower from any PC at:
Note that Webmin will want to use secure protocol (https) by default, and your browser will mutter about missing security certificates as a result. You can turn off the requirement for a secure connection within Webmin later.
Ordinarily, you should be able to login to Webmin using your own user-ID. I couldn’t – no idea why, but something went wrong. I had to login as root.
Wait, what? Login as root? Impossible, you say! Ubuntu won’t allow it.
Bah, Ubuntu and what army? You just have to set a root password manually first:
root@bigdog:~# passwd root Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
If you want to prevent Webmin from requiring an https connection, click the Webmin link in the upper left of the main Webmin menu, then Webmin Configuration, then SSL Encryption. “Change the Enable SSL if available” setting to No:
Among the many Linux system administration tasks that Webmin makes a lot easier are:
1. Updating Ubuntu packages. (Easier, but sadly not faster.)
2. Viewing System Logs
3. Reading documentation and help files for packages. Note that Webmin goes beyond man pages and puts together a list of all the documentation installed with the package.
4. Mounting drives, include shared folders on Windows PCs (after you’ve installed Samba and configured, as described below). It will also handle updating fstab so that the drive is automatically mounted when the system is booted.
5. File management. Tucked away under the “Others” section of the left-hand menu is a Java-based File Manager.
6. Software configuration. The Servers menu in the lefthand pane contains custom modules for configuration some common software packages, such as SSH and Samba.
SSH
If you selected OpenSSH from the Ubuntu installer’s software menu, then the SSH is already up and running. Otherwise, you can install it with:
root@bigdog~#: aptitude install openssh-server
Alternatively, you can use Webmin to locate and install a package, using the “Software Packages” menu:
The default settings will allow you to login using your Ubuntu user-ID and password. The SSH server also supports file transfer using an SCP package like WinSCP.
If you intend to access your Beagleboard through the Internet, then you’ll probably want to replace password authentication with public key authentication. To enable this:
1. Upload your public key to a file named ~/.ssh/authenticated_keys – you’ll probably have to create the ~/.ssh folder first. You can use WinSCP to copy the file over, or WebMin’s file manager, which includes Edit and Upload functions.
2. Test that you can now login using your public key, rather than entering a password. In WinPutty, you specify the location of your private key here:
3. In Webmin, select Servers in the lefthand pane, then select SSH Server. Set “Allow authentication by password” to No. While you are there, set “Allow login by root” to No as a security precaution. Return to the main SSH Server menu and click the Apply Changes button, which will restart the SSH server.
Incidentally, the SSH server’s default configuration will allow client-to-server port forwarding. This allows you to access the web server and WebMin from a remote PC after connecting through SSH. For example, the following settings in WinPutty allow you to connect with SSH and then securely access Webmin through a browser as http://localhost:10000.
Samba
If you didn’t select “Samba File Server” from the Ubuntu installer’s software menu, then you can install it using Webmin or by running
root@bigdog:~# aptitude install samba
Users are automatically added as Samba users, but their passwords aren’t.
You can configure Samba through Webmin by selecting Samba Windows File Sharing under the Servers menu. You need to click on “Edit Samba Users and Passwords”, then select “New password” and type in your password. This is the password that Windows PCs will need to supply in order to access your Samba shares.
To share a folder, click on “Create a new file share”. Fill in the “Share name” and “Directory to share”. If the directory already exists, set “Automatically create directory” to No.
By default, shares are read only. To change that, click on the share name at the top of the window, then click on Security And Access Control. Change “Writeable” to yes.
At the bottom of the window is a button to restart Samba and apply changes right away, but generally changes are automatically loaded by Samba without restarting.
Wrapping Up
Aside from Webmin, Ubuntu offers a few other advantages over Angstrom that you might want to consider:
- Its VNC server is much easier to configure than Angstrom’s.
- If you are running VNC, or physically connected with a monitor, keyboard and mouse, Ubuntu offers some shiny new window managers that aren’t available on Angstrom, such as GNOME 3 and Ubuntu’s own Unity2D desktop.
- The Google Chrome browser (with support for extensions) and Arduino IDE (running on Java) are among the applications that Ubuntu offers, and which aren’t available as packages for Angstrom.
However, if you try running software like GNOME 3 and Chrome, you’ll find that they just serve to emphasize Ubuntu’s biggest weakness: they are just too slow to be usable for most tasks.
Ubuntu is, in my opinion, a solid choice for the Beagleboard XM when used as a server. Background processes like Samba, the CUPS print server, and lighttpd web server run well – I haven’t noticed any response time annoyances there. When combined with Webmin (which is also quite fast), it’s a relatively user friendly way to learn the basics of Linux system administration.
But, when you have the need for speed, Angstrom is still way ahead of the pack.




















































