Ubuntu on OLPC XO

Since we received our OLPC, I’ve had the overwhelming urge to install Xubuntu on it. Xubuntu is not the lightest desktop out there, but the XO seems to play nice with XFCE ontop of the RedHat based OS that comes it, so instead of full-blown Xubuntu, I installed Ubuntu (CLI from net-install) with slimmed XFCE ontop. Ubuntu offers all the software I like to use and <troll>Debian Packages are just SO much more sophisticated than RPMS</troll>! Anyways, here’s how I did it from Ubuntu on my other laptop using QEmu to install from a netboot ISO to disk image to flash drive (or SD card). Basically we are installing Ubuntu to a virtual file, and replacing the kernel and modules with those from the OLPC. It’s a dirty kind of hack (we should really compile the kernel and modules and package it as a .deb, no?) Please let me know if I forgot anything!

EDIT: Please visit the official OLPC wiki page for this guide

Read on for instruction..

DISCLAIMER

I take no responsibility for trashing your flash drive, XO or your relationship with your S.O.

REQUIREMENTS

For this to work you will need to have a dev key for your OLPC!

You should be comfortable messing with Ubuntu at the commandline level.

If you are in a Ubuntu or GNU/Linux User Group, you will have the best experience ;-)

You will also need an SD card or USB flash drive of at least 2GB (1GB might work, it might be a very tight fit if you want a GUI plus apps)

PLEASE ask questions using the comments area below, I am officially discouraging you from asking me questions about this tutorial in iRC ;-)

QEmu and Net-Install

You probably don’t like to download a whole CD only to have to spend another hour waiting for updates to download after install. Get the mini.iso for Gutsy instead:

archive.ubuntu.com mini.iso

You will need QEmu to boot this ISO and also make sure it is set up for networking.

Assuming you are using Ubuntu to create your boot flash, install qemu

$ sudo apt-get install qemu qemu-launcher qemuctl

if you are using gutsy you may need to use a newer qemu bochs firmware to work properly.

Get it HERE

$ sudo dpkg -i bochsbios_2.3.5-1ubuntu1_all.deb

BOOT FROM MINI.ISO IMAGE AND INSTALL UBUNTU

Start qemu-launcher and set the boot from CD option
qemu launcher screen
Disable snapshot mode

The CD is the mini.iso image file

Create a RAW disk image (of at least 1.5 GB) and make that the first hard disk in qemu-launcher

In the network tab have one card (Card0) with User Mode Networking, remove any redirects, IP address for the VM as 10.0.2.15 and use the MAC address of the network card that is currently connected to the internet (make sure letters are lower case!). You can get the MAC address from running ifconfig

When QEmu boots the ISO you will see an Ubuntu grub splash and the option to install a CLI system.

You will then go through the text based Ubuntu install. It should find QEmu’s virtual network card and configure it. If not you will have to stop here, go back and fix QEmus networking.

Partition the the image manualy with just one large partition as ext2 filesystem, mountpoint as ” / ” and set the noatime flag set the bootable option as well. The label should be OLPCRoot (just for the sake of convention) Ignore the suggestion for swap as it will only eat the flash card.

netboot install will get all of the latest packages from the repository and install a complete x86 based OS (minus a gui)

BOOT FROM IMAGE IN QEMU

You will need to start QEmu again and boot from the new RAW image you just installed to so that you can install whatever else you need…

Start qemu-launcher and remove the mini.iso from the list. Set the boot option to your newly installed raw image. Be sure your networking is set as well.

