VirtualBox/Preparing a disk image

LiveOS image
Below are instructions for preparing a VirtualBox disk image from a SoaS iso image file. The process parallels the compressed LiveOS image used on Live CD and Live USB installations.
 * (Taken from Dave Bauer's posting at http://schools.sugarlabs.org/mod/forum/discuss.php?d=27.)
 * Updated 16 August 2010 with VirtualBox 3.2.8 and 32-bit Fedora.

(Note: The SoaS .iso distribution also contains an installer for full, uncompressed, hard disc images of Fedora with the Sugar graphical interface. See Uncompressed, hard disc image below for instructions.)

Installing SoaS .iso image

 * 1) Create a new VM, choose a name, such as Mirabelle
 * 2) Choose Linux for the Operating System and Version Fedora (use 64 bit, if available)
 * 3) Choose Base Memory Size: 256 MB to match an XO-1, 512 or 1024 MB to match an XO-1.5
 * 4) Create a new virtual hard disk image with dynamically expanding storage of 2 GB
 * 5) Finish.
 * 6) Download the lastest SoaS, http://spins.fedoraproject.org/soas/#downloads, for Fedora 13.
 * 7) Mount the SoaS .iso image file as a CD-ROM in the newly created VM.
 * 8) Change the Network Attached to: Bridged Adapter  (This allows for networking with the host computer.)
 * 9) Start the VM
 * 10) Enter an account name and startup Sugar.
 * 11) Open Terminal.
 * 12) su -
 * 13) parted
 * 14) mklabel msdos
 * This makes a partition table.
 * 1) mkpart primary ext2 0 2048
 * You will receive this message: Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel?
 * Enter (I)gnore
 * 1) toggle 1 boot
 * 2) quit
 * 3) mke2fs /dev/sda1
 * 4) /LiveOS/livecd-iso-to-disk --overlay-size-mb 1024 --home-size-mb 200 --delete-home --unencrypted-home /dev/sr0 /dev/sda1 (for earlier versions of SoaS
 * Blueberry - use /media/soas-2-blueberry/LiveOS/livecd-iso-to-disk Strawberry - use /mnt/live/LiveOS/livecd-iso-to-disk)


 * the --overlay-size-mb NNN and --home-size-mb NNN options creates space for persistence of changes on the disk; otherwise, a liveOS disk is read-only. See LiveOS image.
 * The following optional parameters seem to be incompatible with soas-1-strawberry and soas-2-blueberry released versions. (The script completes successfully, but the virtual machine startup process has trouble finding the home directory and fails to complete.)

  shutdown -h now 
 * the --home-size-mb NNN option creates space for file storage in the /home/liveuser folder. (In the case where you you want to update the LiveOS image while keeping the user files, skip the new disk creation and parted steps, leave out the --home-size-mb NNN option at this step, and continue on.)
 * the --unencrypted-home option prevents password protection and encryption on the /home/liveuser folder. This releaves the overhead on the compressed SquashFS, and should be more robust to file system failures (outside of security).
 * 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 (with --unencrypted-home). (You wouldn't use this option for the LiveOS upgrade case.)

Installing VirtualBox Guest Additions
The VirtualBox Guest Additions requires installing DKMS and compiling virtual device drivers for the Linux kernel. Determine the kernel version, uname -a Linux localhost.localdomain 2.6.33.3-85.fc13.i686 #1 SMP Thu May 6 18:44:12 UTC 2010 i686 i686 i386 GNU/Linux  For SoaS-Mirabelle, the kernel is Linux-2.6.33.3-85.fc13, so specific kernel-headers and kernel-devel are needed: yum install kernel-headers-2.6.33.3-85.fc13 kernel-devel-2.6.33.3-85.fc13 dkms gcc
 * 1) Unmount CD/DVD in VirtualBox settings, select 'Empty' for the CD/DVD device under 'Attributes'
 * 2) Start the virtual machine
 * 3) Open Terminal
 * 4) su -
 * (Other dependencies will be called into the installation.)

