_images/00_soas4.png

SoaS Loader Home Page and Index

In this Activity we describe one way to load Sugar on to a USB Stick.

We are using the Fedora Spin named Sugar on a Stick, or SoaS for short. The tutorial contains some links like the one above, which, if you are online, will take you to useful pages on the internet. If using the Activity use the Back button at the top of the screen to return to your previous page or use the Home button to return to this page.

Sugarlabs wiki is a source of more information about Sugar.

OLPC laptop

Sorry, but it is not possible to make Sugar on a Stick using this method on an OLPC laptop.

The contents

Introduction

The first pages of this tutorial are aimed at new Sugar Learners. If you are familiar with Sugar, the work starts at Getting to work.

To make Sugar on a Stick by this method you must be running a SoaS Live CD or other LiveOS host media. The page, Prerequisites, reviews how to obtain this. This presentation assumes you are running that environment.

You will need a clean USB memory stick, to use as the target device. There is a suitable command for a 2 GB or a 4 GB stick.

The Activity, SoaS Loader, is started from the F3, Home View:

_images/002a.png

To use the online version

Open Browse Activity.

_images/002b.png

In the address bar, type

http://soas-loader.readthedocs.org

the presentation opens.

_images/002c.png

New to Sugar

New Sugar learners

_images/003.png

On the next slide we see F3, Home view, Favourites. This shows your “favourite” Activities listed in a wheel.

In Sugar you can visit that view now by pressing the function key F3, Home view.

You can return to this page by pressing the function key F4, Activity view.

Function keys are the keys along the top of your keyboard, numbered F1 to F12.

F3, Home View, Favourites

_images/004.png

View toolbar

Please use the View toolbar to get the best view of the page.

_images/005.png

Zoom in, zoom out, or Full screen are possible.

Next up, Help Activity

If you are still new to Sugar you will find lots of help in the Activity Help, explored in the next slides.

In Sugar we never “Double Click” icons. A single click is correct.

We can hover the cursor over an icon to reveal what the icon or button does. Usually a click of the “secondary” mouse button, right click, shows an extended list of options for that icon.

Click on the Help Activity icon

Pressing the Help Activity icon, resumes Help.

A right click displays all options, in this case, resume or Start new

_images/006.png

Help Activity opens at Home page

_images/007.png

The Frame

The Frame is essential to navigating in Sugar.

_images/F6Frame.png

Access the Frame with the function key, F6, Frame key, or by moving the cursor to the “hot” corners of the screen.

If you are new to Sugar look up the Frame in Help Activity.

In the next screen shot, the Frame is brought in over an image we saw earlier.

You might want to find My Settings

_images/010.png

My Settings screen

You can change Frame settings.

_images/011.png

Frame settings

_images/012.png

Unhide the Terminal Acivity

Your newly started version of Sugar (by default) does not include the Terminal Activity in the favourites wheel.

_images/F3zoom.png

Go to F3, Home view, click on the List view button on the top right of the screen.

_images/013.png

F3, Home view, List

_images/014.png

Return to the wheel view

Click on the Favourite view button on the top right of the screen.

_images/016.png

Click on the Terminal Activity icon

Starts (or resumes the last) Terminal Activity.

If you are new to the Terminal, Help Activity is your friend, and contains a useful chapter in the section Activities.

_images/020.png

In this image we see a secondary mouse click (right click) Start new.

Terminal Activity, ready

The flashing cursor sits at the end of a short piece of text. This is called the prompt.

_images/021.png

For help in Terminal Activity

Press the Help icon in the centre of the tool bar to reveal a short help file.

_images/022.png

Further help

Bring in the Frame with the F6, Frame key (The Frame).
_images/F6Frame.png

Right click on Terminal Activity icon, and click on View Help.

_images/023.png

Context sensitive Help

The relevant page from Help Activity is now open in a window within the Terminal.

_images/024.png

Social Help

Post questions on an open forum

_images/024_1.png

for developers or other users to answer.

_images/024_2.png

Keyboard shortcuts

Copy - the keyboard shortcut is Ctrl + C to copy.

