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

From Sugar Labs
Jump to navigation Jump to search
 
(68 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<noinclude>{{GoogleTrans-en}}{{TOCright}}</noinclude>
+
<noinclude>
 +
[[Category:HowTo]]
 +
</noinclude>
 
== Introduction ==
 
== Introduction ==
This page offers a variety of '''experimental''' options for putting a [[Sugar on a Stick]] image on a USB flash drive under GNU/Linux. Look at the page Contents box to the right to select a suitable option.
 
  
For a more stable, released version, see '''[[Sugar_on_a_Stick/Strawberry#Linux_Users | v1 Strawberry]]'''.
+
The page [[Sugar on a Stick/Linux/Installation]] provides up-to-date and concise instructions for loading  the most recent released version of [[Sugar on a Stick]] (SoaS) onto a USB/SD flash storage device using GNU/Linux.
  
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 [[Talk:Sugar_on_a_Stick/Linux#SoaS_Fedora_matrix|variants]]. If you can improve these instructions, please edit the page and do so!
+
==livecd-iso-to-disk tool==
  
==SoaS V2 Beta==
+
Before experimenting beyond the instructions in the link above, please read [[fedora:How to create and use Live USB]] for more background details. That page starts with Direct Write methods of creating a (non-persistent) Live USB system, and further down the page describes using the livecd-iso-to-disk tool which is the prefered method of making persistent Sugar on a Stick.
*(Fedora 12 alpha) See [[Talk:Sugar_on_a_Stick/Linux#SoaS_Fedora_matrix|Soas Fedora image matrix]].
 
===Download===
 
* Help save our bandwidth. Please download via BitTorrent, if possible.
 
  
{| border=1 cellpadding=3 style="border: 1px solid white; border-collapse: collapse; background: #e3e4e5;"
+
The reader should be aware that Ubuntu/Debian use a method to create a live USB system which is fundamentally different to Fedora's method, used by Sugar.
|-style="background:#787878; color: white;"
 
| '''Tracker''' || '''Link'''
 
|-
 
| LegalTorrents.com || http://www.legaltorrents.com/torrents/780-sugar-on-a-stick-v2-beta
 
|}
 
  
Alternatively, you can download via http:
+
:''Quote from the above Fedora page''
* ''Sugar on a Stick v2'' snapshots are available for download at http://download.sugarlabs.org/soas/snapshots/2/, latest test version, {{SoaS snapshot path}}, (5 Oct 2009).
 
  
===SoaS v2 Installation===
+
: '''Issues using other Linux distributions'''
* Use ONLY this script file to create a bootable image, http://bit.ly/livecd-iso-to-disk.
 
:(Don't forget to <code>chmod +x tools_livecd-iso-to-disk.sh</code> after you download the script.)
 
* The .iso file may be burnt to a CD-ROM and booted on your PC (or mounted in a virtual machine to boot it):
 
*# Press <Esc> at the blue. initial boot screen,
 
*# Press <Tab> to enter more boot options,
 
*# Append <code>selinux=0</code> to the startup command arguments,
 
*# Press <Enter> to continue with the boot.
 
  
'''Note:'''
+
: Ubuntu and derivative Linux distributions have a usb-creator program similar to Live USB Creator. This does not work with Fedora ISO images, it silently rejects them. usb-creator requires the ISO to have a Debian layout, with a /.disk/info file and a casper directory. Do not attempt to use this utility to write a Fedora ISO image.
* See this [http://lists.sugarlabs.org/archive/sugar-devel/2009-September/019829.html announcement] for more information (noting the changes and notes below).
 
* Do ''NOT'' use installation instructions in other sections of this page for this version of SoaS.
 
* Note that selinux must be disabled in the startup (selinux=0) or Sugar will not load.
 
*: This precludes using a dd command to write a USB or SD image. The SCRIPT MUST BE USED.
 
* To install the .iso disc image, execute the shell script as the root user in <u>one</u> command with arguments as follows:
 
<div style="border:1px dashed #2f6fab; padding:8px; margin:8px; background-color:#f9f9f9"><code>sudo ./tools_livecd-iso-to-disk.sh --overlay-size-mb 400 --delete-home --extra-kernel-args selinux=0 ./SoaS3-200909271154.iso /dev/sd*1</code></div>
 
:* (*) ''be sure of your USB/SD '''s'''torage '''d'''evice name (such as sda, sdb, etc.) and partition (such as 1, 2, etc.), yielding, for example,'' <code>/dev/sdb1</code>. ''Use the mount command or the partition manager to confirm it before executing the script.''
 
:* The <code>--format --reset-mbr</code> arguments for the shell script were in the example script, but may be excluded to preserve the existing disc format and data.  See [[olpc:How to Damage a FLASH Storage Device]] for a discussion of why you might want to try to keep your factory format on a flash storage device.  
 
:* If you do use the format and reset master boot record arguments, you'll want to specify the target device name and not a partition, that is <code>/dev/sd*</code> with no partition number, instead of <code>/dev/sd*1</code> as in the example above used to specify an existing partition. ''As noted above, confirm your target disc device name&mdash;in this case, it is VERY DANGEROUS to your other discs if this is entered wrong, as the whole disc will be reformatted and a new master boot record written causing all previously written data on that disc to be lost.''
 
  
====zyx-liveinstaller====
+
: The livecd-iso-to-disk script is not meant to be run from a non-Fedora system. Even if it happens to run and write a stick apparently successfully from some other distribution, the stick may well fail to boot. Use of livecd-iso-to-disk on any distribution other than Fedora is unsupported and not expected to work: please use an alternative method, such as the "direct write" methods described above.  
* alternate install method [http://wiki.sugarlabs.org/go/VMware#Soas02.iso_PRELIMINARY_INSTALL_zyx-liveinstaller_FOR_TESTING_ONLY]
+
:''end Quote''
* selinux=0 needed on boot screen DOES NOT PRODUCE A WORKING USB AT THIS TIME 10/12/2009
 
  
== Put [[Sugar on a Stick/Installation/OLPC | SoaS on an OLPC XO-1]] ==
+
=== Persistence ===
* See [[Sugar on a Stick/Installation/OLPC]] for booting an OLPC XO-1 with SoaS images.
+
Persistence in the context of a live USB system, is the ability to save both system changes, including Software updates, and the user's work between sessions, that is after shutdown and reboot.
== Put SoaS onto a stick using Fedora and Ubuntu ==
 
  
This is known to work in Fedora and Ubuntu.
+
==Linux users, suggested methods ==
  
First, start downloading a SoaS <tt>.iso</tt> image from the [[Sugar on a Stick#Download locations|download locations section]], then return here.
+
Linux users might consider reading the following pages for supported methods to install SoaS.
  
:(A program called UNetBootin available at http://unetbootin.sourceforge.net/ does all this magic for you... or you can do the magic yourself:)
+
'''Users of Fedora and Red Hat derivitives:'''
 +
:[[Sugar on a Stick/Linux/Installation]]
  
* 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.)
+
'''Debian, Ubuntu, and derivitives, and other distros:'''
: (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).<br>(You will execute this script several steps below.)
 
* Check the USB device name. In the example below, the '''s'''torage '''d'''evice is /dev/sdb and filesystem partition on that device is /dev/sdb1:
 
: <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>
+
:Make your SoaS from within a Sugar Live OS environment, which is itself a Fedora system.
: <tt>sudo umount /dev/sd''b1''</tt>
 
  
* Then check to see that the partition is marked as bootable,<br>
+
: '''Either''' Burn a Sugar.iso and follow the section of [[Sugar on a Stick/Installation]] entitled
: <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,
+
:: "1. Burn a CD-ROM disc, boot from it, then run the script, ''livecd-iso-to-disk''"
::#  <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:
+
: '''or''' create a Sugar image by dd or any of the methods on [[ Testing/Reports/Sugar_on_a_Stick_Persistence|this page]]. Then boot into the Live OS, to create SoaS from the running Live OS image.
: <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
+
If you have questions, trouble, or feedback, please let us know on the [[{{TALKPAGENAMEE}}|discussion]] page. If you can improve these instructions, please edit the page and do so!
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 ==
+
==Experimental==
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.
 
  
THIS IS A WORK IN PROGRESS. Please make suggestions or improvements.
+
To explore a variety of experimental options for putting a [[What is Sugar?|Sugar]] image on a USB or SD flash drive under GNU/Linux, see the following pages:
===='''Download of Prebuilt SUGAR-DESKTOP USB.img file'''====
 
  
* DOWNLOAD Link:[[http://people.sugarlabs.org/Tgillard/]]  
+
[[Sugar on a Stick/Beta|SoaS test builds]] | [[Sugar on a Stick/Installation/OLPC|OLPC XO-1]] | [[Sugar on a Stick/Linux/openSUSE|openSUSE]] | [[Trisquel On A Sugar Toast|Trisquel]] | [[VirtualBox]] | [[VMware]] | [[Sugar on a Stick/Linux/Non-compressed Fedora|non-compressed Fedora]] | [[:Category:Live USB|Live USB: (all known portable Sugar distributions)]]
'''Requires:'''
 
* GNU/Linux system with ability to decompress archive
 
* 4 GB or larger USB Stick
 
* Familiarity with dd commands in terminal (see below)
 
  
====Make your OWN Custom SUGAR-DESKTOP USB Boot Stick====
+
=== Load SoaS further insight ===
* Uses Fedora 11 Net Install CD,[http://mirrors.cat.pdx.edu/fedora/linux/releases/11/Fedora/i386/iso/] so best with a fast internet connection.
 
* USB 2.0 recommended or install would take a excessive time using USB 1.0
 
* '''Requires 4-GB USB drive.''' (Tested with Cruzer Micro USB Stick, an 8-GB Toshiba USB drive works faster.)
 
# Boot from CD
 
# Enter language, time, location, root user password
 
# Replace existing Linux system
 
# Review and modify partitioning layout
 
# edit LVM VolGroup
 
# delete LV_swap (needed to fit on 4GB stick and for reduced writes to USB)
 
# edit LV_root  (Edit LVM  and increase to max size on (/dev/sda*)
 
# size:(change to max shown)
 
# yes for no swap file
 
# Write changes to disk '''*NOTE: Be sure this is the USB drive, or you will ruin your hard disk installation on the host PC.'''
 
# install boot loader Fedora/dev/mapper/VolGroup-lv_root
 
# enable network interface (DHCP, IPv4)
 
# retrieve install informtion for Fedora 11-i386
 
# Select customize now
 
## sugar-desktop ONLY / deselect gnome-desktop
 
## deselect other unwanted applications in categories (Games, etc)
 
#: Installer will reformat drive; install bootloader; transfer 957 packages  (about 2 hours)
 
#reboot
 
# Configuration setup (Graphical), add user and password on first boot
 
# Log in User
 
# Select Sugar on selection bar
 
*
 
*''' You can also do a hard disk install of SUGAR this way ''' (not tested yet)
 
  
*''' This procedure can be used with a Windows PC if it will boot from CD'''
+
This is known to work in Fedora and has been reported to work in Ubuntu.
 
====8 GB Gnome/Sugar-Desktop USB====
 
*''' install gnome or KDE desktop with this technique and then, use add/remove programs to install sugar from other desktops'''
 
  
*''' you get a 8GB USB that boots either gnome or sugar (8 GB Toshiba USB)'''
+
First, download a SoaS {{Code|.iso}} image from  http://spins.fedoraproject.org/soas/#downloads, then return here.
This Works well....can switch back between desktops by logging off and back on.
 
  
===='''AUTO Login to SUGAR'''====
+
* 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}} will install the packages. They are also available through the Synaptic Package Manager.)
 +
:: <small>(On Gentoo, one needs to uncomment 'SAMPLE FILE' in /etc/mtools/mtools.conf to make syslinux work.)</small>
 +
:*''[[wikipedia:Syslinux|syslinux]]'' is needed to set up booting on the FAT file system of the USB disc or Live CD.
 +
:*''[[wikipedia:md5sum|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.
 +
:*''[[wikipedia:dm-crypt|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}} option. The {{Code|--unencrypted-home}} option is preferred because the reduced overhead improves robustness with the compressed ''[[wikipedia:SquashFS|SquashFS]]'' file system employed by the Live USB deployment.
 +
* Plug in a 2 GB or larger USB stick into your computer.
 +
* Mount the 'SoaS.iso' image to reach the onboard livecd-iso-to-disk installation script:
 +
: {{Code|sudo mkdir /run/soas/}}
 +
: {{Code|sudo mount /path/to/Fedora-Live-SoaS-x86_64-20-1 /run/soas/}}
 +
:: (mount: /dev/loop0 is write-protected, mounting read-only)
 +
* Change the working directory to the LiveOS folder on the SoaS.iso mount:
 +
: {{Code|cd /run/soas/LiveOS}}
 +
* Execute {{Code|./livecd-iso-to-disk --help}} for usage details. (The file is already executable.)
  
TO bypass gdm Login and start up Stick in SUGAR DESKTOP:
+
* Check the USB device node name on your system. In the example below, the <abbr title="small computer system interface">'''s'''csi</abbr> '''d'''evice is /dev/sdc and filesystem partition on that device is /dev/sdc1:
*start up and log in to sugar
+
<pre>
*Open Terminal Application
+
$ df -Th
  su -
+
Filesystem    Type    Size Used Avail Use% Mounted on
  password=sugarroot
+
rootfs      rootfs    20G  12G  7.5G 61% /
  yum install gedit
+
udev      devtmpfs    1.6G    0 1.6G  0% /dev
  (after gedit is installed:)
+
tmpfs        tmpfs    1.6G 904K 1.6G  1% /dev/shm
  gedit /etc/gdm/gdm.schemas
+
tmpfs        tmpfs    1.6G 788K 1.6G  1% /run
*change: (to true and add sugar)
+
/dev/sda2    ext4    20G   12G  7.5G  61% /
   --snip--
+
tmpfs        tmpfs    1.6G    0 1.6G  0% /sys/fs/cgroup
  <key>daemon/AutomaticLoginEnable</key>
+
tmpfs        tmpfs    1.6G    0 1.6G  0% /media
  <signature>b</signature>
+
/dev/sda2    ext4    20G  12G 7.5G  61% /tmp
  <default>true</default>
+
/dev/sda2    ext4    20G  12G 7.5G  61% /var/tmp
  </schema>
+
/dev/sda2    ext4    20G  12G  7.5G 61% /home
  <schema>
+
/dev/loop0 iso9660    668M 668M    0 100% /run/soas
  <key>daemon/AutomaticLogin</key>
+
/dev/sdc1    vfat    3.8G  4.0K 3.8G  1% /run/media/MyAccount/MyUSBdiscMountPoint
  <signature>s</signature>
+
</pre>
<default>sugar</default>
 
</schema>  
 
  --snip--
 
*Reboot
 
  
===='''Duplication of USB Sticks'''====
+
Another way to find out the USB device node name on your system is issuing the command
'''Caution:''' ''This is a work in progress''
 
  
====Preparation of target device====
+
    sudo fdisk -l
'''Caution if you purchase Sandisk cruzer micro 4 GB USB you have to use Windows machine to to start the U3 program and delete the hidden U3 directory'''
 
  
'''This will make the USB a full 4GB otherwise it will be too small to use dd to copy .img file'''
+
and looking in the output for the disk that corresponds to the USB device, e.g., a disk described with a stanza like
* U3 partition will not be removed by formating with Partition Manager
 
  
'''CAUTION VERY DANGEROUS IF NOT ENTERED CORRECTLY:'''
+
    Disk /dev/sd'''?''': 1939 MB, 1939865600 bytes
 +
    150 heads, 42 sectors/track, 601 cylinders, total 3788800 sectors
 +
    Units = sectors of 1 * 512 = 512 bytes
 +
    Sector size (logical/physical): 512 bytes / 512 bytes
 +
    I/O size (minimum/optimal): 512 bytes / 512 bytes
 +
    Disk identifier: 0x000e14bf
 +
   
 +
    Device Boot      Start        End      Blocks  Id  System
 +
    /dev/sd'''?'''1  *        2048    3784703    1891328    c  W95 FAT32 (LBA)
  
* Enter Terminal
+
where '''?''' in /dev/sd'''?''' is (usually) a letter of the alphabet.
su -
 
<password>
 
(Need to be ROOT or get permission denied)
 
* Target USB device MUST be larger for this to work (not all USB Sticks are exactly the same size)
 
** be certain of the device identifier, /dev/sd(x), for your USB Stick. (I use the partition editor in Ubuntu 9.04 to identify the USB device.)
 
* Note that .img file on Desktop can be compressed for distribution.
 
  
'''Example of sucessful clone session:''''
+
If you have only '''one''' storage device with 2 GB of nominal capacity, it will be easy to recognize the USB device in the fdisk output by looking at which device has (about) 2 GB of capacity. In the example above, "Disk /dev/sd'''?'''" reports to be as large as ''1939 MB'', that is almost 2 GB.
=====Make Image from USB:=====
 
* 8-GB Toshiba USB
 
root@xxxxx:/home/robert/Desktop# dd if=/dev/sda* of=USB8.img
 
15687680+0 records in
 
15687680+0 records out
 
8032092160 bytes (8.0 GB) copied, 421.146 s, 19.1 MB/s
 
  
=====use image to write USB Clone:=====
+
If you have '''more than one''' disk with about 2 GB of capacity, consider moving to a situation where you'll have only '''one''' device with 2 GB of capacity, because this will help out a lot in recognizing the drive correctly.
* 4-GB SanDisk Cruzer with U3 partition removed
 
root@xxxx:/home/robert/Desktop# dd if=USB4C2.img of=/dev/sdg bs=4k
 
986623+1 records in
 
986623+1 records out
 
4041211392 bytes (4.0 GB) copied, 595.509 s, 6.8 MB/s
 
  
== Make a Sugar-Desktop on a Stick VMware appliance  ==
+
* Unmount the drive,<br>
 +
: {{Code|sudo umount /run/media/MyAccount/MyUSBdiscMountPoint}}
 +
:: <small>(The {{Code|/run/media/MyAccount/}} path is the new, standard Fedora mount point. Other operating systems may use {{Code|/media/MyMountPoint}}.)</small>
 +
{{:Sugar on a Stick/Linux/bootable device}}
  
Prebuilt VMware Appliances: [http://people.sugarlabs.org/Tgillard/]
+
* Run {{Code|livecd-iso-to-disk}} as the root user, making sure to pass the correct USB device node name and to set overlay and home size appropriately, depending on the target USB device storage capacity.
# Download and expand file
+
:<div style="padding: 1em; border: 1px dashed #2F6FAB; background-color: #FBFBFB; margin: 1em 0px 1em 0em; font-family: Courier;">./livecd-iso-to-disk --reset-mbr --overlay-size-mb '''500''' --home-size-mb '''800''' --unencrypted-home '''/path/to/downloaded'''.iso /dev/sd'''?'''1</div>
# copy to USB Stick (min 4GB)
+
: If the command fails telling you that /dev/sd'''?'''1 does not exist, try using the command for /dev/sd'''?''' (the name of the device) and not for /dev/sd'''?'''1 (the name of the partition), like this:
# Play with VMPlayer (free) available here: [http://www.vmware.com/download/player/]
 
  
OR
+
:<div style="padding: 1em; border: 1px dashed #2F6FAB; background-color: #FBFBFB; margin: 1em 0px 1em 0em; font-family: Courier;">./livecd-iso-to-disk --reset-mbr --overlay-size-mb '''500''' --home-size-mb '''800''' --unencrypted-home '''/path/to/downloaded'''.iso /dev/sd'''?'''</div>
  
[[VMware|These instructions]] will help you put a [[Sugar on a Stick#Downloading|SoaS image]] onto a USB
+
: If the command fails returning a complaint about the filesystem not being mounted, '''and''' you can afford to '''loose all data on the USB device''', you can try reformatting the USB device filesystem:
stick that boots into VMware Player that then runs a VMware Virtual Appliance containing a [[Sugar on a Stick#Downloading|SoaS image]].
 
  
== openSUSE Sugar-Desktop on a stick ==
+
:* mount the USB device (e.g., by unplugging and re-inserting it),
 +
:* repeat the steps for learning its device name (there can be situations when the device name has changed!)
 +
:* issue the command with the '''{{Code|--format --msdos}}''' options, like this:
 +
{{Note/warning|Warning|The command described here will ask for a confirmation and will '''destroy''' all pre-existing data on your USB device.<br>
 +
See also [[olpc:How_to_Damage_a_FLASH_Storage_Device|How to Damage a FLASH Storage Device]] for a discussion of why using the factory format is preferred.}}
 +
::<div style="padding: 1em; border: 1px dashed #2F6FAB; background-color: #FBFBFB; margin: 1em 0px 1em 0em; font-family: Courier;">./livecd-iso-to-disk --reset-mbr '''--format --msdos''' --overlay-size-mb '''500''' --home-size-mb '''800''' --unencrypted-home '''/path/to/downloaded'''.iso /dev/sd'''?'''</div>
  
* The openSUSE version is a .raw image that is burned to a stick by the dd command. It creates a usb stick that boots sugar-desktop with 55 applications.
+
: {{Highlight|In the above examples, the {{Code|'''/path/to/downloaded'''.iso}} may be substituted with {{Code|/dev/loop0}}, as this is the loop device that the mount command chose.}}
  
* '''This is a persistent live image on a stick''' (a file system is created on the stick on first boot)
+
{{Note/note|Note| Additional USB or SD devices may be loaded from a running ''Sugar on a Stick'' image that was loaded with the livecd-iso-to-disk script (but not those installed by other methods) by running this command in the Terminal Activity as a root user:}}
 +
:<div style="padding: 1em; border: 1px dashed #2F6FAB; background-color: #FBFBFB; margin: 1em 0px 1em 0em; font-family: Courier;">/run/initramfs/live/LiveOS/livecd-iso-to-disk --reset-mbr --overlay-size-mb '''500''' --home-size-mb '''800''' --unencrypted-home /run/initramfs/livedev /dev/sd'''?'''1</div>
  
* Installation of openSUSE.raw file to USB/SD: [[VMware#Image USB/SD Drives]]
+
: 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 <tt>--home-size-mb ''NNN''</tt> option. This feature avoids consumption of the 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 <u>leaving out</u> the --home-size-mb NNN option).
 +
::* A {{Code|--delete-home}} option is available to avoid an error message while requesting both a new home (with {{Code|--home-size-mb}}) when there is already a persistent home on the device). You wouldn't use the --delete-home option on an upgrade of the operating system only.
 +
:Depending on the size of your USB stick, you may have to decrease {{Code|--overlay-size-mb}} and {{Code|--home-size-mb}} values (for example, for a 2 GB stick, use 500 for the overlay and 800 for the home folder).
 +
:: If you have sufficient capacity on your target device, and format it with an ext[234] filesystem to overcome the 4096-MB fat32 file size limit, you may avoid the SquashFS compression by including the {{Code|--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).
  
* Download Link for .raw files:[[http://download.opensuse.org/repositories/Education/images/]]
+
===livecd-iso-to-disk transcript===
  
* Details  http://en.opensuse.org/Sugar
+
<pre>
===Dual Mode .iso Files===
+
[LiveOS]$ sudo ./livecd-iso-to-disk --reset-mbr --overlay-size-mb 500 --home-size-mb 800 --unencrypted-home /home/MyAccount/Downloads/Fedora-Live-SoaS-x86_64-20-1.iso /dev/sdc1
NOTE: Latest versions of opensuse-edu-sugar.iso files can be burned to USB with dd command. "They are dual mode"
+
Verifying image...
Download: [[http://download.opensuse.org/repositories/Education/images/iso/]]
+
/home/MyAccount/Downloads/Fedora-Live-SoaS-x86_64-20-1.iso:    b0a9414ff7eb79b680d5c86440e19587
 +
Fragment sums: 9bfe23577651c88dcfb78c76ac3a28a5c53eead4561e3bdc5921b8b2e748
 +
Fragment count: 20
 +
Press [Esc] to abort check.
 +
Checking: 100.0%
  
The resulting USB/SD has not got persistence. It is equivalent to Booting from the CD
+
The media check is complete, the result is: PASS.
  
Example record:
+
It is OK to use this media.
*be sure /dev/sd(x) points to your USB (can destroy your Hard Disk if wrong) use Partition Manager to see proper label...
+
Copying live image to target device.
dd if=openSUSE-Sugar-live-unstable.i686-0.2.0-Build5.1.iso of=/dev/sd(x)* bs=4M
+
squashfs.img
102+1 records in
+
    630,784,000 100%    1.96MB/s    0:05:06 (xfr#1, to-chk=0/1)
102+1 records out
+
osmin.img
428867584 bytes (429 MB) copied, 53.2686 s, 8.1 MB/s
+
          8,192 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=0/1)
 +
Updating boot config file
 +
Initializing persistent overlay file
 +
500+0 records in
 +
500+0 records out
 +
524288000 bytes (524 MB) copied, 216.717 s, 2.4 MB/s
 +
Initializing persistent /home
 +
800+0 records in
 +
800+0 records out
 +
838860800 bytes (839 MB) copied, 344.643 s, 2.4 MB/s
 +
Formatting unencrypted /home
 +
mke2fs 1.42.8 (20-Jun-2013)
 +
Filesystem label=
 +
OS type: Linux
 +
Block size=4096 (log=2)
 +
Fragment size=4096 (log=2)
 +
Stride=0 blocks, Stripe width=0 blocks
 +
51296 inodes, 204800 blocks
 +
10240 blocks (5.00%) reserved for the super user
 +
First data block=0
 +
Maximum filesystem blocks=209715200
 +
7 block groups
 +
32768 blocks per group, 32768 fragments per group
 +
7328 inodes per group
 +
Superblock backups stored on blocks:
 +
32768, 98304, 163840
 +
 
 +
Allocating group tables: done                           
 +
Writing inode tables: done                           
 +
Creating journal (4096 blocks): done
 +
Writing superblocks and filesystem accounting information: done
 +
 
 +
tune2fs 1.42.8 (20-Jun-2013)
 +
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!
 +
</pre>
  
 
== What's next? ==
 
== What's next? ==
  
After you've created your stick, it's time to [[Sugar_on_a_Stick#Boot|boot your stick]] and [[Sugar on a Stick/Getting Involved | test]] it out.  Please also [[Sugar on a Stick/Getting Involved/Testing | report]] your observations.
+
After you've created your stick, it's time to [[Sugar on a Stick/Boot|boot your stick]] and [[Sugar on a Stick/Getting Involved | test]] it out.  Please also [[Sugar on a Stick/Getting Involved/Testing | report]] your observations.
 
 
[[Category:HowTo]]
 

Latest revision as of 12:10, 26 February 2015


Introduction

The page Sugar on a Stick/Linux/Installation provides up-to-date and concise instructions for loading the most recent released version of Sugar on a Stick (SoaS) onto a USB/SD flash storage device using GNU/Linux.

livecd-iso-to-disk tool

Before experimenting beyond the instructions in the link above, please read fedora:How to create and use Live USB for more background details. That page starts with Direct Write methods of creating a (non-persistent) Live USB system, and further down the page describes using the livecd-iso-to-disk tool which is the prefered method of making persistent Sugar on a Stick.

The reader should be aware that Ubuntu/Debian use a method to create a live USB system which is fundamentally different to Fedora's method, used by Sugar.

Quote from the above Fedora page
Issues using other Linux distributions
Ubuntu and derivative Linux distributions have a usb-creator program similar to Live USB Creator. This does not work with Fedora ISO images, it silently rejects them. usb-creator requires the ISO to have a Debian layout, with a /.disk/info file and a casper directory. Do not attempt to use this utility to write a Fedora ISO image.
The livecd-iso-to-disk script is not meant to be run from a non-Fedora system. Even if it happens to run and write a stick apparently successfully from some other distribution, the stick may well fail to boot. Use of livecd-iso-to-disk on any distribution other than Fedora is unsupported and not expected to work: please use an alternative method, such as the "direct write" methods described above.
end Quote

Persistence

Persistence in the context of a live USB system, is the ability to save both system changes, including Software updates, and the user's work between sessions, that is after shutdown and reboot.

Linux users, suggested methods

Linux users might consider reading the following pages for supported methods to install SoaS.

Users of Fedora and Red Hat derivitives:

Sugar on a Stick/Linux/Installation

Debian, Ubuntu, and derivitives, and other distros:

Make your SoaS from within a Sugar Live OS environment, which is itself a Fedora system.
Either Burn a Sugar.iso and follow the section of Sugar on a Stick/Installation entitled
"1. Burn a CD-ROM disc, boot from it, then run the script, livecd-iso-to-disk"
or create a Sugar image by dd or any of the methods on this page. Then boot into the Live OS, to create SoaS from the running Live OS image.


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!

Experimental

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)

Load SoaS further insight

This is known to work in Fedora and has been reported to work in 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.
  • Mount the 'SoaS.iso' image to reach the onboard livecd-iso-to-disk installation script:
sudo mkdir /run/soas/
sudo mount /path/to/Fedora-Live-SoaS-x86_64-20-1 /run/soas/
(mount: /dev/loop0 is write-protected, mounting read-only)
  • Change the working directory to the LiveOS folder on the SoaS.iso mount:
cd /run/soas/LiveOS
  • Execute ./livecd-iso-to-disk --help for usage details. (The file is already executable.)
  • Check the USB device node name on your system. In the example below, the scsi device is /dev/sdc and filesystem partition on that device is /dev/sdc1:
$ df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
rootfs      rootfs     20G   12G  7.5G  61% /
udev      devtmpfs    1.6G     0  1.6G   0% /dev
tmpfs        tmpfs    1.6G  904K  1.6G   1% /dev/shm
tmpfs        tmpfs    1.6G  788K  1.6G   1% /run
/dev/sda2     ext4     20G   12G  7.5G  61% /
tmpfs        tmpfs    1.6G     0  1.6G   0% /sys/fs/cgroup
tmpfs        tmpfs    1.6G     0  1.6G   0% /media
/dev/sda2     ext4     20G   12G  7.5G  61% /tmp
/dev/sda2     ext4     20G   12G  7.5G  61% /var/tmp
/dev/sda2     ext4     20G   12G  7.5G  61% /home
/dev/loop0 iso9660    668M  668M     0 100% /run/soas
/dev/sdc1     vfat    3.8G  4.0K  3.8G   1% /run/media/MyAccount/MyUSBdiscMountPoint

Another way to find out the USB device node name on your system is issuing the command

   sudo fdisk -l

and looking in the output for the disk that corresponds to the USB device, e.g., a disk described with a stanza like

   Disk /dev/sd?: 1939 MB, 1939865600 bytes
   150 heads, 42 sectors/track, 601 cylinders, total 3788800 sectors
   Units = sectors of 1 * 512 = 512 bytes
   Sector size (logical/physical): 512 bytes / 512 bytes
   I/O size (minimum/optimal): 512 bytes / 512 bytes
   Disk identifier: 0x000e14bf
   
   Device Boot      Start         End      Blocks   Id  System
   /dev/sd?1   *        2048     3784703     1891328    c  W95 FAT32 (LBA)

where ? in /dev/sd? is (usually) a letter of the alphabet.

If you have only one storage device with 2 GB of nominal capacity, it will be easy to recognize the USB device in the fdisk output by looking at which device has (about) 2 GB of capacity. In the example above, "Disk /dev/sd?" reports to be as large as 1939 MB, that is almost 2 GB.

If you have more than one disk with about 2 GB of capacity, consider moving to a situation where you'll have only one device with 2 GB of capacity, because this will help out a lot in recognizing the drive correctly.

  • Unmount the drive,
sudo umount /run/media/MyAccount/MyUSBdiscMountPoint
(The /run/media/MyAccount/ path is the new, standard Fedora mount point. Other operating systems may use /media/MyMountPoint.)
  • Check the disk partition table for a device, such as /dev/sdc,
sudo fdisk -l /dev/sdc   <----that's a lowercase letter 'L' for the list option.
    You should see something like the following:
    $ sudo fdisk -l /dev/sdc
    
    Disk /dev/sdc: 4012 MB, 4012900352 bytes
    124 heads, 62 sectors/track, 1019 cylinders, total 7837696 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0000a9c7
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1   *          62     7834071     3917005    c  W95 FAT32 (LBA)
    

    The asterisk, * , under the Boot column indicates that the partition is bootable.

        If it is missing, then execute the commands here:
    1. parted /dev/sdc
    2. toggle 1 boot
    3. quit
  • Run livecd-iso-to-disk as the root user, making sure to pass the correct USB device node name and to set overlay and home size appropriately, depending on the target USB device storage capacity.
./livecd-iso-to-disk --reset-mbr --overlay-size-mb 500 --home-size-mb 800 --unencrypted-home /path/to/downloaded.iso /dev/sd?1
If the command fails telling you that /dev/sd?1 does not exist, try using the command for /dev/sd? (the name of the device) and not for /dev/sd?1 (the name of the partition), like this:
./livecd-iso-to-disk --reset-mbr --overlay-size-mb 500 --home-size-mb 800 --unencrypted-home /path/to/downloaded.iso /dev/sd?
If the command fails returning a complaint about the filesystem not being mounted, and you can afford to loose all data on the USB device, you can try reformatting the USB device filesystem:
  • mount the USB device (e.g., by unplugging and re-inserting it),
  • repeat the steps for learning its device name (there can be situations when the device name has changed!)
  • issue the command with the --format --msdos options, like this:
Warning.png
Warning
The command described here will ask for a confirmation and will destroy all pre-existing data on your USB device.
See also How to Damage a FLASH Storage Device for a discussion of why using the factory format is preferred.
./livecd-iso-to-disk --reset-mbr --format --msdos --overlay-size-mb 500 --home-size-mb 800 --unencrypted-home /path/to/downloaded.iso /dev/sd?
In the above examples, the /path/to/downloaded.iso may be substituted with /dev/loop0, as this is the loop device that the mount command chose.
35px-Activity-write.png
Note
Additional USB or SD devices may be loaded from a running Sugar on a Stick image that was loaded with the livecd-iso-to-disk script (but not those installed by other methods) by running this command in the Terminal Activity as a root user:
/run/initramfs/live/LiveOS/livecd-iso-to-disk --reset-mbr --overlay-size-mb 500 --home-size-mb 800 --unencrypted-home /run/initramfs/livedev /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 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).
  • A --delete-home option is available to avoid an error message while requesting both a new home (with --home-size-mb) when there is already a persistent home on the device). You wouldn't use the --delete-home option on an upgrade of the operating 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 800 for the home folder).
If you have sufficient capacity on your target device, and format it with an ext[234] filesystem to overcome the 4096-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 800 --unencrypted-home /home/MyAccount/Downloads/Fedora-Live-SoaS-x86_64-20-1.iso /dev/sdc1
Verifying image...
/home/MyAccount/Downloads/Fedora-Live-SoaS-x86_64-20-1.iso:    b0a9414ff7eb79b680d5c86440e19587
Fragment sums: 9bfe23577651c88dcfb78c76ac3a28a5c53eead4561e3bdc5921b8b2e748
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
    630,784,000 100%    1.96MB/s    0:05:06 (xfr#1, to-chk=0/1)
osmin.img
          8,192 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=0/1)
Updating boot config file
Initializing persistent overlay file
500+0 records in
500+0 records out
524288000 bytes (524 MB) copied, 216.717 s, 2.4 MB/s
Initializing persistent /home
800+0 records in
800+0 records out
838860800 bytes (839 MB) copied, 344.643 s, 2.4 MB/s
Formatting unencrypted /home
mke2fs 1.42.8 (20-Jun-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
51296 inodes, 204800 blocks
10240 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=209715200
7 block groups
32768 blocks per group, 32768 fragments per group
7328 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840

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

tune2fs 1.42.8 (20-Jun-2013)
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.