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

From Sugar Labs
Jump to navigation Jump to search
Line 3: Line 3:
 
Instructions for preparing a VirtualBox disk image from a SoaS iso image file.
 
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.)
 
* (Taken from Dave Bauer's posting at http://schools.sugarlabs.org/mod/forum/discuss.php?d=27.)
* Updated 21 May 2010 with [http://www.virtualbox.org/wiki/Downloads VirtualBox 3.2.0] and 64-bit Fedora.
+
* Updated 09 June 2010 with [http://www.virtualbox.org/wiki/Downloads VirtualBox 3.2.4] and 32-bit Fedora.
 
==Installing SoaS .iso image==
 
==Installing SoaS .iso image==
 
# Create a new VM, choose a name, such as Mirabelle
 
# Create a new VM, choose a name, such as Mirabelle
# Choose Linux for the Operating System and Version Fedora (64 bit)
+
# Choose Linux for the Operating System and Version Fedora (use 64 bit, if available)
 
# Choose Base Memory Size: 256 MB to match an XO-1, 512 or 1024 MB to match an XO-1.5
 
# 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
 
# Create a new virtual hard disk image with dynamically expanding storage of 2 GB
Line 17: Line 17:
 
# Open Terminal.
 
# Open Terminal.
 
# su -
 
# su -
# parted /dev/sda
+
# parted
 
# mklabel msdos
 
# mklabel msdos
 
#: This makes a partition table.
 
#: This makes a partition table.
 
# mkpart primary ext2 0 2048
 
# mkpart primary ext2 0 2048
 +
#: You will receive this message:<br>Warning: The resulting partition is not properly aligned for best performance.<br>Ignore/Cancel?
 +
#: Enter (I)gnore
 
# toggle 1 boot
 
# toggle 1 boot
 
# quit
 
# quit
Line 26: Line 28:
 
# /LiveOS/livecd-iso-to-disk --overlay-size-mb 200 --home-size-mb 200 --delete-home --unencrypted-home /dev/live /dev/sda1<br>(for earlier versions of SoaS
 
# /LiveOS/livecd-iso-to-disk --overlay-size-mb 200 --home-size-mb 200 --delete-home --unencrypted-home /dev/live /dev/sda1<br>(for earlier versions of SoaS
 
#: Blueberry - use /media/soas-2-blueberry/LiveOS/livecd-iso-to-disk<br>Strawberry - use /mnt/live/LiveOS/livecd-iso-to-disk)
 
#: Blueberry - use /media/soas-2-blueberry/LiveOS/livecd-iso-to-disk<br>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]].
+
<ul>
#: <br>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.)
+
{{Show|<Terminal log>
#* 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.)
+
|<pre>
#* 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).
+
[root@localhost ~]# parted
#* 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.
+
GNU Parted 2.1
# shutdown -h now
+
Using /dev/sda
 +
Welcome to GNU Parted! Type 'help' to view a list of commands.
 +
(parted) mklabel msdos                                                   
 +
(parted) mkpart primary ext2 0 2048
 +
Warning: The resulting partition is not properly aligned for best performance.
 +
Ignore/Cancel? I                                                         
 +
(parted) toggle 1 boot                                                   
 +
(parted) quit                                                           
 +
Information: You may need to update /etc/fstab.                         
 +
 
 +
[root@localhost ~]# mke2fs /dev/sda1
 +
mke2fs 1.41.10 (10-Feb-2009)
 +
Filesystem label=
 +
OS type: Linux
 +
Block size=4096 (log=2)
 +
Fragment size=4096 (log=2)
 +
Stride=0 blocks, Stripe width=0 blocks
 +
125184 inodes, 500000 blocks
 +
25000 blocks (5.00%) reserved for the super user
 +
First data block=0
 +
Maximum filesystem blocks=515899392
 +
16 block groups
 +
32768 blocks per group, 32768 fragments per group
 +
7824 inodes per group
 +
Superblock backups stored on blocks:
 +
    32768, 98304, 163840, 229376, 294912
 +
 
 +
Writing inode tables: done                           
 +
Writing superblocks and filesystem accounting information: done
 +
 
 +
This filesystem will be automatically checked every 36 mounts or
 +
180 days, whichever comes first.  Use tune2fs -c or -i to override.
 +
[root@localhost ~]# /LiveOS/livecd-iso-to-disk --overlay-size-mb 200 --home-size-mb 200 --delete-home --unencrypted-home /dev/live /dev/sda1
 +
Verifying image...
 +
/dev/sr0:  0ce28e3947106fd37bab9317abf09938
 +
Fragment sums: a3c6e5fd5fba11d2b4da71771e8732b63bcb62b841971f7f39ab5c187f64
 +
Fragment count: 20
 +
Checking: 100.0%
 +
 
 +
The media check is complete, the result is: PASS.
 +
 
 +
It is OK to use this media.
 +
Copying live image to USB stick
 +
Updating boot config file
 +
Initializing persistent overlay file
 +
0+0 records in
 +
0+0 records out
 +
0 bytes (0 B) copied, 0.000150187 s, 0.0 kB/s
 +
Initializing persistent /home
 +
0+0 records in
 +
0+0 records out
 +
0 bytes (0 B) copied, 0.0039562 s, 0.0 kB/s
 +
Formatting unencrypted /home
 +
mke2fs 1.41.10 (10-Feb-2009)
 +
Filesystem label=
 +
OS type: Linux
 +
Block size=1024 (log=0)
 +
Fragment size=1024 (log=0)
 +
Stride=0 blocks, Stripe width=0 blocks
 +
51200 inodes, 204800 blocks
 +
10240 blocks (5.00%) reserved for the super user
 +
First data block=1
 +
Maximum filesystem blocks=67371008
 +
25 block groups
 +
8192 blocks per group, 8192 fragments per group
 +
2048 inodes per group
 +
Superblock backups stored on blocks:
 +
    8193, 24577, 40961, 57345, 73729
 +
 
 +
Writing inode tables: done                           
 +
Creating journal (4096 blocks): done
 +
Writing superblocks and filesystem accounting information: done
 +
 
 +
This filesystem will be automatically checked every 26 mounts or
 +
180 days, whichever comes first.  Use tune2fs -c or -i to override.
 +
tune2fs 1.41.10 (10-Feb-2009)
 +
Setting maximal mount count to -1
 +
Setting interval between checks to 0 seconds
 +
Installing boot loader
 +
/media/usbdev.XB8shz/syslinux is device /dev/sda1
 +
USB stick set up as live image!
 +
</pre>}}
 +
* 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]].
 +
: <br>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 file storage in the /home/liveuser folder.  (In the case where you you want to update the LiveOS image while keeping the user files, skip the new disk creation and parted steps, 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 [[wikipedia:SquashFS|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 for the LiveOS upgrade case.)
 +
</ul>
 +
<ol start=20>
 +
<li> shutdown -h now</li>
 +
</ol>
 
==Installing VirtualBox Guest Additions==
 
==Installing VirtualBox Guest Additions==
# Unmount CDROM in VirtualBox settings
+
# Unmount CD/DVD in VirtualBox settings, select 'Empty' for the CD/DVD device under 'Attributes'
# Mount VBoxGuestAdditions.iso in its place.
+
# Start the virtual machine
# Boot VM
 
 
# Open Terminal
 
# Open Terminal
 
# su -
 
# su -
Line 41: Line 132:
 
#: (Other dependencies will be called into the installation.)
 
#: (Other dependencies will be called into the installation.)
  
<div class="NavFrame collapsed">
+
{{Show|<Terminal log from 09 June 2010>  
<div class="NavHead">
+
|<pre>
<yum.log from 21 May 2010:> </div>
+
[root@localhost ~]# yum install dkms gcc
<div class="NavContent">
 
<pre>
 
[root@localhost ~]# yum install dkms gcc make
 
 
Loaded plugins: presto, refresh-packagekit
 
Loaded plugins: presto, refresh-packagekit
 
fedora/metalink                                                          |  13 kB    00:00     
 
fedora/metalink                                                          |  13 kB    00:00     

Revision as of 23:29, 9 June 2010

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 as Mirabelle
  2. Choose Linux for the Operating System and Version Fedora (use 64 bit, if available)
  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://spins.fedoraproject.org/soas/#downloads, 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
  14. mklabel msdos
    This makes a partition table.
  15. mkpart primary ext2 0 2048
    You will receive this message:
    Warning: The resulting partition is not properly aligned for best performance.
    Ignore/Cancel?
    Enter (I)gnore
  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)
    <Terminal log>
    [root@localhost ~]# parted
    GNU Parted 2.1
    Using /dev/sda
    Welcome to GNU Parted! Type 'help' to view a list of commands.
    (parted) mklabel msdos                                                    
    (parted) mkpart primary ext2 0 2048
    Warning: The resulting partition is not properly aligned for best performance.
    Ignore/Cancel? I                                                          
    (parted) toggle 1 boot                                                    
    (parted) quit                                                             
    Information: You may need to update /etc/fstab.                           
    
    [root@localhost ~]# mke2fs /dev/sda1
    mke2fs 1.41.10 (10-Feb-2009)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    125184 inodes, 500000 blocks
    25000 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=515899392
    16 block groups
    32768 blocks per group, 32768 fragments per group
    7824 inodes per group
    Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912
    
    Writing inode tables: done                            
    Writing superblocks and filesystem accounting information: done
    
    This filesystem will be automatically checked every 36 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
    [root@localhost ~]# /LiveOS/livecd-iso-to-disk --overlay-size-mb 200 --home-size-mb 200 --delete-home --unencrypted-home /dev/live /dev/sda1
    Verifying image...
    /dev/sr0:   0ce28e3947106fd37bab9317abf09938
    Fragment sums: a3c6e5fd5fba11d2b4da71771e8732b63bcb62b841971f7f39ab5c187f64
    Fragment count: 20
    Checking: 100.0%
    
    The media check is complete, the result is: PASS.
    
    It is OK to use this media.
    Copying live image to USB stick
    Updating boot config file
    Initializing persistent overlay file
    0+0 records in
    0+0 records out
    0 bytes (0 B) copied, 0.000150187 s, 0.0 kB/s
    Initializing persistent /home
    0+0 records in
    0+0 records out
    0 bytes (0 B) copied, 0.0039562 s, 0.0 kB/s
    Formatting unencrypted /home
    mke2fs 1.41.10 (10-Feb-2009)
    Filesystem label=
    OS type: Linux
    Block size=1024 (log=0)
    Fragment size=1024 (log=0)
    Stride=0 blocks, Stripe width=0 blocks
    51200 inodes, 204800 blocks
    10240 blocks (5.00%) reserved for the super user
    First data block=1
    Maximum filesystem blocks=67371008
    25 block groups
    8192 blocks per group, 8192 fragments per group
    2048 inodes per group
    Superblock backups stored on blocks: 
        8193, 24577, 40961, 57345, 73729
    
    Writing inode tables: done                            
    Creating journal (4096 blocks): done
    Writing superblocks and filesystem accounting information: done
    
    This filesystem will be automatically checked every 26 mounts or
    180 days, whichever comes first.  Use tune2fs -c or -i to override.
    tune2fs 1.41.10 (10-Feb-2009)
    Setting maximal mount count to -1
    Setting interval between checks to 0 seconds
    Installing boot loader
    /media/usbdev.XB8shz/syslinux is device /dev/sda1
    USB stick set up as live image!
    
    • 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 file storage in the /home/liveuser folder. (In the case where you you want to update the LiveOS image while keeping the user files, skip the new disk creation and parted steps, 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 for the LiveOS upgrade case.)
  1. shutdown -h now

Installing VirtualBox Guest Additions

  1. Unmount CD/DVD in VirtualBox settings, select 'Empty' for the CD/DVD device under 'Attributes'
  2. Start the virtual machine
  3. Open Terminal
  4. su -
  5. yum install dkms gcc
    (Other dependencies will be called into the installation.)

{{Show|<Terminal log from 09 June 2010>

|

[root@localhost ~]# yum install dkms gcc
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!


  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. vi /etc/ssh/sshd_config
    1. [add] PermitEmptyPasswords yes
    2. :wq <Enter>
  4. service sshd restart