Boot Ubuntu (ignore the ATA errors (its a harmless bug, really!) Install sysvinit. This is necessary because upstart will not work for us in the XO. (you would get a boot-stopping error message sortly after the kernel boots on the XO)

Thanks to Jeff Waugh for the tip:

< jdub> freelikegnu: upstart doesn’t like not being pid 1

$ sudo apt-get install sysvinit

if you want xorg and xfce4, now is a good time…

$ sudo apt-get install xfce4 xserver-xorg xfonts-base xfce4-terminal firefox

That will install a minimal XFCE desktop and firefox for the web. If you like gdm and don’t mind dependencies add it to the list above, otherwise you can use the command startxfce4 to get your GUI

you can search for all the tasty XFCE related packages with

$ apt-cache search xfce | more

EDIT: NOT RECOMENDED!! If you really want a full Xubuntu install (and have at least 4GB flash)…

$ sudo apt-get install xubuntu-desktop

note: even if you do full xubuntu, you will lose the nice usplash graphics with the OLPC’s kernel

There are other, more lightweight Desktop Environments like Fluxbox, but my heart is for the little mouse of the desert…

also be aware that some things you may be used to in ubuntu like fusefs may not work. Also you will not have accelerated 3D (or even very fast 2D) so avoid apps that need OpenGL. Audio, wireless and webcam seem to be functional enough tho.

once everything is setup and your qemu install of ubuntu is happy, shut it down

$ sudo halt

you can safely shutdown QEmu once the system is halted.

read on to setup the SD/USB flash…

Pages: 1 2

Tags: , ,

12 Responses to “Ubuntu on OLPC XO”

  1. isforinsects says:

    Excellent. I will post something about this at my http://www.whyxo.com site. Spread the word of Ubuntu!

  2. nealmcb says:

    Excellent! Thank you!

    But you should not run apt-cache with sudo – it doesn’t need it.

  3. francisco says:

    Thanks for catching that nealmcb! I’ll make the change.

  4. moocapiean says:

    When creating the image, wouldn’t it make more sense to call it OLPCRoot instead of OLPCBoot? That’d save people the trouble of having to run tune2fs after they copy the image to their flash drive.

    Or was that just a typo?

    Anyway, thanks for the instructions!

  5. francisco says:

    It was indeed a typo, thanks for the catch!

  6. [...] Ubuntu running on on my XO! Using the excellent directions at http://www.freelikegnu.org/?p=21#more-21 as a guideline, I installed a very minimal Ubuntu on a USB thumbdrive and booted it on my XO. Then [...]

  7. Sprak says:

    Hi!

    Great guide! Just one question:
    “”"Partition the the image manualy with just one large partition as ext2 filesystem, mountpoint as ” / ” and…”"”

    Would it be possible to use JFFS2 (or any other flashbased filesystem) instead of ext2?

  8. [...] days, I get Ubuntu to boot based on the hard work of fellow community members. I also post an indepth tutorial on my own [...]

  9. OLPC Help: How to Install Ubuntu on the XO Laptop!…

    Back on New Year’s Eve, I was talking with Bryan Berry of OLE Nepal about different operating systems on the XO for governments who wanted options outside of Sugar. In the middle of a rant against XP on the XO, I wondered if we could have a FOSS OS …

  10. nealmcb says:

    I would think this simpler debootstrap-based method would work with Ubuntu – anyone tried it? http://wiki.laptop.org/go/Installing_Debian_as_an_upgrade

  11. P3t3r says:

    Hi, I tried your great guide and I managed to get a working image. However, somehow I fail at moving the image to the USB.

    When I type
    sudo dd if=/home/peter/Desktop/tetten of=/dev/sdb1 bs=1M
    then the USB starts writing for about half an hour. After half an hour, it seems done. Then I type sudo sync, as instructed, and then remove the USB disk.

    However, when plugging it in, ubuntu fails to mount it. Looking in Windows I get the error that the disk is not even formatted. And the OLPC doesn’t want to mount it either.

    Any idea what I could have done wrong? Or what I should try? As far as I can see, I followed the guide litterally…

    Thanks!

  12. P3t3r says:

    Never mind, solved already.

    In case someone has the same problem later: I had to use /dev/sdb instead of /dev/sdb1.

    By the way, ubuntu loads well, but is it normal that I don’t have a GUI? XFCE fails to start, it says no screens found… :-/

Leave a Reply