Description and usage or the vboxlive script posted in the Programming/Scripting subforum (Part I)
This script is intended to boot iso images of Linux live CDs in a disk-less virtual machine under VirtualBox. It can be used to quickly test different Linux live systems. Since it doesn’t require a virtual hard disk, it doesn’t need any disk space on the host. If you create a virtual machine (instead of using the default one) you can later attach virtual storage to it.
Installation
Copy/paste the code posted here or install the package vmscripts](https://build.opensuse.org/package/show?package=vmscripts&project=home%3Aplease_try_again) from my repo:
[noparse]
su -l
zypper ar http://download.opensuse.org/repositories/home:/please_try_again/openSUSE_11.4/ PTA
zypper refresh
zypper in vmscripts
[/noparse]
**Before using it**
- Put your iso images in the directory defined in the variable [FONT=courier new]isoDir in the script. The default /srv/iso is NOT going to work for you. Thus you should change it to any location you like or create this directory. The script won’t create it and will issue an error if it doesn’t exist.[/FONT]
- Create symlinks to the different iso images with the names of the different distros. Although you can boot iso images too, this is the easiest way to proceed, as most of these names match the predefined os types in VirtualBox.
**Options **
vboxlive options have a short and a long form, optionally followed by an argument.
-l --list
lists the available iso images in the iso directory (defined in isoDir in the script).
-v --vms
lists available virtual machines
-r --remove <vm>
(completely) removes the given virtual machine.
-d --default
Uses the default virtual machine (called LiveCD). This machine will be created the first time if it doesn’t exist and used to boot any live CD. Without this option, vboxlive will create a new virtual machine for each distro (consisting of the OS name specified in the option -o with the string “-LiveCD” appended to it). Use this option if you want to test a live CD without creating a specific vm for it. You obviously can’t use it if you intend to run several disk-less virtual machines simultaneously. Notice that disk-less virtual machines use NO space on your hard disk. Therefore you could create a thousand vms without having to worry about disk space. I don’t know how VirtualBox/vboxmanage will like it though.
**-a --arch **<32|64>
architecture. Default is 32bit.
-o --os <os>
boots the specified os. Valid values are any file name (with or without the extension .iso) in the iso directory. However I’ll recommend to create symlinks to your iso images with the names of the Linux distros (ubuntu, mandriva, fedora, opensuse, debian, etc), since these names match guest OSses already known by VirtualBox. I also added a couple others : mageia matching Mandriva ; mint matching Ubuntu ; centos matching RedHat ; mepis matching Debian. ; pcbsd matching FreeBSD. If you know some more, please tell me and I’ll add them. For unknown OSses, vboxlive will default to Linux26, which should be OK.
-i --iso <file>
boots the specified iso image. File name is either relative to the current directory or to $isoDir or might be an absolute path (meaning the images can be in any directory, including on nfs mounted file systems). The -o and -i options may be used together. In this case, the vm will have the name and os type given in -o and will be attached the iso image provided as an argument to -i.
Variables
You might want or need to change the value of the following variables predefined in the script:
ram=1024 | # Memory to allocate to the virtual machine (in MB) |
---|---|
vram=128 | # video memory to allocate (in MB) |
arch=32 | #default architecture (32 or 64) |
isoDir=/srv/iso | # directory where your iso images are stored |
128 MB video memory is the maximum and seems to be necessary to run Gnome3. It only worked on openSUSE 12.1 guest. Fedora 15 switched to gnome-fallback.
**Display resolution and Guest additions. **
OpenSUSE, Mandriva, ArchLinux, PCLinux and Gentoo guests already include the VirtualBox drivers that support high display resolutions.
On other systems, you’ll have to install the guest additions to use a resolution higher than 1024x768. Some even only provide 800x600. If the VirtualBox Guest additions were found on the host (they should), the Guest Additions iso image will be attached to a second DVD drive. Whether it will be mounted and where varies on the different live systems.
- Under Ubuntu (Oniric beta), click on the CD icon which has the tool tip “VBOXADDITIONS_4.1.2_73507” at the bottom of Unity dock to mount the DVD (actually the iso image).
- Under KDE in Chakra and Mepis, open dolphin and click on “VBOXADDITIONS_4.1.2_73507” in the left pane.
- Knoppix boots in console mode and displays a menu. In this menu, choose ‘Shell’ to get a console prompt. Then type “startx”. It will open a Gnome session. Click on the file manager icon at the bottom panel, then on “VBOXADDITIONS_4.1.2_73507”.
- Under Mint, Fedora, Mageia, Centos, Debian, it should be already mounted.
Then open a terminal and type the following:
cd /media/VBOXADDITIONS_4.1.2_73507
- Typing cd /media/VBOX … followed by TAB will be enough, as the version may vary.
or (in knoppix) :
cd /media/sr1
- Under Ubuntu, Mint, Debian, Centos, Gentoo, Chakra (sudo password: ‘live’) , Knoppix, type:
sudo sh VBoxLinuxAdditions.run
- Under Fedora, Mageia, type:
su -c 'sh VboxLinuxAdditions.run'
- Under Mepis, it doesn’t seem to be possible to install the guest additions, because too many file systems are read only.
Then log out (don’t reboot the vm!) and re-log in as the live system user (see the table below).
|
|
|
|user|password|root passwd|Start RES|Re-login|
|ArchLinux|2011-01-04|arch|arch|N/A|vbox|arch/arch|
|Centos|6.0|centoslive|N/A|N/A|800x600|automatic|
|Chakra|2011.4|live|live|root|1024x768|live/live|
|Debian|6.0.2|user|live|sudo passwd root|800x600|user/live|
|Fedora|15|liveuser|N/A|N/A|1024x768|liveuser|
|Gentoo|11.2|gentoo|gentoo|sudo passwd root|vbox|automatic|
|Knoppix|6.7.0|knoppix|N/A|N/A|1024x768|console|
|Mageia|1|live|N/A|N/A|1024x768|live|
|Mandriva|2011|live|N/A|N/A|vbox|live|
|Mepis|11.0|demo|demo|N/A|800x600|demo/demo|
|Mint|11.0|mint|N/A|sudo passwd root|1024x768|mint|
|openSUSE|12.1 M5|linux|N/A|N/A|vbox|doesn’t work (!)|
|pclinux|2011.6|guest|guest|root|vbox|guest/guest|
|ubuntu|11.10 beta1|ubuntu|N/A|sudo passwd root|1024x768|ubuntu|
The resolution will change (Ubuntu, Mint, Gentoo, pclinux) or you will be able to set a higher one in Preferences → display (Fedora), Monitors (Mageia, Debian), Monitor Settings (Knoppix) or in the Display an Monitor properties on KDE live systems (Chakra).