Paste - the keyboard shortcut is Shift + Ctrl + V to paste into Terminal Activity.

(Also convenient is to press the centre mouse button to paste into a terminal.)

Workflow

You could type some or all of the commands provided into Terminal Activity.

This presentation shows these images:

  • the command is selected from the page.
  • the command is copied (with Ctrl + C).
  • the command pasted into Terminal Activity with the Sugar Paste button.
  • an image showing Terminal Activity after the command is run.

Terminal Activity, Edit toolbar, showing Paste button

The Terminal Activity includes an Edit toolbar, with Paste button.

You can choose whether you prefer to use Shift + Ctrl + V or the Paste button.

_images/025_1.png

Demonstration

Demonstrating copy and paste with date

Here is a simple command,

date

The computer’s output from the command date is to print out the date.

In Sugar, if we want to copy and paste the above command into the terminal, we can take the following steps. The following slides demonstrate the process. We opened Terminal Activity earlier (Click on the Terminal Activity icon), it is running in the background.

Use the mouse to select the command.

Copy, use the keyboard shortcut Ctrl + C (Keyboard shortcuts).

Press F6, Frame key to bring in the Frame (The Frame).

Click on the Terminal Activity icon in the Frame.

Terminal opens.

Open the Edit tab.

Click the Paste button, the command date appears at the prompt.

Press Enter to run the command, and display the output.

Press F6, Frame key to bring in the Frame again.

Press SoaS Loader icon to return to this tutorial.

Here is the command

_images/030.png

Use the mouse to select the command

_images/031.png

Copy

Use keyboard shortcut Ctrl + C

Notice the clipping appears in bottom left corner of screen.

_images/032.png

Press F6, Frame key

to bring in the Frame.

_images/033.png

Click on the Terminal Activity icon

_images/034.png

Terminal opens

_images/035.png

Open the Edit tab

_images/036.png

Click the Paste button

The date appears at the prompt.

_images/037.png

Press Enter

The date is displayed as soon as you press Enter.

_images/038.png

Notice, that the prompt returns, ready for the next command.

Press F6, Frame key

_images/039.png

Press SoaS Loader icon

to switch back to this tutorial.

_images/040.png

If this is all new

there are links to Help within Sugar in the section starting New Sugar learners.

Demonstration ends

_images/041.png

SoaS Loader work starts here

_images/00_soas1.jpg

Getting to work

_images/00_soas1.jpg

We use just three commands. Let’s look at them.

For convenience, the commands are also printed in a compact form on the next page, Command list.

Disk free

df -Th

We use disk free to establish the device location.

We run the command once before inserting the target USB stick.

We plug in the USB stick.

We run the command again.

The difference between the two outputs provides an “address” for the target USB stick.

Unmount

To unmount the target USB stick, the command is:

umount /dev/sd?1

Replacing ? with your drive letter.

That is, replacing /dev/sd?1 with the “address” for your target USB stick.

If editing the command line is new to you there pointers to Help in the section, starting New Sugar learners.

Using the script

important

It is important to get this right as there is a risk of destroying data. If you aim the livecd-iso-to-disk command at your hard drive you could destroy your operating system.

Here is a choice of two commands suitable to load Sugar onto either a 2 GB or 4 GB USB stick.

For a 2 GB USB stick

su -c "livecd-iso-to-disk --reset-mbr --overlay-size-mb 450 --home-size-mb 750 --unencrypted-home /run/initramfs/livedev /dev/sd?1"

replacing ? with your drive letter

For a 4 GB USB stick

su -c "livecd-iso-to-disk --reset-mbr --overlay-size-mb 700 --home-size-mb 2200 --unencrypted-home /run/initramfs/livedev /dev/sd?1"

replacing ? with your drive letter

more

For the curious

Command list

Disk free - to establish the drive letter.

df -Th

Unmount the target USB stick

umount /dev/sd?1

replacing ? with your drive letter.

Script command - 2 GB USB stick

su -c "livecd-iso-to-disk --reset-mbr --overlay-size-mb 450 --home-size-mb 750 --unencrypted-home /run/initramfs/livedev /dev/sd?1"

Script command - 4 GB USB stick