{{Show| [root@localhost ~]# yum install kernel-devel-2.6.33.3-85.fc13 kernel-headers-2.6.33.3-85.fc13 dkms gcc Loaded plugins: presto, refresh-packagekit Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package dkms.noarch 0:2.1.0.1-1.fc12 set to be updated ---> Package gcc.i686 0:4.4.4-10.fc13 set to be updated --> Processing Dependency: cpp = 4.4.4-10.fc13 for package: gcc-4.4.4-10.fc13.i686 --> Processing Dependency: libgomp = 4.4.4-10.fc13 for package: gcc-4.4.4-10.fc13.i686 --> Processing Dependency: libgcc >= 4.4.4-10.fc13 for package: gcc-4.4.4-10.fc13.i686 --> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.4-10.fc13.i686 --> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.4.4-10.fc13.i686 ---> Package kernel-devel.i686 0:2.6.33.3-85.fc13 set to be installed ---> Package kernel-headers.i686 0:2.6.33.3-85.fc13 set to be updated --> Running transaction check ---> Package cloog-ppl.i686 0:0.15.7-1.fc12 set to be updated --> Processing Dependency: libppl.so.7 for package: cloog-ppl-0.15.7-1.fc12.i686 --> Processing Dependency: libppl_c.so.2 for package: cloog-ppl-0.15.7-1.fc12.i686 ---> Package cpp.i686 0:4.4.4-10.fc13 set to be updated ---> Package glibc-devel.i686 0:2.12-3 set to be updated --> Processing Dependency: glibc = 2.12-3 for package: glibc-devel-2.12-3.i686 --> Processing Dependency: glibc-headers = 2.12-3 for package: glibc-devel-2.12-3.i686 --> Processing Dependency: glibc-headers for package: glibc-devel-2.12-3.i686 ---> Package libgcc.i686 0:4.4.4-10.fc13 set to be updated ---> Package libgomp.i686 0:4.4.4-10.fc13 set to be updated --> Running transaction check --> Processing Dependency: glibc = 2.12-1 for package: glibc-common-2.12-1.i686 ---> Package glibc.i686 0:2.12-3 set to be updated ---> Package glibc-headers.i686 0:2.12-3 set to be updated ---> Package ppl.i686 0:0.10.2-10.fc12 set to be updated --> Running transaction check ---> Package glibc-common.i686 0:2.12-3 set to be updated --> Finished Dependency Resolution

Dependencies Resolved

=
==================================================================================== Package                 Arch             Version                       Repository         Size

=
==================================================================================== Installing: dkms                    noarch           2.1.0.1-1.fc12                fedora             95 k gcc                      i686             4.4.4-10.fc13                 updates           8.1 M kernel-devel             i686             2.6.33.3-85.fc13              fedora            6.3 M kernel-headers           i686             2.6.33.3-85.fc13              fedora            760 k Installing for dependencies: cloog-ppl               i686             0.15.7-1.fc12                 fedora             81 k cpp                      i686             4.4.4-10.fc13                 updates           3.4 M glibc-devel              i686             2.12-3                        updates           960 k glibc-headers            i686             2.12-3                        updates           599 k ppl                      i686             0.10.2-10.fc12                fedora            1.1 M Updating for dependencies: glibc                   i686             2.12-3                        updates           4.3 M glibc-common             i686             2.12-3                        updates            14 M libgcc                   i686             4.4.4-10.fc13                 updates           103 k libgomp                  i686             4.4.4-10.fc13                 updates           109 k

Transaction Summary

=
==================================================================================== Install      9 Package(s) Upgrade      4 Package(s)

Total download size: 40 M Is this ok [y/N]: y Downloading Packages: Setting up and reading Presto delta metadata updates/prestodelta                                                      |  87 kB     00:18 fedora/prestodelta                                                       |  414 B     00:00 Processing delta metadata Package(s) data still to download: 40 M (1/13): cloog-ppl-0.15.7-1.fc12.i686.rpm                                 |  81 kB     00:06 (2/13): cpp-4.4.4-10.fc13.i686.rpm                                       | 3.4 MB     01:47 (3/13): dkms-2.1.0.1-1.fc12.noarch.rpm                                   |  95 kB     00:09 (4/13): gcc-4.4.4-10.fc13.i686.rpm                                       | 8.1 MB     04:06 (5/13): glibc-2.12-3.i686.rpm                                            | 4.3 MB     01:50 (6/13): glibc-common-2.12-3.i686.rpm                                     |  14 MB     04:43 (7/13): glibc-devel-2.12-3.i686.rpm                                      | 960 kB     00:22 (8/13): glibc-headers-2.12-3.i686.rpm                                    | 599 kB     00:15 (9/13): kernel-devel-2.6.33.3-85.fc13.i686.rpm                           | 6.3 MB     03:25 (10/13): kernel-headers-2.6.33.3-85.fc13.i686.rpm                        | 760 kB     00:24 (11/13): libgcc-4.4.4-10.fc13.i686.rpm                                   | 103 kB     00:05 (12/13): libgomp-4.4.4-10.fc13.i686.rpm                                  | 109 kB     00:04 (13/13): ppl-0.10.2-10.fc12.i686.rpm                                     | 1.1 MB     00:26 - Total                                                            32 kB/s |  40 MB     21:10 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing    : kernel-devel-2.6.33.3-85.fc13.i686                                       1/17 Installing    : kernel-headers-2.6.33.3-85.fc13.i686                                     2/17 Updating      : libgcc-4.4.4-10.fc13.i686                                                3/17 Installing    : dkms-2.1.0.1-1.fc12.noarch                                               4/17 Updating      : glibc-2.12-3.i686                                                        5/17 Updating      : glibc-common-2.12-3.i686                                                 6/17 Updating      : libgomp-4.4.4-10.fc13.i686                                               7/17 Installing    : ppl-0.10.2-10.fc12.i686                                                  8/17 Installing    : cloog-ppl-0.15.7-1.fc12.i686                                             9/17 Installing    : cpp-4.4.4-10.fc13.i686                                                  10/17 Installing    : glibc-headers-2.12-3.i686                                               11/17 Installing    : glibc-devel-2.12-3.i686                                                 12/17 Installing    : gcc-4.4.4-10.fc13.i686                                                  13/17 Cleanup       : libgomp-4.4.4-2.fc13.i686                                               14/17 Cleanup       : glibc-common-2.12-1.i686                                                15/17 Cleanup       : glibc-2.12-1.i686                                                       16/17 Cleanup       : libgcc-4.4.4-2.fc13.i686                                                17/17

Installed: dkms.noarch 0:2.1.0.1-1.fc12                  gcc.i686 0:4.4.4-10.fc13 kernel-devel.i686 0:2.6.33.3-85.fc13          kernel-headers.i686 0:2.6.33.3-85.fc13

Dependency Installed: cloog-ppl.i686 0:0.15.7-1.fc12    cpp.i686 0:4.4.4-10.fc13      glibc-devel.i686 0:2.12-3 glibc-headers.i686 0:2.12-3       ppl.i686 0:0.10.2-10.fc12

Dependency Updated: glibc.i686 0:2.12-3             glibc-common.i686 0:2.12-3     libgcc.i686 0:4.4.4-10.fc13 libgomp.i686 0:4.4.4-10.fc13

Complete! }}   In the VirtualBox Guest 'Devices Menu', select 'Install Guest Additions...'  mkdir /mnt/cdrom   mount /dev/sr0 /mnt/cdrom/   cd /mnt/cdrom/ </li>  ./VBoxLinuxAdditions-x86.run You may check the consumption status of the overlay by executing,
 * dmsetup status
 * reveals that 953440/2097152 (512-byte sectors) or 448 MB of the 1024 MB overlay file has been consumed by the installation process

