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

From Sugar Labs
Jump to navigation Jump to search
Line 43: Line 43:
 
<div class="NavFrame collapsed">
 
<div class="NavFrame collapsed">
 
<div class="NavHead">
 
<div class="NavHead">
yum.log:
+
yum.log from 06 December 2009):
 
</div>
 
</div>
 
<div class="NavContent">
 
<div class="NavContent">
Line 185: Line 185:
 
#* If upgrading from one VirtualBox version to another, start with fresh virtual disks and machines built with the new versions to avoid breakage.
 
#* If upgrading from one VirtualBox version to another, start with fresh virtual disks and machines built with the new versions to avoid breakage.
 
# reboot
 
# reboot
 +
<div class="NavFrame collapsed">
 +
<div class="NavHead">
 +
Terminal log:
 +
</div>
 +
<div class="NavContent">
 +
<pre>
 +
[root@localhost ~]# mkdir /mnt/cdrom
 +
[root@localhost ~]# mount /dev/sr0 /mnt/cdrom/
 +
mount: block device /dev/sr0 is write-protected, mounting read-only
 +
[root@localhost ~]# cd /mnt/cdrom/
 +
[root@localhost cdrom]# ./VBoxLinuxAdditions-x86.run
 +
Verifying archive integrity... All good.
 +
Uncompressing VirtualBox 3.0.12 Guest Additions for Linux installation................................................................................................................................................................................................................................
 +
VirtualBox 3.0.12 Guest Additions installation
 +
Attempt to remove old DKMS modules...
 +
Done.
 +
Building the VirtualBox Guest Additions kernel module...
 +
Building the shared folder support kernel module...
 +
Building the drm support kernel module...
 +
Installing the VirtualBox Guest Additions...
 +
 +
Successfully installed the VirtualBox Guest Additions.
 +
You must restart your guest system in order to complete the installation.
 +
</pre>
 +
</div>
 +
</div>
 +
 
===Configure Screen===
 
===Configure Screen===
 
# Edit /etc/X11/xorg.conf to match the following section:  (This is for 1200x900 (XO) and other resolutions.)
 
# 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.
+
<pre>
#
 
# This file was created by VirtualBox Additions installer as it
 
# was unable to find any existing configuration file for X.
 
 
 
 
  Section "Device"
 
  Section "Device"
 
         Identifier "VirtualBox Video Card"
 
         Identifier "VirtualBox Video Card"
 
         Driver "vboxvideo"
 
         Driver "vboxvideo"
 
  EndSection
 
  EndSection
  #
+
   
# From example in section 4.3.2 of the VirtualBox Help manual:
 
#
 
 
  Section "Screen"
 
  Section "Screen"
 
         Identifier "Default Screen"
 
         Identifier "Default Screen"
Line 209: Line 230:
 
         EndSubSection
 
         EndSubSection
 
  EndSection
 
  EndSection
 +
</pre>
 
==Clear user data==
 
==Clear user data==
 
Finally,
 
Finally,
Line 225: Line 247:
  
 
==SSH connections==
 
==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:
+
To enable SSH communications, we need to permit no passwords in the ssh daemon configuration:
  
 
# in Terminal,
 
# in Terminal,
 
# su -
 
# 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
 
# pico /etc/ssh/sshd_config
 
## [add] PermitEmptyPasswords yes
 
## [add] PermitEmptyPasswords yes
 
## ^O (WriteOut), <Enter> on File Name to Write: /etc/ssh/sshd_config , ^X (Exit)
 
## ^O (WriteOut), <Enter> on File Name to Write: /etc/ssh/sshd_config , ^X (Exit)
# chkconfig --level 345 sshd on
 
# service sshd start
 

Revision as of 23:27, 6 December 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.)

Installing SoaS iso image

  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/2/?C=M;O=D, for Fedora-12.
  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. umount /dev/sda1 -- (not required with soas-2-blueberry.iso)
  19. /media/soas-2-blueberry/LiveOS/livecd-iso-to-disk --overlay-size-mb 400 /dev/sr0 /dev/sda1
    (for earlier versions of SoaS, like Strawberry, use /mnt/live/LiveOS/livecd-iso-to-disk ...
    soas05.iso carries an incompatible version of livecd-iso-to-disk, see this bug report.)
    • the --overlay-size-mb NNN option creates space for persistence of changes on the disk; otherwise, a liveOS disk is read-only.

    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 make
    (Other dependencies will be called into the installation.)
  1. go to VirtualBox Devices Menu->Install Guest Additions
  2. mkdir /mnt/cdrom
  3. mount /dev/sr0 /mnt/cdrom
  4. cd /mnt/cdrom
  5. ./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.
  6. reboot

Configure Screen

  1. 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,

  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)