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.)
- Updated 21 May 2010 with VirtualBox 3.2.0 and 64-bit Fedora.
Installing SoaS iso image
- Create a new VM, choose a name such a Mirabelle
- Choose Linux for the Operating System and Version Fedora (64 bit)
- Choose Base Memory Size: 256 MB to match an XO-1, 512 or 1024 MB to match an XO-1.5
- Create a new virtual hard disk image with dynamically expanding storage of 2 GB
- Finish.
- Download the lastest SoaS, http://alt.fedoraproject.org/pub/alt/nightly-composes/soas/, for Fedora 13.
- Mount the SoaS .iso image file as a CD-ROM in the newly created VM.
- Change the Network Attached to: Bridged Adapter (This allows for networking with the host computer.)
- Start the VM
- Enter an account name and startup Sugar.
- Open Terminal.
- su -
- parted /dev/sda
- mklabel msdos -- make partition table
- mkpart primary ext2 0 2048
- toggle 1 boot
- quit
- mke2fs /dev/sda1
- /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.
- Blueberry - use /media/soas-2-blueberry/LiveOS/livecd-iso-to-disk
- shutdown -h now
Installing VirtualBox Guest Additions
- Unmount CDROM in VirtualBox settings
- Mount VBoxGuestAdditions.iso in its place.
- Boot VM
- Open Terminal
- su -
- yum install dkms gcc make
- (Other dependencies will be called into the installation.)
<yum.log from 21 May 2010:>
[root@localhost ~]# yum install dkms gcc make Loaded plugins: presto, refresh-packagekit fedora/metalink | 13 kB 00:00 fedora | 4.3 kB 00:00 fedora/primary_db | 13 MB 00:18 updates/metalink | 15 kB 00:00 updates | 4.5 kB 00:00 updates/primary_db | 867 kB 00:00 Setting up Install Process Package 1:make-3.81-18.fc12.x86_64 already installed and latest version Resolving Dependencies --> Running transaction check ---> Package dkms.noarch 0:2.1.0.1-1.fc12 set to be updated --> Processing Dependency: kernel-devel for package: dkms-2.1.0.1-1.fc12.noarch ---> Package gcc.x86_64 0:4.4.4-2.fc13 set to be updated --> Processing Dependency: cpp = 4.4.4-2.fc13 for package: gcc-4.4.4-2.fc13.x86_64 --> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.4-2.fc13.x86_64 --> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.4.4-2.fc13.x86_64 --> Running transaction check ---> Package cloog-ppl.x86_64 0:0.15.7-1.fc12 set to be updated --> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.fc12.x86_64 --> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.fc12.x86_64 ---> Package cpp.x86_64 0:4.4.4-2.fc13 set to be updated ---> Package glibc-devel.x86_64 0:2.12-1 set to be updated --> Processing Dependency: glibc-headers = 2.12-1 for package: glibc-devel-2.12-1.x86_64 --> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.x86_64 ---> Package kernel-devel.x86_64 0:2.6.33.4-95.fc13 set to be installed --> Running transaction check ---> Package glibc-headers.x86_64 0:2.12-1 set to be updated --> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.x86_64 --> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.x86_64 ---> Package ppl.x86_64 0:0.10.2-10.fc12 set to be updated --> Running transaction check ---> Package kernel-headers.x86_64 0:2.6.33.4-95.fc13 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 x86_64 4.4.4-2.fc13 fedora 10 M Installing for dependencies: cloog-ppl x86_64 0.15.7-1.fc12 fedora 82 k cpp x86_64 4.4.4-2.fc13 fedora 3.7 M glibc-devel x86_64 2.12-1 fedora 959 k glibc-headers x86_64 2.12-1 fedora 588 k kernel-devel x86_64 2.6.33.4-95.fc13 updates 6.3 M kernel-headers x86_64 2.6.33.4-95.fc13 updates 761 k ppl x86_64 0.10.2-10.fc12 fedora 1.1 M Transaction Summary ================================================================================================= Install 9 Package(s) Upgrade 0 Package(s) Total download size: 24 M Installed size: 60 M Is this ok [y/N]: y Downloading Packages: Setting up and reading Presto delta metadata fedora/prestodelta | 419 B 00:00 updates/prestodelta | 4.6 kB 00:00 Processing delta metadata Package(s) data still to download: 24 M (1/9): cloog-ppl-0.15.7-1.fc12.x86_64.rpm | 82 kB 00:00 (2/9): cpp-4.4.4-2.fc13.x86_64.rpm | 3.7 MB 00:06 (3/9): dkms-2.1.0.1-1.fc12.noarch.rpm | 95 kB 00:00 (4/9): gcc-4.4.4-2.fc13.x86_64.rpm | 10 MB 00:17 (5/9): glibc-devel-2.12-1.x86_64.rpm | 959 kB 00:01 (6/9): glibc-headers-2.12-1.x86_64.rpm | 588 kB 00:00 (7/9): kernel-devel-2.6.33.4-95.fc13.x86_64.rpm | 6.3 MB 00:02 (8/9): kernel-headers-2.6.33.4-95.fc13.x86_64.rpm | 761 kB 00:00 (9/9): ppl-0.10.2-10.fc12.x86_64.rpm | 1.1 MB 00:02 ------------------------------------------------------------------------------------------------- Total 718 kB/s | 24 MB 00:33 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : cpp-4.4.4-2.fc13.x86_64 1/9 Installing : ppl-0.10.2-10.fc12.x86_64 2/9 Installing : cloog-ppl-0.15.7-1.fc12.x86_64 3/9 Installing : kernel-devel-2.6.33.4-95.fc13.x86_64 4/9 Installing : kernel-headers-2.6.33.4-95.fc13.x86_64 5/9 Installing : glibc-headers-2.12-1.x86_64 6/9 Installing : glibc-devel-2.12-1.x86_64 7/9 Installing : gcc-4.4.4-2.fc13.x86_64 8/9 Installing : dkms-2.1.0.1-1.fc12.noarch 9/9 Installed: dkms.noarch 0:2.1.0.1-1.fc12 gcc.x86_64 0:4.4.4-2.fc13 Dependency Installed: cloog-ppl.x86_64 0:0.15.7-1.fc12 cpp.x86_64 0:4.4.4-2.fc13 glibc-devel.x86_64 0:2.12-1 glibc-headers.x86_64 0:2.12-1 kernel-devel.x86_64 0:2.6.33.4-95.fc13 kernel-headers.x86_64 0:2.6.33.4-95.fc13 ppl.x86_64 0:0.10.2-10.fc12 Complete!
- cd /media/VBOXADDITIONS_3.2.0_61806/
- ./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.
- reboot
<Terminal log:>
[root@localhost ~]# cd /media/VBOXADDITIONS_3.2.0_61806/ [root@localhost VBOXADDITIONS_3.2.0_61806]# ./VBoxLinuxAdditions-amd64.run Verifying archive integrity... All good. Uncompressing VirtualBox 3.2.0 Guest Additions for Linux........ VirtualBox Guest Additions installer Building the VirtualBox Guest Additions kernel modules [FAILED] (Your system does not seem to be set up to build kernel modules. Look at /var/log/vboxadd-install.log to find out what went wrong) Installing the Window System drivers Installing X.Org Server 1.8 modules [ OK ] Setting up the Window System to use the Guest Additions [ OK ] You may need to restart the hal service and the Window System (or just restart the guest system) to enable the Guest Additions. Installing graphics libraries and desktop services componen[ OK ]
Configure Screen
- Edit /etc/X11/xorg.conf to match the following section: (This is for 1200x900 (XO) and other resolutions.)
Section "Device" Identifier "VirtualBox Video Card" Driver "vboxvideo" EndSection 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 permit no passwords in the ssh daemon configuration:
- in Terminal,
- su -
- pico /etc/ssh/sshd_config
- [add] PermitEmptyPasswords yes
- ^O (WriteOut), <Enter> on File Name to Write: /etc/ssh/sshd_config , ^X (Exit)
- service sshd restart