Mine the Harvest

Lint Mint 6 XFCE on OLPC

by on Jul.14, 2009, under IT Adventures, Linux, Netbooks

A while back when Linux Mint 6 XFCE (based on Ubunut Intrepid) was released and reviewed on The Linux Action Show I thought of what a good platform it could be for the OLPC. (The Linux Action show is a great pod cast by the way!) I had previously installed Ubuntu Hardy on the OLPC, but the extras the Linux Mint guys added to XFCE sounded pretty cool. Especially considering I am thinking of giving the OLPC away to someone who is a newer Linux user, having Mint as the OS was pretty appealing. And oh, my old Hardy install was utterly nuked on the SD card anyway – who knows. I might have tried to recover the partition tables with TestDisk, etc. but really – who cares. Time for a new OLPC adventure anyway!

In fact I had hardly touched my OLPC in nearly a year, since buying my Acer Aspire One – which I really love. And although the Aspire One is obviously far better performance wise, there are certain characteristics of the OLPC that I really like, such as:

Monochrome Screen Mode: This is absolutely awesome. The screen back light turns completely off saving big time power. Sunlight goes through the LCD and is reflected off a panel, making the screen extremely readable in direct sunlight. It is really fantastic and I wish ALL netbooks had this feature. It is hard to describe how legible it is, even in harsh direct light.

Battery Life: Especially when running in monochrome mode, battery life is quite good.

Mesh Networking: Interesting stuff – and oh, the wireless net supports injection. Hacking opportunities for kids the world round.

Case Design: Everything folds up to protect ports. Integrated carrying handle.

Open Firmware: Yea, it’s kind of different and fun to play with. Similar to the Open Firmware in the pre-Intel Macs, but far more fun than that was. Since we will be seeing a lot more systems using Open Firmware in the future it is good to play with it now. By by BIOS – you served us well.

Philosophy: Providing technology that would otherwise be unavailable to kids in remote places does not at all seem like a bad idea to me.

HAM Radio: I am thinking the OLPC, with the above features, seems a perfect candidate to use with packet radio. Communicate with friends after the coming apocalypse. Run it for years, and never worry about the back light burning out – you don’t need it.

(As a note: It was great seeing a few people recently at Toorcamp with their OLPCs – I saw two or three there, as well as two OLPC billboards on the trip to Seattle.)

Okay – enough extolling the OLPC virtues. How to install Linux Mint on it.

How to Install Linux Mint 6 XFCE on the OLPC

0) Pre-install Steps

0) First off, you do not need to go through exotic hoops to get this to work. Some guys have had success installing Mint onto an SD card first and then installing Hardy over the top of it and ended up with a working Mint install. Using the following method you can simply install Mint and it should work fine. (If you do want to install a vanilla Hardy, I would highly recommend using this method using compressed files instead.)

00) I suggest you update the OLPC firmware and Fedora base OS before installing Mint. Simply connecting to a wireless network and running #olpc-update as root will download all updates and update the firmware as well. (Have it pluged into AC or the firmware upgrade will be skipped.) BE PATIENT – the upgrade rsyncs several hundred megs over your wireless connection. It takes a very long time.

1) Install Linux Mint from .iso to SD Card

Using another system (I used my Aspire One) perform a normal install of Linux Mint 6 XFCE to the target SD card. In my case I hooked up a USB CD rom, downloaded the Mint .iso and simply booted it on my notebook. It detected the SD card fine and I had no trouble installing to it.

* Although normally on netbooks you don’t really need a swap space, you may want to consider it on the OLPC due to its extremely low memory. If using a 4GB or more SD card, you can likely spare a bit of room anyway.

*  Under Advanced Options: Take care you do not accidentally install Grub over your existing Grub on your system. You can install grub on the SD card if you like, but it is not needed as open firmware on the OLPC will handle the boot process. (But if you think you might want to boot to the SD card on another netbook, then go ahead and install grub to it. )

* Aspire One Users: Even if you install grub to the SD, you will not be able to boot to it. Asus, for reasons only know to God and the wind devils, did not provide a BIOS capable of booting to SD cards. Insane, I know. While you could work around this by placing the kernel and initrd on the internal SSD drive and simply pointing root in grub to the UUID of the SD card – which will work fine and load the kernel, you will not be able to activate the root file system. Reason: The kernel and initrd Mint ships with do not have the drivers for the SD / mmcblk devices, and thus booting halts at that point. If you wanted to be ambitious you could create a new initrd that has the required driver (its pretty easy in Virtual box to do so), but this guide is for installing Mint on the OLPC and such is not needed in that case.

2) Copy over needed OLPC files to SD

