VirtualBox/Preparing a disk image

From Sugar Labs
Jump to navigation Jump to search

Instructions for preparing a VirtualBox disk image from a SoaS iso image file.

Installing SoaS iso image

  1. Create a new VM, choose a name such a Mirabelle
  2. Choose Linux for the Operating System and Version Fedora (64 bit)
  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://alt.fedoraproject.org/pub/alt/nightly-composes/soas/, 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 /dev/sda
  14. mklabel msdos
    This makes a partition table.
  15. mkpart primary ext2 0 2048
  16. toggle 1 boot
  17. quit
  18. mke2fs /dev/sda1
  19. /LiveOS/livecd-iso-to-disk --overlay-size-mb 200 --home-size-mb 200 --delete-home --unencrypted-home /dev/live /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.)
    • the --home-size-mb NNN option creates space for saving the /home/liveuser folder if you want to update the OS image while keeping the user files. (In this case, skip the new disk creation and parted steps and 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 on an upgrade.
  20. shutdown -h now

Installing VirtualBox Guest Additions

  1. Unmount CDROM in VirtualBox settings
  2. Mount VBoxGuestAdditions.iso in its place.
  3. Boot VM
  4. Open Terminal
  5. su -
  6. yum install dkms gcc
    (Other dependencies will be called into the installation.)


  1. cd /media/VBOXADDITIONS_3.2.0_61806/
  2. ./VBoxLinuxAdditions-amd64.run
    • (This fails currently. More testing and debugging needed.)
    • If upgrading from one VirtualBox version to another, start with fresh virtual disks and machines built with the new versions to avoid breakage.
  3. reboot

Configure Screen

  1. Edit /etc/X11/xorg.conf to match the following section: (This is for 1200x900 (XO) and other resolutions.)
# VirtualBox generated configuration file
# 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      "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.
    • VBoxManage clonehd <uuid>|<filename> <outputfile> [-format VDI|VMDK|VHD|RAW|<other>] [-remember]
  2. Reclone any virtual hard disks you would like to archive.

SSH connections

To enable SSH communications, we need to permit no passwords in the ssh daemon configuration:

  1. in Terminal,
  2. su -
  3. pico /etc/ssh/sshd_config
    1. [add] PermitEmptyPasswords yes
    2. ^O (WriteOut), <Enter> on File Name to Write: /etc/ssh/sshd_config , ^X (Exit)
  4. service sshd restart