su -c "livecd-iso-to-disk --reset-mbr --overlay-size-mb 700 --home-size-mb 2200 --unencrypted-home /run/initramfs/livedev /dev/sd?1"

replacing ? with your drive letter.

Disk free, select

Select the first command, from Command list, as this image shows.

_images/301.png

Disk free, copy

Use the keyboard shortcut Ctrl + C to copy the command.

_images/302.png

Press F6, Frame key

to switch to Terminal Activity.

_images/303.png

Disk free, paste

The Terminal opens.

Press the Paste button within the Edit tab.

The command appears at the prompt.

_images/304.png

Disk free, enter

Press Enter, the command runs giving output like this.

_images/305.png

Press F6, Frame key

Click on the SoaS Loader Activity icon any time you want to switch back to the tutorial.

_images/307.png

Plug in the stick

Plug the clean memory stick, the target device, into the PC or laptop.

Allow a second for the USB stick to be recognized and then run again the first command.

Press F6, Frame key to switch to Terminal Activity

_images/303.png

Disk free, re-run the command

The Terminal opens.

There is a feature that allows Terminal Activity to store previously run commands.

With Terminal open on your screen tap the up arrow key on the keyboard once.

The last run command appears at the prompt.

_images/314.png

Note

You are able to scroll through all the commands you have run recently with the up arrow and down arrow keys.

Second disk free, enter

When you press Enter, the command runs, giving output like this.

_images/315.png

Press F6, Frame key

Click on the SoaS Loader Activity icon to switch back to the tutorial.

_images/317.png

Establish the drive letter

Notice the changed output is a new line at the bottom representing the newly inserted device.

_images/315.png

The new line reads:

/dev/sdd1   vfat  3.7G  4.0K  3.7G   1% /run/media/liveuser/Kingston

/dev/sdd1 is an “address” for my USB stick. In the commands which follow you must use the address you find.

You must alter the commands given, so that the commands are aimed at the address you find.

Put another way,

/dev   indicates       a location
/sd    indicates       scsi device
d      indicates       the drive letter
1      indicates       partition number

In my case the drive letter is d.

Footnote

Your identifier should end with the numeral 1. If not, or you get more than one new line of output, the USB stick you have inserted is not sufficiently ”clean”.

Either of the above indicate that the stick is not in a preferred format, for example vfat. If this is your first time doing this sort of job, a new USB stick would be ideal.

The script is able to deal with non-standard cases, but the installation will probably not be automatic, requiring some input from the user.

Unmount the target device

The second command detaches the USB stick from our PC, we unmount the USB stick.

The command is printed as:

umount /dev/sd?1

but it must be directed the “address” you find for your target USB stick.

The code above contains a question mark which will not be recognised as part of this command.

Paste the command (complete with ?) into the Terminal, then edit the question mark out of the command and replace it with your drive letter.

To edit a command already pasted into the Terminal use the left arrow key to move the cursor to the left into the text. When the cursor is over the ? press the delete key. Enter the replacement character from the keyboard. Clear the cursor away from the text with the right arrow key. Double check that the command is now correct.

umount, select

Select the command, from Command list.

_images/321.png

umount, copy

Use the keyboard shortcut Ctrl + C to copy the command.

_images/322.png

Press F6, Frame key, to switch Activities

_images/323.png

umount, paste

The Terminal opens.

Press the Paste button within the Edit tab.

The command will appear at the prompt, but don’t press Enter.

_images/324.png

umount, edit

Don’t press Enter yet.

Edit the command to correct the drive letter.

_images/325.png

Showing edit in progress

_images/325_1.png

umount, enter

Press Enter. The command will run with no output, and will return the prompt.

The command was accepted and no error reported - fine.

_images/326.png

Press F6, Frame key

Click on the SoaS Loader Activity icon to switch back to the tutorial.

_images/327.png

Script, select

Now we are ready for the final command.

Select the correct command for your 2 or 4 GB stick. Make sure you select the whole length of the command.

_images/331.png

Script, copy

Use the keyboard shortcut Ctrl + C to copy the command.

_images/332.png

Press F6, Frame key, to switch Activities