Once the install is complete boot up the OLPC and insert the SD card. You have to copy over some files from the OLPC side to the Mint side. Also, you must ensure the SD Card label is OLPCRoot. Also, you will need a developer key to unlock the OLPC and allow it to boot to the SD card.

* Rename the SD card label:

$ sudo tune2fs /dev/sdb1 -L OLPCRoot

* Copy over required files:

I found this method of using just one rsync command to be the most effecient:
# rsync -vaR /security /boot /lib/modules /lib/firmware /media/OLPCRoot/

# mv /media/OLPCroot/etc/modprobe.d /media/OLPCroot/etc/modprobe.old

# cp -ra /etc/modprobe.d /media/OLPCRoot/etc/modprobe.d

# mv /media/OLPCroot/fstab /media/OLPCroot/fstab.old

# cp -ar /etc/fstab /media/OLPCroot/etc/fstab

# cp /etc/X11/xorg.conf /media/OLPCroot/etc/X11/xorg.olpc

# wget http://dev.laptop.org/~cscott/xorg.conf -O /media/OLPCroot/etc/X11/xorg.conf

# cp /media/OLPCroot/boot/olpc.fth /media/OLPCroot/boot/olpc.fth.nand

3) Fix the Ubuntu / OLPC upstart init booting bug

This one had me puzzled for a few minutes. If you try to boot now you it should find the kernel and initrd on the SD card and start to load. However, when init runs you will get this error message:

init: invalid option: --init Try init --help for more options

What the hell is that about? Well, I found the exact explanation here. I thought that updating the OLPC kernel to the latest build would likely fix this issue, but even after doing so, and rsyncing the newest kernel to the SD card side, this still occurred. Very strange. (This same issue is also reference hidden in official OLPC site page for installing Ubuntu, but the above link has more explanation of why this bug occurs, and what the problem is.)

The solution is simply to apt-get install sysvinit in the new Mint install. Herein you may encounter a chicken and the egg scenario: How to do get Mint to boot, so you can install sysvinit when it won’t boot? In my case I couldn’t boot using my Aspire One due to the above BIOS not allowing booting to SD devices and I also didn’t want to build an initrd that would see my SD slots. I tried booting it using a USB SD reader, but no luck. Good grief, what a catch 22 right?

No problem. The answer came to me in a flash – chroot!

* Boot the OLPC into Fedora & Sugar. Open a terminal and become root ($sudo bash -l)

* Ensure you have Internet connectivity at this point, you will need it once you chroot.

* Verify that the SD card is mounted, likely as /media/OLPCRoot

* Chroot into the Mint environment: #chroot /media/OLPCRoot

A bunch of text may scroll off the screen but you should then see the Mint bash start with the funny random fortune welcome message (if you enable this during your install.)

Now, run the following commands:

bash: /dev/null: Permission denied
bash: /dev/null: Permission denied
 ________________________________________
( Your lucky number is 3552664958674928. )
( Watch for it everywhere.               )
 ----------------------------------------
  o
   o   \_\_    _/_/
    o      \__/
           (oo)\_______
           (__)\       )\/\
               ||----w |
               ||     ||

root@paracelsus-laptop / # ls /boot
abi-2.6.27-7-generic			       olpcrd-2.6.22-20080312.2.olpc.f3687aa7e09fd65.img
actos.zip				       olpcrd-2.6.25-20090223.1.olpc.69098d87d56945c.img
actrd.zip				       olpcrd.img
boot					       os.zip
bootfw.zip				       rd.zip
config-2.6.22-20080312.2.olpc.f3687aa7e09fd65  runos.zip
config-2.6.25-20090223.1.olpc.69098d87d56945c  runrd.zip
config-2.6.27-7-generic			       System.map-2.6.22-20080312.2.olpc.f3687aa7e09fd65
gfxmenu					       System.map-2.6.25-20090223.1.olpc.69098d87d56945c
grub					       System.map-2.6.27-7-generic
initrd.img-2.6.27-7-generic		       vmcoreinfo-2.6.27-7-generic
memtest86+.bin				       vmlinuz
olpc_build				       vmlinuz-2.6.22-20080312.2.olpc.f3687aa7e09fd65
olpc.fth				       vmlinuz-2.6.25-20090223.1.olpc.69098d87d56945c
olpc.fth.nand				       vmlinuz-2.6.27-7-generic

root@paracelsus-laptop / # mount /proc/

root@paracelsus-laptop / # route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     2      0        0 ath0
link-local      *               255.255.0.0     U     1000   0        0 ath0
default         192.168.2.1     0.0.0.0         UG    0      0        0 ath0

root@paracelsus-laptop / # host google.com