</li>  reboot
 * If upgrading from one VirtualBox version to another, start with fresh virtual disks and machines built with the new versions to avoid breakage.

</li> </ol>

Configure Screen
If you want to match the 16 bpp XO screen and a particular display size, you may
 * 1) Edit /etc/X11/xorg.conf to match the following section:
 * 2) * 832x624 - matches default XO display proportions
 * 3) * 1200x900 - XO reflective resolution
 * 1) VirtualBox generated configuration file
 * 2) based on /etc/X11/xorg.conf.

Section "Monitor" Identifier  "Monitor[0]" ModelName   "VirtualBox Virtual Output" VendorName  "Sun Microsystems Inc" EndSection

Section "Device" BoardName   "VirtualBox Graphics" Driver      "vboxvideo" Identifier  "Device[0]" VendorName  "Sun Microsystems Inc" EndSection

Section "Screen" Identifier  "Screen[0]" Device      "Device[0]" Monitor     "Monitor[0]" DefaultDepth 16 SubSection "Display" Depth     16 Modes     "832x624" "1200x900" "1024x768" "800x600" EndSubSection EndSection

Clear user data
Finally,
 * 1) Open Terminal
 * 2) Terminal
 * 3) rm -rf ~/.sugar (if distributing image)
 * 4) su -
 * 5) shutdown -h now
 * 6) Now you can share the VDI file.

