Sugar on a Stick/Linux

< Sugar on a Stick
Revision as of 20:48, 19 June 2009 by MartinDengler (talk | contribs) (remove VMware instructions as this is a page that "helps you put your ISO on a USB flash drive under Linux".)

Introduction

This page helps you to put your Sugar on a Stick image on a USB flash drive under Linux. If you have questions, trouble or feedback, please let us know on the SoaS talk page. "Sugar on a Stick" is provided in a number of variants. If you can improve these instructions, please edit the page and do so!

SoaS on an OLPC XO-1

openSUSE instructions

For the openSUSE Sugar variant (bundled with 55+ activities) go to http://en.opensuse.org/Sugar

Fedora and Ubuntu instructions

This is known to work in Fedora and Ubuntu.

First, start downloading the SoaS .iso image from the Sugar on a Stick#Downloading alternative images table, then return here.

  • Make sure you have the syslinux package installed on the operating system that you will use to prepare the Live USB image. It is recommended that you also have the isomd5sum package installed. The cryptsetup package is another option potentially used by the "livecd-iso-to-disk" installation script. (On Ubuntu, sudo apt-get install syslinux isomd5sum cryptsetup will install the packages.)
    • syslinux is needed to set up booting on the FAT file system of the USB disc or Live CD.
    • isomd5sum is needed for the recommended verification step, which checks that the .iso file is complete after its travels. If there is a problem with the .iso file, the script will exit and provide a failure message. The verification step can be bypassed by using the --noverify option.
    • cryptsetup is only needed for the option to provide password protection and encryption for the persistent /home/liveuser folder. It is not necessary if one applies the recommended --unencrypted-home option. The --unencrypted-home option is preferred because the reduced overhead improves robustness with the compressed squashfs file system employed by the Live USB deployment.
  • Plug in a 1GB or larger USB stick into your computer.
  • Download the installation script: http://people.sugarlabs.org/sdz/livecd-iso-to-disk.sh (09 April 2009)
  • Check the USB device. In the example below the device is /dev/sdb:
df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              19G  7.0G   11G  40% /
tmpfs                 1.5G     0  1.5G   0% /lib/init/rw
varrun                1.5G   96K  1.5G   1% /var/run
varlock               1.5G     0  1.5G   0% /var/lock
udev                  1.5G  2.9M  1.5G   1% /dev
tmpfs                 1.5G  104K  1.5G   1% /dev/shm
lrm                   1.5G  2.0M  1.5G   1% /lib/modules/2.6.27-11-generic/volatile
/dev/sdb1             996M  913M   84M  92% /mnt/myUSBdisc
  • Then check to see that the partition is marked as bootable,
sudo fdisk -l <----that's a lowercase letter 'L' for the list option.

You should see output that looks like this:

Disk /dev/sdb: 1047 MB, 1047265280 bytes
255 heads, 63 sectors/track, 127 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0008325f
. 
 Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         127     1020096    6  FAT16

The '*' under the Boot column is what you want to see.

If not, then
  • For Ubuntu 8.10, menu: System -> Administration -> Partition Editor (GParted).
  1. Select your USB device (/dev/sdb for the rest of these instructions),
  2. then your partition (/dev/sdb1),
  3. then menu: Partition -> Manage Flags,
  4. check the boot box,
  5. and Close to mark the partition as bootable.
  • For Fedora,
  1. parted /dev/sdb
  2. toggle 1 boot
  3. quit
  • Also, check to see that you do not already have an existing bootloader (such as GRUB) in the MBR of your stick. (If you have not previously used this stick as a live boot, you can skip this step.) To be sure that the USB stick's MBR is wiped clean, overwrite it completely using:
dd if=/dev/zero of=/dev/sdb bs=446 count=1
    • (Actually, that didn't work for me. But this did:
      lilo -M /dev/sdb
      It put in a standard MBR that boots whichever partition has been called bootable. It does not install LILO as such.)
  • Unmount the drive,
sudo umount /dev/sdb1
  • Change mode to make the script executable.
chmod +x livecd-iso-to-disk.sh
  • Run it as root, making sure to pass the correct USB device and to set overlay and home size appropriately, depending on the stick size.
sudo ./livecd-iso-to-disk.sh --overlay-size-mb 300 --home-size-mb 160 --delete-home --unencrypted-home soas-beta.iso /dev/sdb1

The livecd-iso-to-disk installation has the advantage over the liveusb-creator installation method by allowing a persistent /home/liveuser folder with the --home-size-mb NNN option. This feature would allow you to update the OS image while keeping the user files (by running the script against your existing installation but leaving out the --home-size-mb NNN option).

  • The --delete-home option is used to avoid an error message while requesting both a new home (with --home-size-mb) and a persistent home (indirectly with --unencrypted-home). You wouldn't use the --delete-home option on an upgrade of the operation system only.

Depending on the size of your USB stick, you may have to decrease --overlay-size-mb and --home-size-mb values (example, for 1 GB stick, use 200 for each).

  • If you get an error about udevinfo, you have the new version of udev where "udevadm info" is the proper command. Create an executable file called udevinfo somewhere in your path with the following contents:
#!/bin/bash
udevadm info $*

What's next?

After you've created your stick, it's time to boot your stick and test it out. Please also report your observations.