Difference between revisions of "Sugar on a Stick/Linux"

From Sugar Labs
Jump to navigation Jump to search
(Change flash drive spec 1 GB > 2 GB)
(→‎livecd-iso-to-disk.sh transcript: updated transcript for Pineapple)
Line 88: Line 88:
 
:* 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).
 
:* 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===
+
===livecd-iso-to-disk transcript===
  
 
<pre>
 
<pre>
$ sudo ./livecd-iso-to-disk.sh --reset-mbr --overlay-size-mb 500 --home-size-mb 900 --delete-home --unencrypted-home /mnt/VMs/Fedora-13-x86_64-Live-SoaS.iso /dev/sdb1
+
[LiveOS]$ sudo ./livecd-iso-to-disk --reset-mbr --overlay-size-mb 500 --home-size-mb 900 --delete-home --unencrypted-home /media/SoaS/Fedora-16-x86_64-Live-SoaS.iso /dev/sdc1
 
Verifying image...
 
Verifying image...
/mnt/VMs/Fedora-13-x86_64-Live-SoaS.iso:  7bb43cb6237802347e06d636b5974796
+
/media/SoaS/Fedora-16-x86_64-Live-SoaS.iso:  5fb3054f09478a6ae12e2384c2e0142d
Fragment sums: 5cb46db2dd7545c7154d99616eaa942ca515fb37188c34cf82564a498b68
+
Fragment sums: f772712c38fa22679ddadffa69fea8a9c64e85db24c7a3eec3ca7aa324af
 
Fragment count: 20
 
Fragment count: 20
 
Press [Esc] to abort check.
 
Press [Esc] to abort check.
Line 102: Line 102:
  
 
It is OK to use this media.
 
It is OK to use this media.
Copying live image to USB stick
+
Copying live image to target device.
 +
