VirtualBox/Preparing a disk image
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.)
Installing SoaS iso image
- Create a new VM.
- Choose Linux->Fedora
- Choose 256MB
- Create a new disk image, 2GB
- Finish.
- Download the lastest SoaS, http://download.sugarlabs.org/soas/snapshots/2/?C=M;O=D, for Fedora-12.
- Mount SoaS ISO as a CD-ROM in the newly created VM.
- 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.
- Boot VM
- Type you name and startup Sugar.
- Open Terminal.
- su -
- parted /dev/sda
- mklabel msdos -- make partition table
- mkpartfs primary ext2 0 2048
- toggle 1 boot
- quit
- umount /dev/sda1 -- (not required with soas06.iso)
- /media/soas06/LiveOS/livecd-iso-to-disk --overlay-size-mb 300 --home-size-mb 160 --unencrypted-home --delete-home /dev/sr0 /dev/sda1
- (for earlier versions of SoaS, use /mnt/live/LiveOS/livecd-iso-to-disk ...)
- 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.)
- the --unencrypted-home option prevents password protection and encryption on the /home/liveuser folder. This releaves the overhead on the compressed sqaushfs 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.
- shutdown -h now
Installing VirtualBox Guest Additions
- Unmount CDROM in VirtualBox settings
- Mount VBoxGuestAdditions.iso in its place.
- Boot VM
- (Fails for soas06.iso, cycling between to two screen resolution modes.)
- Open Terminal
- su -
- yum install dkms gcc make ppl binutils glibc-devel glibc-headers kernel-headers kernel-devel
yum.log:
Apr 27 21:42:42 Updated: libgcc-4.4.0-1.i586 Apr 27 21:42:44 Updated: libgomp-4.4.0-1.i586 Apr 27 21:42:47 Installed: ppl-0.10.1-1.fc11.i586 Apr 27 21:42:48 Installed: cloog-ppl-0.15-0.8.git1334c.fc11.i586 Apr 27 21:42:54 Updated: cpp-4.4.0-1.i586 Apr 27 21:43:03 Installed: binutils-2.19.51.0.2-17.fc11.i586 Apr 27 21:43:59 Installed: kernel-devel-2.6.29.1-102.fc11.i586 Apr 27 21:44:04 Installed: kernel-headers-2.6.29.1-102.fc11.i586 Apr 27 21:44:05 Installed: 1:make-3.81-15.fc11.i586 Apr 27 21:44:09 Installed: glibc-headers-2.9.90-19.i586 Apr 27 21:44:11 Installed: glibc-devel-2.9.90-19.i586 Apr 27 21:44:21 Installed: gcc-4.4.0-1.i586
Apr 27 21:44:24 Installed: dkms-2.0.19.1-2.fc11.noarch
- go to VirtualBox Devices Menu->Install Guest Additions
- mkdir /mnt/cdrom
- mount /dev/sr0 /mnt/cdrom
- cd /mnt/cdrom
- ./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.
- reboot
Configure Screen
- 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
Clear user data
Finally,
- Open Terminal
- Terminal
- rm -rf ~/.sugar (if distributing image)
- su -
- shutdown -h now
- 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:
- 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]
- Reclone any virtual hard disks you would like to archive.
SSH connections
To enable SSH communications, we need to open the firewall for SSH, permit no password for the ssh deamon, and start the sshd service:
- in Terminal,
- su -
- system-config-firewall
- close the startup warning dialog
- check mark the SSH service
- click the apply action button, approve change
- File>Quit
- pico /etc/ssh/sshd_config
- [add] PermitEmptyPasswords yes
- ^O (WriteOut), <Enter> on File Name to Write: /etc/ssh/sshd_config , ^X (Exit)
- chkconfig --level 345 sshd on
- service sshd start