Difference between revisions of "VirtualBox/Preparing a disk image"

From Sugar Labs
Jump to navigation Jump to search
(--home-size-mb option added)
(skip --home-size-mb NNN option for now)
Line 21: Line 21:
 
# toggle 1 boot
 
# toggle 1 boot
 
# quit
 
# quit
# /mnt/live/LiveOS/livecd-iso-to-disk --overlay-size-mb 256 --home-size-mb 256 /dev/sr0 /dev/sda1
+
# /mnt/live/LiveOS/livecd-iso-to-disk --overlay-size-mb 256 <s>--home-size-mb 256</s> /dev/sr0 /dev/sda1
 
#* the --overlay-size-mb NNN option creates space for persistence of changes on the disk; otherwise, a liveOS disk is read-only.
 
#* the --overlay-size-mb NNN option creates space for persistence of changes on the disk; otherwise, a liveOS disk is read-only.
#* 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.
+
#* <s>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.</s> (This option causes login in problems on VirtualBox with the liveuser account and should be skipped for now.)
 
# shutdown -h now
 
# shutdown -h now
 
# Unmount CDROM in Vbox config
 
# Unmount CDROM in Vbox config

Revision as of 02:17, 2 March 2009

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

(Taken from Dave Bauer's posting at http://schools.sugarlabs.org/mod/forum/discuss.php?d=27.)
  1. Create a new VM.
  2. Choose Linux->Fedora
  3. Choose 256MB
  4. Create a new disk image, 2GB
  5. Finish.
  6. Download the lastest SoaS, http://download.sugarlabs.org/soas/snapshots/1/?C=M;O=D, for Fedora10.
  7. Mount SoaS ISO as a CD-ROM in the newly created VM.
  8. Change Network Adapter to Intel Pro/1000 MT Desktop (82540EM)
    • recommended by VirtualBox for modern hosts -- Default of PCnet-FAST III (Am79C973) also worked on Ubuntu 8.10 and Vista hosts.
    • Select Attached to: Host Interface -- allows local networking for SSH connections to probe the file system.
  9. Boot VM
  10. Type you name and startup Sugar.
  11. Open Terminal.
  12. su -
  13. parted /dev/sda
  14. mklabel msdos -- make partition table
  15. mkpartfs primary ext2 0 2048
  16. toggle 1 boot
  17. quit
  18. /mnt/live/LiveOS/livecd-iso-to-disk --overlay-size-mb 256 --home-size-mb 256 /dev/sr0 /dev/sda1
    • the --overlay-size-mb NNN option creates space for persistence of changes on the disk; otherwise, a liveOS disk is read-only.
    • 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. (This option causes login in problems on VirtualBox with the liveuser account and should be skipped for now.)
  19. shutdown -h now
  20. Unmount CDROM in Vbox config
  21. Boot VM
  22. Open Terminal
  23. su -
  24. yum install dkms gcc make binutils glibc-devel glibc-headers kernel-headers kernel-devel
  25. go to VirtualBox Devices Menu->Install Guest Additions
  26. mkdir /mnt/cdrom
  27. mount /dev/sr0 /mnt/cdrom
  28. cd /mnt/cdrom
  29. ./VBoxLinuxAdditions-x86.run
    • (This stalled on two trials; had to reboot and restart.)
    • If upgrading from one VirtualBox version to another, start with fresh virtual disks and machines built with the new versions to avoid breakage.
  30. reboot
  31. Edit /etc/X11/xorg.conf to match the following section: (This is for 1200x900 (XO) and other resolutions.)
# Default xorg.conf for Xorg 1.5+ without PCI_TXT_IDS_PATH enabled.
#
# This file was created by VirtualBox Additions installer as it
# was unable to find any existing configuration file for X.
 
Section "Device"
       Identifier "VirtualBox Video Card"
       Driver "vboxvideo"
EndSection
#
# From example in section 4.3.2 of the VirtualBox Help manual:
#
Section "Screen"
       Identifier "Default Screen"
       Device "VirtualBox Video Card"
       Monitor "Generic Monitor"
       DefaultDepth 16
       SubSection "Display"
               Depth 16
               Modes "1200x900" "1024x768" "800x600" "640x480"
       EndSubSection
EndSection

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.


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.


To enable SSH communications, we need to open the firewall for SSH, permit no password for the ssh deamon, and start the sshd service:

  1. in Terminal,
  2. su -
  3. system-config-firewall
    1. close the startup warning dialog
    2. check mark the SSH service
    3. click the apply action button, approve change
    4. File>Quit
  4. nano /etc/ssh/sshd_config
    1. [add] PermitEmptyPasswords yes
    2. ^O (WriteOut), <Enter> on File Name to Write: /etc/ssh/sshd_config , ^X (Exit)
  5. chkconfig --level 345 sshd on
  6. service sshd start