Press the function key F6 to bring in the frame. Click on the icon for Terminal.

_images/333.png

Script, paste

The Terminal opens.

Press the Paste button within the Edit tab.

The command appears at the prompt. Don’t press Enter.

Double check you have copied the whole command (check first and last characters).

_images/334.png

Script, edit drive letter

Don’t Press Enter yet.

Edit the command to correct the drive letter.

_images/335.png

Script, enter

Press Enter to start the script running.

It is possible that the script will stop and ask you for for further input, but in most cases the stick will be loaded in one go.

_images/336.png

Script running

It might take five to twenty minutes ...

_images/336_0.png

Script finishes

... and when successful will finish by reporting

“Target device is now set up with a Live image!”

Shutdown the physical machine. Remember to remove the CD (or other host media you just used).

_images/336_1.png

Press F6, Frame key

Click on the SoaS Loader Activity icon if you want to switch back to the tutorial.

_images/337.png

Transcript

This is the transcript of the successful build carried out in this tutorial.

[liveuser@localhost ~]$ df -Th
Filesystem          Type      Size  Used Avail Use% Mounted on
/dev/mapper/live-rw ext4      2.9G  1.9G  1.1G  65% /
devtmpfs            devtmpfs  958M     0  958M   0% /dev
tmpfs               tmpfs     976M   68K  976M   1% /dev/shm
tmpfs               tmpfs     976M  848K  976M   1% /run
tmpfs               tmpfs     976M     0  976M   0% /sys/fs/cgroup
/dev/sdb1           iso9660   713M  713M     0 100% /run/initramfs/live
tmpfs               tmpfs     976M   76K  976M   1% /tmp
vartmp              tmpfs     976M   12K  976M   1% /var/tmp
varcacheyum         tmpfs     976M     0  976M   0% /var/cache/yum
tmpfs               tmpfs     196M   12K  196M   1% /run/user/1000
tmpfs               tmpfs     196M  4.0K  196M   1% /run/user/993

USB stick inserted here.