squashfs.img
 +
  447225856 100%  56.88MB/s    0:00:07 (xfer#1, to-check=0/1)
 +
 
 +
sent 447280525 bytes  received 31 bytes  52621241.88 bytes/sec
 +
total size is 447225856  speedup is 1.00
 +
osmin.img
 +
        8192 100%    0.00kB/s    0:00:00 (xfer#1, to-check=0/1)
 +
 
 +
sent 8265 bytes  received 31 bytes  16592.00 bytes/sec
 +
total size is 8192  speedup is 0.99
 
Updating boot config file
 
Updating boot config file
 
Initializing persistent overlay file
 
Initializing persistent overlay file
300+0 records in
+
500+0 records in
300+0 records out
+
500+0 records out
314572800 bytes (315 MB) copied, 35.3334 s, 8.9 MB/s
+
524288000 bytes (524 MB) copied, 62.769 s, 8.4 MB/s
 
Initializing persistent /home
 
Initializing persistent /home
200+0 records in
+
900+0 records in
200+0 records out
+
900+0 records out
209715200 bytes (210 MB) copied, 24.2014 s, 8.7 MB/s
+
943718400 bytes (944 MB) copied, 384.582 s, 2.5 MB/s
 
Formatting unencrypted /home
 
Formatting unencrypted /home
mke2fs 1.41.12 (17-May-2010)
+
mke2fs 1.41.14 (22-Dec-2010)
 
Filesystem label=
 
Filesystem label=
 
OS type: Linux
 
OS type: Linux
Block size=1024 (log=0)
+
Block size=4096 (log=2)
Fragment size=1024 (log=0)
+
Fragment size=4096 (log=2)
 
Stride=0 blocks, Stripe width=0 blocks
 
Stride=0 blocks, Stripe width=0 blocks
51200 inodes, 204800 blocks
+
57600 inodes, 230400 blocks
10240 blocks (5.00%) reserved for the super user
+
11520 blocks (5.00%) reserved for the super user
First data block=1
+
First data block=0
Maximum filesystem blocks=67371008
+
Maximum filesystem blocks=239075328
25 block groups
+
8 block groups
8192 blocks per group, 8192 fragments per group
+
32768 blocks per group, 32768 fragments per group
2048 inodes per group
+
7200 inodes per group
 
Superblock backups stored on blocks:  
 
Superblock backups stored on blocks:  
8193, 24577, 40961, 57345, 73729
+
32768, 98304, 163840, 229376
  
 
Writing inode tables: done                             
 
Writing inode tables: done                             
Line 133: Line 143:
 
Writing superblocks and filesystem accounting information: done
 
Writing superblocks and filesystem accounting information: done
  
This filesystem will be automatically checked every 33 mounts or
+
This filesystem will be automatically checked every 34 mounts or
 
180 days, whichever comes first.  Use tune2fs -c or -i to override.
 
180 days, whichever comes first.  Use tune2fs -c or -i to override.
tune2fs 1.41.12 (17-May-2010)
+
tune2fs 1.41.14 (22-Dec-2010)
 
Setting maximal mount count to -1
 
Setting maximal mount count to -1
 
Setting interval between checks to 0 seconds
 
Setting interval between checks to 0 seconds
 
Installing boot loader
 
Installing boot loader
USB stick set up as live image!
+
Target device is now set up with a Live image!
 
</pre>
 
</pre>
  

Revision as of 19:10, 21 November 2011


Introduction

This page provides additional detail for installing Mango Lassi, the most stable, released version of Sugar on a Stick (SoaS), available at this download site, onto a USB/SD flash storage device using GNU/Linux.

To explore a variety of experimental options for putting a Sugar image on a USB or SD flash drive under GNU/Linux, see the following pages:
SoaS test builds | OLPC XO-1 | openSUSE | Trisquel | VirtualBox | VMware | non-compressed Fedora | Live USB: (all known portable Sugar distributions)

If you have questions, trouble, or feedback, please let us know on the discussion page. If you can improve these instructions, please edit the page and do so!

Put SoaS onto a stick using Fedora or Ubuntu

This is known to work in Fedora and Ubuntu.

First, download a SoaS .iso image from http://spins.fedoraproject.org/soas/#downloads, 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. 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 --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 2 GB or larger USB stick into your computer.
  • Download the installation script: http://bit.ly/livecd-iso-to-disk.
    (You will execute this script several steps below.)
    Execute tools_livecd-iso-to-disk --help for usage details.
    • Alternatively, with 3 available loop devices, loop mount the 'SoaS.iso' image to reach the onboard livecd-iso-to-disk script:
      mkdir /mnt/soas/
      mount /path/to/Fedora-13-i686-Live-SoaS.iso /mnt/soas/
      (mount: warning: /mnt/soas/ seems to be mounted read-only.)
      mkdir /mnt/squash/
      mount /mnt/soas/LiveOS/squashfs.img /mnt/squash/
      mkdir /mnt/ext3fs/
      mount /mnt/squash/LiveOS/ext3fs.img /mnt/ext3fs/
      Later below, substitute /mnt/ext3fs/LiveOS/livecd-iso-to-disk for the shell script name (the file is already executable).
  • Check the USB device node name on your system. In the example below, the scsi device is /dev/sdb and filesystem partition on that device is /dev/sdb1:
df -Th
$ df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda1     ext4     18G  5.6G   12G  33% /
tmpfs        tmpfs    1.6G  536K  1.6G   1% /dev/shm
/dev/sdb1     vfat    996M     0  996M   0% /media/MyUSBdiscMountpoint
  • Unmount the drive,
sudo umount /media/MyUSBdiscMountpoint
  • 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
  • (You may need to change the file mode to make the script executable.)
chmod +x tools_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 ./tools_livecd-iso-to-disk.sh --reset-mbr --overlay-size-mb 500 --home-size-mb 900 --delete-home --unencrypted-home /path/to/SoaS.iso /dev/sdb1
    • Note: Subsequent USB or SD devices may be installed from a running Sugar on a Stick image that was installed with the livecd-iso-to-disk script downloaded after 15 February 2011 (but not those installed by other methods) by running this command from a root user Terminal window:
      /LiveOS/livecd-iso-to-disk --reset-mbr --overlay-size-mb 500 --home-size-mb 900 --delete-home --unencrypted-home /dev/sr0 /dev/sd?1
The livecd-iso-to-disk installation method has other advantages over the liveusb-creator method by allowing the creation of a separate, persistent /home/liveuser folder with the --home-size-mb NNN option. This feature avoids consumption of the write-once persistent overlay for Activity storage (see LiveOS image) and allows one 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 (for example, for a 2 GB stick, use 500 for the overlay and 900 for the home folder).
If you have sufficient capacity on your target device, and format it with an ext[234] filesystem to overcome the 2048-MB fat32 file size limit, you may avoid the SquashFS compression by including the --skipcompress option in the script command line.
  • 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 transcript

[LiveOS]$ sudo ./livecd-iso-to-disk --reset-mbr --overlay-size-mb 500 --home-size-mb 900 --delete-home --unencrypted-home /media/SoaS/Fedora-16-x86_64-Live-SoaS.iso /dev/sdc1
Verifying image...
/media/SoaS/Fedora-16-x86_64-Live-SoaS.iso:   5fb3054f09478a6ae12e2384c2e0142d
Fragment sums: f772712c38fa22679ddadffa69fea8a9c64e85db24c7a3eec3ca7aa324af
Fragment count: 20
Press [Esc] to abort check.
Checking: 100.0%

The media check is complete, the result is: PASS.

It is OK to use this media.
Copying live image to target device.
squashfs.img
   447225856 100%   56.88MB/s    0:00:07 (xfer#1, to-check=0/1)

sent 447280525 bytes  received 31 bytes  52621241.88 bytes/sec
total size is 447225856  speedup is 1.00
osmin.img
        8192 100%    0.00kB/s    0:00:00 (xfer#1, to-check=0/1)

sent 8265 bytes  received 31 bytes  16592.00 bytes/sec
total size is 8192  speedup is 0.99
Updating boot config file
Initializing persistent overlay file
500+0 records in
500+0 records out
524288000 bytes (524 MB) copied, 62.769 s, 8.4 MB/s
Initializing persistent /home
900+0 records in
900+0 records out
943718400 bytes (944 MB) copied, 384.582 s, 2.5 MB/s
Formatting unencrypted /home
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
57600 inodes, 230400 blocks
11520 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=239075328
8 block groups
32768 blocks per group, 32768 fragments per group
7200 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376

Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
tune2fs 1.41.14 (22-Dec-2010)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
Installing boot loader
Target device is now set up with a Live image!

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.