Installing Ubuntu using Compressed Files
This howto was originally published on OLPCNews Forum by moocapiean
These instructions are for installing Ubuntu onto an external drive (USB or SD) by downloading a compressed version of a completed Ubuntu installation. If you want to install Ubuntu from scratch, see the Ubuntu On OLPC XO instructions.
Requirements
- You will need a USB drive or SD card that is at least 600 MB (although you'll probably want something at least 1.5 GB).
- The developer key for your XO (see Activation and Developer Keys for how to get one)
- A computer running Linux. As long as you have 194 MB of free space on your XO (or a secondary drive, but not the one you'll use for the installation), you should be fine.
Preparing your drive
- Start up your Linux computer. Since you'll need root privileges for various parts below, let's gain root access right away. If you're on the XO, just run
su -
- Now that you're root, we need to start working with the USB/SD drive, so insert that now. It's important to know what device Linux thinks your drive is, so after it's inserted, wait a few seconds, then try to determine what device node your drive is associated with. On the XO, you should be able to run
df -k
and look at the last entry. Since Sugar will automatically mount your USB/SD drive, it should show up as something like /dev/device. For me, it was /dev/sda, so I'll use that for the rest of the instructions.
- If you're using an SD card, your device node will probably look like /dev/mmcblk0. When translating my instructions to what you need to type, these translations should be helpful:
/dev/sda becomes /dev/mmcblk0 /dev/sda1 becomes /dev/mmcblk0p1
- Make sure the drive isn't mounted, by doing
mount | grep /dev/sda | awk '{ print $1 }'
- For every line that shows up, run
umount device
where device is one of those lines that appeared. You may run into a problem where you're told that the device is still busy. Sugar likes to take a look at what's on your drive and doesn't like it when you try to unmount them. However, it will give in if you go through the Journal activity and tell it to unmount it there.
- Ok, once you're done that, it's time to partition and format your drive
fdisk /dev/sda p
You might see something like this:
Device Boot Start End Blocks Id System /dev/sda1 1 4 32098+ 16 Fat16
- The important thing is what's in the Device column. Notice that my device is /dev/sda1. The important thing is the number at the end, it represents the partition number. Since we want to delete all partitions (I don't think we actually have to, but I think the XO wants the boot partition to be the first, so for simplicity...), we're going to have to delete each partition. For each partition, do:
d partition_number
where partition_number is the number of the partition you want to delete. When you're going to delete the last partition, you won't need to give it the number.
- Once you deleted all the partitions, let's create a new one.
n p 1 press enter to accept the default starting location if you want a specific size, specify it here (follow the instructions given by the program, or press enter to use the entire drive
- Now that we're finished creating the partition, let's make it bootable:
a 1
- While we're here, let's also make sure the partition table knows that this is partition will be an ext3 partition:
t 1 (here you're specifying the partition number so if you only have one, fdisk might not ask you to specify) 83
- And now we can write the changes to the drive and close:
w
- If the drive was mounted again, unmount it (see the instructions above). Now let's apply the filesystem:
mke2fs -j /dev/sda1
Installing Ubuntu
- Now we can mount the partition. To solve a minor problem in the tar file (see this post), we're going to mount the partition onto /mnt/OLPCRoot. The directory name here is important! If it isn't created already, let's create it first. If you aren't sure whether or not it exists, it's ok to run this command:
mkdir /mnt/OLPCRoot
and now mount it. Remember to replace /dev/sda1 with your drive's location:
mount /dev/sda1 /mnt/OLPCRoot
- Now we're ready to download the file. Let's assume that you want to download it to /home/olpc:
cd /home/olpc wget http://www.echo-flow.com/olpc/OLPCFile.tar.bz2
Although this direct download is possible, the person hosting the file has asked that you download the file using bittorrent if possible. The torrent file is [1]
- Now go to your USB/SD drive and decompress the file. I'm assuming that your drive is mounted to /mnt/OLPCRoot, so let's move into the /mnt directory and decompress
cd /mnt tar -jxf /home/olpc/OLPCFile.tar.bz2
- Once that's done, you'll need to set the correct olpc.fth file. See these threads for more information: [2] and [3]
- Now, unmount the drive. It may take awhile to unmount it since it may still be transferring files over, just be patient:
umount /mnt/OLPCRoot
- Once it's unmounted, we need to give the partition the proper name:
/sbin/tune2fs /dev/sda1 -L OLPCRoot
Getting the final files
- It's now time to move over to your XO and transfer over the last few files. Since our drive isn't ready to boot off of just yet, let's boot into Sugar, Xfce, or whatever you have running on your XO.
- Once it's loaded, issue the following command:
cp -ra /security /media/OLPCRoot/
- Check to see if the directory /media/OLPCRoot/security/.private exists:
ls /media/OLPCRoot/security/.private
If it doesn't, create it with:
mkdir /media/OLPCRoot/security/.private
And you're done!
Booting into Ubuntu
If you want to log into your new Xubuntu installation, just reboot, hold down the right game button (it looks like a check mark) until it tells you to release it, then let it boot up. The username is olpc and the password is olpcolpc. To start Xfce, after you log in, run
startxfce4