Sugar on a Stick/Linux: Difference between revisions

No edit summary
reorder
Line 1: Line 1:
<noinclude>{{GoogleTrans-en}}{{TOCright}}</noinclude>
<noinclude>{{GoogleTrans-en}}{{TOCright}}</noinclude>
== Introduction ==
== 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 [[Talk:Sugar on a Stick|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!
This page offers a variety of options for putting a [[Sugar on a Stick]] image on a USB flash drive under Linux. Look at the page Contents box to the right to select a suitable option.  If you have questions, trouble, or feedback, please let us know on the [[{{TALKPAGENAMEE}}|discussion]] 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 v2 Beta (Fedora 12 Alpha)==
== SoaS v2 Beta (Fedora 12 Alpha)==
* Announcement: http://www.mail-archive.com/sugar-devel@lists.sugarlabs.org/msg08474.html
* Announcement: http://www.mail-archive.com/sugar-devel@lists.sugarlabs.org/msg08474.html
Line 8: Line 8:
== Put [[Sugar on a Stick/Installation/OLPC | SoaS on an OLPC XO-1]] ==
== Put [[Sugar on a Stick/Installation/OLPC | SoaS on an OLPC XO-1]] ==
* See [[Sugar on a Stick/Installation/OLPC]] for booting an OLPC XO-1 with SoaS images.
* See [[Sugar on a Stick/Installation/OLPC]] for booting an OLPC XO-1 with SoaS images.
== Put SoaS onto a stick using Fedora and Ubuntu ==
This is known to work in Fedora and Ubuntu.
First, start downloading a SoaS <tt>.iso</tt> image from the [[Sugar on a Stick#Download locations|download locations section]], then return here.
:(A program called UNetBootin available at http://unetbootin.sourceforge.net/ does all this magic for you... or you can do the magic yourself:)
* 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, <code>sudo apt-get install syslinux isomd5sum cryptsetup</code> will install the packages. They are also available through the Synaptic Package Manager.)
: (On Gentoo, one needs to uncomment 'SAMPLE FILE' in /etc/mtools/mtools.conf to make syslinux work.)
:*''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 <code>--noverify</code> 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 <code>--unencrypted-home</code> option. The <code>--unencrypted-home</code> 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://download.sugarlabs.org/soas/releases/livecd-iso-to-disk.sh (23 June 2009).
* Check the USB device. In the example below the device is /dev/sdb:
: <tt>'''df -h'''</tt>
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
* Unmount the drive,<br>
: <tt>sudo umount /dev/sd''b1''</tt>
* Then check to see that the partition is marked as bootable,<br>
: <tt>sudo fdisk '''-l'''</tt> ''<----that's a lowercase letter 'L' for the '''l'''ist 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).
::# Select your USB device (/dev/sd''b'' for the rest of these instructions),
::# then your partition (/dev/sd''b1''),
::# then menu: Partition -> Manage Flags,
::# check the boot box,
::# and Close to mark the partition as bootable.
:* For Fedora,
::#  <tt>parted /dev/sd''b''</tt>
::# toggle 1 boot
::# quit
* Also, check to see that you do not already have an existing boot loader (such as [[wikipedia:GNU GRUB|GRUB]]) in the [[wikipedia:Master boot record|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:
: <tt>dd if=/dev/zero of=/dev/sd''b'' bs=446 count=1</tt>
:: (Actually, that didn't work for me. But this did:
::: <tt>lilo -M /dev/sd''b''</tt>
:::It put in a standard MBR that boots whichever partition has been called bootable. It does not install [[wikipedia:LILO (boot loader)|LILO]] as such.)
* Change mode to make the script executable.
: <tt>chmod +x livecd-iso-to-disk.sh</tt>
* 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.
: <tt>sudo ./livecd-iso-to-disk.sh --overlay-size-mb 300 --home-size-mb 160 --delete-home --unencrypted-home soas-strawberry.iso /dev/sd''b1''</tt>
::The ''livecd-iso-to-disk'' installation has the advantage over the ''liveusb-creator'' installation method by allowing a persistent /home/liveuser folder with the <tt>--home-size-mb ''NNN''</tt> 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 <u>leaving out</u> the --home-size-mb NNN option).
::* The <code>--delete-home</code> option is used to avoid an error message while requesting both a new home (with <code>--home-size-mb</code>) and a persistent home (indirectly with <code>--unencrypted-home</code>). 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 <code>--overlay-size-mb</code> and <code>--home-size-mb</code> values (for example, for a 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:
:::<code>#!/bin/bash</code><br>
:::<code>udevadm info $*</code>
:* Watch out for errors in the output of the script, the script seems to ignore them! (and say all is fine on the last line).
===livecd-iso-to-disk.sh transcript===
$ sudo ./livecd-iso-to-disk.sh --overlay-size-mb 300 --home-size-mb 160 --delete-home --unencrypted-home Soas2-200906211228.iso /dev/sdb1
Verifying image...
/home/walter/Desktop/Soas2-200906211228.iso:  9f1aa3c7a19dd9c68d1047d681f703c6
Fragment sums: f5ddb7deb26b6474bd59be9f57b6c7abcd624e1ccc682ddf664ba73da4ed
Fragment count: 20
Checking: 100.0%
The media check is complete, the result is: PASS.
It is OK to use this media.
Copying live image to USB stick
Updating boot config file
Initializing persistent overlay file
300+0 records in
300+0 records out
314572800 bytes (315 MB) copied, 88.7551 s, 3.5 MB/s
Initializing persistent /home
160+0 records in
160+0 records out
167772160 bytes (168 MB) copied, 48.1191 s, 3.5 MB/s
Formatting unencrypted /home
mke2fs 1.41.4 (27-Jan-2009)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
40960 inodes, 163840 blocks
8192 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
20 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done                           
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
tune2fs 1.41.4 (27-Jan-2009)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
Installing boot loader
USB stick set up as live image!
== Full Fedora 11 Install of Sugar-Desktop on a Stick to USB ==
== Full Fedora 11 Install of Sugar-Desktop on a Stick to USB ==
Uses [[wikipedia:Logical_Volume_Manager_(Linux)|Logical Volume Manager (LVM)]] layer over the file structure on the USB flash drive. Other methods on this page install a LiveUSB image that uses a compressed file system ([[wikipedia:SquashFS|SquashFS]]) to hold the system and content.
Uses [[wikipedia:Logical_Volume_Manager_(Linux)|Logical Volume Manager (LVM)]] layer over the file structure on the USB flash drive. Other methods on this page install a LiveUSB image that uses a compressed file system ([[wikipedia:SquashFS|SquashFS]]) to hold the system and content.
Line 138: Line 260:


* Details  http://en.opensuse.org/Sugar
* Details  http://en.opensuse.org/Sugar
== Put SoaS onto a stick using Fedora and Ubuntu ==
This is known to work in Fedora and Ubuntu.
First, start downloading a SoaS <tt>.iso</tt> image from the [[Sugar on a Stick#Downloading|images]] table, then return here.
A program called UNetBootin available at http://unetbootin.sourceforge.net/ does all this magic for you... or you can do the magic yourself:
* 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, <code>sudo apt-get install syslinux isomd5sum cryptsetup</code> will install the packages. They are also available through the Synaptic Package Manager.)
: (On Gentoo, one needs to uncomment 'SAMPLE FILE' in /etc/mtools/mtools.conf to make syslinux work.)
:*''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 <code>--noverify</code> 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 <code>--unencrypted-home</code> option. The <code>--unencrypted-home</code> 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://download.sugarlabs.org/soas/releases/livecd-iso-to-disk.sh (23 June 2009).
* Check the USB device. In the example below the device is /dev/sdb:
: <tt>'''df -h'''</tt>
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
* Unmount the drive,<br>
: <tt>sudo umount /dev/sd''b1''</tt>
* Then check to see that the partition is marked as bootable,<br>
: <tt>sudo fdisk '''-l'''</tt> ''<----that's a lowercase letter 'L' for the '''l'''ist 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).
::# Select your USB device (/dev/sd''b'' for the rest of these instructions),
::# then your partition (/dev/sd''b1''),
::# then menu: Partition -> Manage Flags,
::# check the boot box,
::# and Close to mark the partition as bootable.
:* For Fedora,
::#  <tt>parted /dev/sd''b''</tt>
::# toggle 1 boot
::# quit
* Also, check to see that you do not already have an existing boot loader (such as [[wikipedia:GNU GRUB|GRUB]]) in the [[wikipedia:Master boot record|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:
: <tt>dd if=/dev/zero of=/dev/sd''b'' bs=446 count=1</tt>
:: (Actually, that didn't work for me. But this did:
::: <tt>lilo -M /dev/sd''b''</tt>
:::It put in a standard MBR that boots whichever partition has been called bootable. It does not install [[wikipedia:LILO (boot loader)|LILO]] as such.)
* Change mode to make the script executable.
: <tt>chmod +x livecd-iso-to-disk.sh</tt>
* 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.
: <tt>sudo ./livecd-iso-to-disk.sh --overlay-size-mb 300 --home-size-mb 160 --delete-home --unencrypted-home soas-strawberry.iso /dev/sd''b1''</tt>
::The ''livecd-iso-to-disk'' installation has the advantage over the ''liveusb-creator'' installation method by allowing a persistent /home/liveuser folder with the <tt>--home-size-mb ''NNN''</tt> 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 <u>leaving out</u> the --home-size-mb NNN option).
::* The <code>--delete-home</code> option is used to avoid an error message while requesting both a new home (with <code>--home-size-mb</code>) and a persistent home (indirectly with <code>--unencrypted-home</code>). 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 <code>--overlay-size-mb</code> and <code>--home-size-mb</code> values (for example, for a 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:
:::<code>#!/bin/bash</code><br>
:::<code>udevadm info $*</code>
:* Watch out for errors in the output of the script, the script seems to ignore them! (and say all is fine on the last line).
===Transcript===
$ sudo ./livecd-iso-to-disk.sh --overlay-size-mb 300 --home-size-mb 160 --delete-home --unencrypted-home Soas2-200906211228.iso /dev/sdb1
Verifying image...
/home/walter/Desktop/Soas2-200906211228.iso:  9f1aa3c7a19dd9c68d1047d681f703c6
Fragment sums: f5ddb7deb26b6474bd59be9f57b6c7abcd624e1ccc682ddf664ba73da4ed
Fragment count: 20
Checking: 100.0%
The media check is complete, the result is: PASS.
It is OK to use this media.
Copying live image to USB stick
Updating boot config file
Initializing persistent overlay file
300+0 records in
300+0 records out
314572800 bytes (315 MB) copied, 88.7551 s, 3.5 MB/s
Initializing persistent /home
160+0 records in
160+0 records out
167772160 bytes (168 MB) copied, 48.1191 s, 3.5 MB/s
Formatting unencrypted /home
mke2fs 1.41.4 (27-Jan-2009)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
40960 inodes, 163840 blocks
8192 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=67371008
20 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729
Writing inode tables: done                           
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
tune2fs 1.41.4 (27-Jan-2009)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
Installing boot loader
USB stick set up as live image!


== What's next? ==
== What's next? ==