[liveuser@localhost ~]$ df -Th
Filesystem          Type      Size  Used Avail Use% Mounted on
/dev/mapper/live-rw ext4      2.9G  1.9G  1.1G  65% /
devtmpfs            devtmpfs  958M     0  958M   0% /dev
tmpfs               tmpfs     976M   68K  976M   1% /dev/shm
tmpfs               tmpfs     976M  872K  976M   1% /run
tmpfs               tmpfs     976M     0  976M   0% /sys/fs/cgroup
/dev/sdb1           iso9660   713M  713M     0 100% /run/initramfs/live
tmpfs               tmpfs     976M   76K  976M   1% /tmp
vartmp              tmpfs     976M   12K  976M   1% /var/tmp
varcacheyum         tmpfs     976M     0  976M   0% /var/cache/yum
tmpfs               tmpfs     196M   12K  196M   1% /run/user/1000
tmpfs               tmpfs     196M  4.0K  196M   1% /run/user/993
/dev/sdd1           vfat      3.7G  4.0K  3.7G   1% /run/media/liveuser/Kingston
[liveuser@localhost ~]$ umount /dev/sdd1
[liveuser@localhost ~]$ su -c "livecd-iso-to-disk --reset-mbr --overlay-size-mb 700 --home-size-mb 2200 --unencrypted-home /run/initramfs/livedev /dev/sdd1"
Verifying image...
/dev/sdb1:   301f77b4c4429f8cd1c3dc83032c8a58
Fragment sums: 5f34ade9add3572bd968e3ee8b5b5e85516bc2f7a9a158e52ad3599b9df9
Fragment count: 20
Supported ISO: no
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
    703,807,488 100%    9.12MB/s    0:01:13 (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
700+0 records in
700+0 records out
734003200 bytes (734 MB) copied, 55.7006 s, 13.2 MB/s
Initializing persistent /home
2200+0 records in
2200+0 records out
2306867200 bytes (2.3 GB) copied, 193.214 s, 11.9 MB/s
Formatting unencrypted /home
mke2fs 1.42.11 (09-Jul-2014)
warning: Unable to get device geometry for /media/tgttmp.HPiI4B/LiveOS/home.img
Creating filesystem with 563200 4k blocks and 140832 inodes
Filesystem UUID: bd6770e9-3ed0-4f32-a18e-35b282a23319
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

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

tune2fs 1.42.11 (09-Jul-2014)
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!
[liveuser@localhost ~]$

Boot Sugar on a Stick

With your newly loaded Live USB stick plugged in to it, restart (or reboot) the machine.

more

http://wiki.sugarlabs.org/go/Sugar_on_a_Stick/Boot.

Appendix

For the curious

Provided with the download is the shell script livecd-iso-to-disc, which is included in the LiveOS directory of your Live CD (or other LiveOS media).

Let’s study the command we use to run the script livecd-iso-to-disk in detail.

su -c "livecd-iso-to-disk --reset-mbr --overlay-size-mb 450 --home-size-mb 750 --unencrypted-home /run/initramfs/livedev /dev/sd?1"
su -c ” “ A device to give you superuser privileges for just the one command in quotes.
livecd-iso-to-disk The script (or program) we are using.
–reset-mbr Create a boot record on the target USB stick, does not touch the PC master boot record.
–overlay-size-mb 450 Sets the amount of space available for system changes.
–home-size-mb 750 Sets the amount of space available for changes in Activities and user’s work.
–unencrypted-home The stick will not be encrypted.
/run/initramfs/livedev The source, on your CD or the LiveOS host you are using.
/dev/sd?1 The target USB stick.

How did we decide the overlay and home size?

In the script command these sizes (in mb) are used, with the livecd-iso size a rough estimate.

livecd-iso 700
overlay-size 400
home-size 750
Total 1850

The numbers we used in the tutorial will fit on a 2 GB USB stick with some unused space.

When you run livecd-iso-to-disk with impossibly large home and overlay sizes, the script will be interrupted and you will be given the chance to specify sizes which will optimally fit your stick.

Need to know more?

type

livecd-iso-to-disk --help

in the Terminal.

Credits

This presentation is informed by the Sugar Labs wiki and this page in the Fedora documentation.

more

http://wiki.sugarlabs.org/go/Sugar_on_a_Stick/Project_sitemap

Prerequisites

To run this Activity successfully you must be running the Fedora Spin named Sugar on a Stick.

Stage 0, Download

Involves downloading the Sugar_on_a_Stick.iso from Sugar Downloads.

If you are not yet running Sugar, the linked page contains more information about the SoaS download and getting it.

Stage 1, Make bootable media

The software contained in the download can be transferred to a CD to make a bootable Live CD. This is referred to as burning or writing a CD. This can be done using the default CD writing software of a PC.

There are other options which might suit some users.

You could use a program called UNetbootin to write the Sugar image to a USB stick, following these instructions. This is useful where you do not have a CD writer.

Expert Linux command line uses might use the dd command to transfer the Sugar_on_a_Stick.iso to a USB stick.

Both of the above methods produce a non-persistent Sugar on a Stick. A non-persistent Sugar on a Stick, like a Live CD, cannot save work after shutdown and reboot.

You could also use another Sugar on a Stick made using the SoaS Loader method.

You will then have booted your PC from one of the above.

Stage 2, the subject of this tutorial

SoaS Loader transfers the software producing a USB stick, or flashdrive, with persistence, where all work and changes are automatically saved, provided the system is shutdown correctly.

BIOS boot options

You will need to ensure the computer you plan to use is capable of booting from a USB stick.

On older machines, you will probably need to make a change in the BIOS (see your computer’s hardware documentation, it can often be found online). Change the Boot Order, so that “Boot from CD” or “Boot from USB” comes before “Boot from Hard Drive”.

Many newer computers detect the USB device as a hard drive.

Tip As the computer starts up, look out for a message on the screen inviting you to press a key, say F2, F12, F10, Delete, F11 or Esc. Press the appropriate key to interrupt the regular boot.

more

http://www.pendrivelinux.com/usb-bios-boot-options/

If you need more information, search for Change the Boot Order in BIOS, with the make and/or model of your machine in the search.