#If you can't host a name and resolve it you need to create an /etc/resolv.conf file and have it contain this line:
nameserver 4.2.2.2
#After that you should be able to resolve domain names, which you will need to run apt

root@paracelsus-laptop / # vim /etc/resolv.conf
(Add the nameserver line above into this file)

root@paracelsus-laptop / # host google.com
google.com has address 74.125.127.100
google.com has address 74.125.45.100

#Networking and name resolution now work! Now for the magic that is apt:

root@paracelsus-laptop / # apt-get install sysvinit
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  friendly-recovery startup-tasks system-services ubuntu-minimal upstart upstart-compat-sysv upstart-logd
The following NEW packages will be installed:
  sysvinit
0 upgraded, 1 newly installed, 7 to remove and 155 not upgraded.
Need to get 116kB of archives.
After this operation, 721kB disk space will be freed.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
  sysvinit
Authentication warning overridden.
Get:1 http://archive.ubuntu.com intrepid/main sysvinit 2.86.ds1-59ubuntu13 [116kB]
Fetched 116kB in 3s (34.3kB/s)
sh: cannot create /dev/null: Permission denied
sh: cannot create /dev/null: Permission denied
dpkg-preconfigure: unable to re-open stdin:
Can not write log, openpty() failed (/dev/pts not mounted?)
(Reading database ... 97079 files and directories currently installed.)
Removing friendly-recovery ...
Removing ubuntu-minimal ...
Removing startup-tasks ...
Removing system-services ...
Removing upstart-logd ...
Removing upstart-compat-sysv ...
Removing upstart ...
Processing triggers for man-db ...
Can't open /dev/null: Permission denied
Can not write log, openpty() failed (/dev/pts not mounted?)
Selecting previously deselected package sysvinit.
(Reading database ... 97025 files and directories currently installed.)
Unpacking sysvinit (from .../sysvinit_2.86.ds1-59ubuntu13_i386.deb) ...
Processing triggers for man-db ...
Can't open /dev/null: Permission denied
Can not write log, openpty() failed (/dev/pts not mounted?)
Setting up sysvinit (2.86.ds1-59ubuntu13) ...
sysvinit: creating /dev/initctl
init: timeout opening/writing control channel /dev/initctl

root@paracelsus-laptop / # apt-get install sysvinit
Reading package lists... Done
Building dependency tree
Reading state information... Done
sysvinit is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 155 not upgraded.

#upstart has now been replaced with sysvinit. You can exit the chroot environment by typing: quit

4)What olpc.fth to use?

There is a special file used by open firmware to determine how to boot the system. There are different version of this file depending on if you want to boot to SD, USB, etc. The file must exist and be called /boot/olpc.fth regardless of which version is used. I found however that simply rsyncing over the default olpc.fth from an 802 OLPC install worked the best for me. (You should have copied this already in step 2 above. If you need other versions of the olpc.fth to use, you may get them from here.)

5) Boot your new Linux Mint from SD!

You should now be able to reboot the OLPC into Mint. On mine I have to hold the right game pad key (marked with a check mark) or the boot loader hangs. After that you should see the boot messages and it should load the kernel. Init will run properly now and booting should continue fully to the XFCE desktop. Wireless and sound work out of the box. Contrast and sound adjustment keys do not – I’ll post the fix when I find it.

6) Tune your system

There are quite a few services you can turn off to improve performance (You really don’t need cups running do you? etc.) I’ll make note of things here soon to turn off to help get the best gains.

Good luck and I hope you enjoy Linux Mint on your OLPC!

References:

If you get stuck see the links referred to above. In particular I found the second page of this article and this one to be very helpful. Together with the above you should be able to achieve a working Mint install.

:, , , , , ,
4 comments for this entry:
  1. Kyle

    What command did you run to get moo to spit out your lucky number? Please 2 tell me thanks big and huge.

  2. admin

    Hi there – the magic moo number was generated by a fortune Bash login script that Mint has. Whenever you start a new shell it generates some random ASCII image and a fortune quote. Kind of fun actually as every time you open a new shell you get some silly message. Go go gadget super moo!

  3. Charlie

    Hi,
    I just installed Mint 7 (Gloria) Xfce on OLPC with your suggestion above. It works like a charm but it is quite slow.
    Is there any way to speed up stuff? You mentioned you’d
    post how to delete some processes. I see even bluetooth
    is running (ps awx).

    Charlie.

  4. admin

    Hi Charlie,
    I am sorry, but I never really got back to this project as I got busy with other things. I may pick it up again at some point though as I have a plan in mind for making the OLPC into a platform for ham radio, and Mint might be a good route to go.
    Cheers,
    Pete

Leave a Reply

You must be logged in to post a comment.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...