Backup discs
It would be wise to maintain a clone of your virtual disk image to restart if the working copy is damaged:
 * 1) From host command line (Windows cmd, or Linux terminal)  See VirtualBox Help section 8.14.
 * 2) * VBoxManage clonehd        |  [-format VDI|VMDK|VHD|RAW| ] [-remember]
 * 3) Reclone any virtual hard disks you would like to archive.

SSH connections
To enable SSH communications, we need to permit no passwords (to match the default Sugar configuration) in the ssh daemon configuration:


 * 1) in Terminal,
 * 2) su -
 * 3) vi /etc/ssh/sshd_config
 * 4) [add] PermitEmptyPasswords yes
 * :wq <Enter>
 * 1) service sshd restart

One may also supply a password for the root user:
 * 1) su -
 * 2) passwd
 * Changing password for user root. New password: Retype new password: passwd: all authentication tokens updated successfully.

Uncompressed, hard disc image

 * Start VirtualBox (version 3.2.10 used here).


 * 1) Click NEW "Welcome to New Virtual Machine Wizard"
 * 2) <Next> fill out: Name (soas-i386-20101025) ; Operating system(Linux); Version (Fedora)
 * 3) <Next> Base Memory Size
 * 4) <Next> Create new hard disk
 * 5) <Next> Storage Type (Dynamically expanding storage)
 * 6) <Next> Size (8.00 GB)
 * 7) <Finish>
 * Back on main Oracle VM VirtualBox screen


 * 1) Settings/Storage (CD Image0)CD/DVD Device: (Select your CD Host Drive-(sr0) with CD inserted
 * 2) <OK>
 * Start
 * SoaS will boot and run Sugar SoaS
 * Enter Name color
 * Enter Password ONE TIME then cancel next 6 times
 * Start Sugar-Terminal

su liveinst
 * (Anaconda starts) Do normal HD install: Basic Storage Devices/ Reinitalize all/Host/TZ/Root Password/Use all Space/ Write Changes to Disk/ Install works to Completion.
 * "Congratulations, your Fedora Installation is complete" <Close> Quit sugar-terminal; Shutdown.
 * Back on main Oracle VM VirtualBox screen

Firstboot of new Virtual Machine

 * Settings/Storage; Host Drive: change to empty (You can also change boot order in Systems, if needed.)
 * Start HD goes to firstboot (Answer questions); then to gdm login, then to Sugar. Click to Change Color_____ (hit <Back> to change name)

Export your Appliance

 * File/Export Appliance (select soas-i386-20101025) fill in Settings if you want to; Export settings <Finish>

Congratulations, you have just created an importable/exportable appliance.