Running Linux live CDs in disk-less virtual machines under VirtualBox

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).

**Description and usage or the vboxlive script posted in the Programming/Scripting subforum (Part II)
**
Booting live systems in the default virtual machine (called “LiveCD”)

An example:

With the following iso images and appropriate symlinks in your iso folder - as printed by vboxlive -v:

**
[FONT=courier new]# vboxlive -l[/FONT]**
ADRIANE-KNOPPIX_V6.7.0CD-2011-08-01-EN.iso   
CentOS-6.0-i386-LiveCD.iso            
**centos.iso **                         -> CentOS-6.0-i386-LiveCD.iso
**debian.iso **                         -> debian-live-6.0.2-i386-gnome-desktop.iso
debian-live-6.0.2-i386-gnome-desktop.iso   
**fedora.iso**                          -> /data/Linux/Fedora/15/iso/Fedora-15-x86_64-Live-Desktop.iso
**gentoo.iso **                         -> livedvd-x86-amd64-32ul-11.2.iso
**knoppix.iso**                         -> ADRIANE-KNOPPIX_V6.7.0CD-2011-08-01-EN.iso
linuxmint-11-gnome-dvd-32bit.iso      
livedvd-x86-amd64-32ul-11.2.iso       
**mageia.iso **                         -> mageia-livecd-1-GNOME-europe1-americas-cdrom-i586.iso
mageia-livecd-1-GNOME-europe1-americas-cdrom-i586.iso   
Mandriva.2011.i586.1.iso              
**mandriva.iso  **                      -> Mandriva.2011.i586.1.iso
**mint.iso  **                          -> linuxmint-11-gnome-dvd-32bit.iso
**opensuse.iso**                        -> openSUSE-GNOME-LiveCD-Build0250-i686.iso
**pclinux.iso **                        -> pclinuxos-kde-2011.6.iso
pclinuxos-kde-2011.6.iso              
ubuntu-11.10-beta1-desktop-i386.iso   
**ubuntu.iso  **                        -> ubuntu-11.10-beta1-desktop-i386.iso

you could run different live systems with the following commands (option **-d **means that it won’t create a new virtual machine):


[FONT=courier new]# vboxlive -o opensuse -d
[/FONT]# vboxlive -o fedora -d
# vboxlive -o centos -d
# vboxlive -o mandriva -d
# vboxlive -o mageia -d
# vboxlive -o mandriva -d
# vboxlive -o mint -d
# vboxlive -o debian -d
# vboxlive -o pclinux -d

**
Booting each live system in its own virtual machine**

Without the option -d, the commands above would run each live system in a new virtual machine, creating this vm if necessary. The list of existing virtual machines can be displayed with the option -v.


**# vboxlive -v        **
"LiveCD" {c05f0b63-344f-4b88-8435-27b9cb628880}
"ubuntu-LiveCD" {bacbc315-8952-4bec-9d97-7a2c78853752}
"pclinux-LiveCD" {85399d8a-6ba6-4243-a49a-7f5ff925db80}
"centos-LiveCD" {8aac5273-d43b-4152-90ae-d5f5c6095db7}
"debian-LiveCD" {3d1f4e5b-4c29-40dd-9503-6eedbbd4d32b}
"fedora-LiveCD" {e1954f3a-3dff-433a-bf1c-eb70b4393b97}
"knoppix-LiveCD" {7cb4378d-9028-4f58-9c66-7e2630bfefb0}
"mageia-LiveCD" {5685cc00-602c-4e7b-8120-cd6d1aa49764}
"mint-LiveCD" {c21faa4c-93bf-426e-a5ee-e76b3115bb30}
"mandriva-LiveCD" {375e2fa2-7420-4710-bfda-202b33ca8e82}
"opensuse-LiveCD" {74be108e-98b9-4dce-a0f6-b64411528cc0}
"gentoo-LiveCD" {fdd6e2fe-cfc3-4c80-a17d-d63b7ed9e2ee}

Booting live systems from iso images (only)

You can also boot a live system from any iso image stored anywhere on a local (or nfs mounted) file sytem by giving the full path of the image as an argument to the option -i. The following command boots ArchLinux from the supplied iso image:

# vboxlive -i /misc/iso/archiso-live-2011-01-04.iso

and is equivalent to

# vboxlive -i /misc/iso/archiso-live-2011-01-04.iso -d

Because you didn’t provide the -o option, no virtual machine will be created and the default vm will be used in all cases.

If however you use the -o option followed by an OS (and without the **-d **option), a virtual machine based on the supplied argument will be created.

# vboxlive -i /misc/iso/archiso-live-2011-01-04.iso -o archlinux

It is always better to use the -o option, because in the examples above, the vm created with the option** -o** will have the os type “ArchLinux” while the other ones will have the os type “Linux26” or “Linux26_64” if -a 64 was also provided.

**Removing virtual machines
**
To remove a virtual machine, use vboxlive -r followed by the name of the vm. Example:

# vboxlive -r gentoo-LiveCD

or simply:

# vboxlive -r gentoo

Displaying error messages in QT/GTK style

You can install the popup library to see error messages in QT or GTK style, depending on the desktop environment. If popup is found in your path, vboxlive will use it to display error messages. The popup library in included in vmscripts.

Some download Urls

                              |ArchLinux|http://arch-live.isawsome.net/iso/archiso/20110104/archiso-live-2011-01-04.iso|

|—|—|
|Centos|ftp://ftp.osuosl.org/pub/centos/6/isos/|
|Chakra|The Chakra Project - Get|
|Debian|ftp://ftp.osuosl.org/pub/debian-cdimage/6.0.2-live/i386/iso-hybrid/|
|Fedora|ftp://ftp.osuosl.org/…/pub/fedora/linux/releases/15/Live/|
|Gentoo|ftp://ftp.osuosl.org/pub/gentoo/releases/x86/11.2/|
|Knoppix|ftp://ftp.osuosl.org/pub/knoppix/|
|Mageia|Download Mageia 1|
|Mepis|Download MEPIS | MEPIS Linux|
|Mandriva|Mandriva Linux Downloads|
|Mint|Download - Linux Mint|
|openSusE|software.opensuse.org: Download openSUSE 12.1 Milestone 5|
|pclinux|http://ftp.ch.debian.org/mirror/pclinuxos/live-cd/pclinuxos-kde-2011.6.iso|
|ubuntu|ftp://ftp.osuosl.org/…/pub/ubuntu-releases/11.10/|

**Version 2.0 **(beta) introduces several new features and - as the ‘beta’ indicates - might need further testing.

The new features include:

  • download iso images from a mirror site (if requested).
  • ability to choose supported guests from a list.
  • only display but don’t execute commands, including URL of iso image (when download enabled).
  • display file open menu if the iso image specified at the command line doesn’t exist.
  • add support for morel Linux distros, openindiana and dragonflybsd.

The script sources **/usr/bin/popup **(included in the vmscripts package), if present, to use GTK, QT or ncurses dialog boxes. Otherwise it writes messages and menus in the terminal. Whether GTK, QT or Ncurses dialogs will be used depend on the Desktop you’re using and on the value of the DIALOG variable.

Example: displaying the list of “supported” guests and use the** -t** (or – try) option to show but not execute the commands afterwards:

export DIALOG=ZENITY  && vboxlive -m -t   # GTK style
export DIALOG=KDIALOG && vboxlive -m -t   # QT style
export DIALOG=DIALOG  && vboxlive -m -t   # ncurses style
export DIALOG=""      && vboxlive -m -t   # empty, uses DE default.
export DIALOG=NOTHING && vboxlive -m -t   # invalid, uses text dialogs instead.

Notice that “supported” guests doesn’t mean than other distros or OS are not supported. It just include the distros listed in the config file /etc/vboxlive.cfg, for which a URL entry exists and therefore an iso image is available to download.

**The config files

/etc/vboxlive.cfg** is the system-wide config file. It mostly contains URLs, file names and default versions of Linux guests, as well as several VirtualBox settings such as the amount of RAM and video memory you want to allocate to virtual machines, where to store the iso images, which architecture (32 or 64bit) to use and whether or not you want to download iso images by default. All the variables defined here can be overwritten in the user ~/.vboxliverc. A typical ~/.vboxliverc could look like this:

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 
DFLAG=no                     # try to download live CD image if not found.

You migth also overwrite the mirrors (if you are not in North America) or specific urls in this file.

New options
**
|
-g --guests**|lists supported guest: distros for which a _iso variable is defined in the system and/or user config file.
|—|

$ **vboxlive -g**
archbang archlinux centos chakra debian dragonflybsd fedora gentoo  kanotix knoppix
 mageia mandriva mepis mint openindiana opensuse pclinux  puppylinux ubuntu

|
|-m --menu|pops up a menu (in GTK, QT, ncurses style or text), where you can choose which distro to run in VirtualBox.
The list of available guests is determined as in the option -g by the _iso variables in the config file.

$** vboxlive -m**

http://img690.imageshack.us/img690/8519/vboxlivemenu.th.png](http://img690.imageshack.us/img690/8519/vboxlivemenu.png)

|
|**-D --download |downloads the iso image of the given distro. This option is automatically turned on by the option -m (above)
and can be enabled by default by setting DFLAg=yes in ~/.vboxliverc. If the iso image is already present, nothing
will be downloaded and the virtual machine will be started. If more than on iso image is available to download (like
for openSUSE in the bash menu above), another menu will be opened and present the differences choices. The selected
image will be downloaded (it might take long depending on your connection) and saved in the directory speicified in
the isoDir variable. Then a symlink with the name of the OS will be created and the virtual machine will be started.
If you cancel the download, the script will exit.|
|
-R --release **|specifies the OS version to download. Default versions are defined in /etc/vboxlive.cfg. You can overwite them in
~/.vboxliverc. For example, to run openSUSE 12.1 Beta1 in a virtual machine, either use the following command:

$ **vboxlive -o opensuse -R 12.1-Beta1 -D**
                        or set this variable in ~/.vboxliverc: **opensuse_ver=12.1-Beta1** and use this command: 
$ **vboxlive -o opensuse -D**

You’ll add the option -D to download the iso image.|
|**-t --try **|Displays the command but don’t execute it. Useful to show the iso image URL when used with the option -D.
Example:

$ **vboxlive -t -o opensuse -R 12.1-Beta1 -D**
URL:[noparse] http://download.opensuse.org/distribution/12.1-Beta1/iso/openSUSE-GNOME-LiveCD-Build0315-i686.iso [/noparse]
vboxmanage modifyvm opensuse-LiveCD
        --memory 1024
        --vram 128 
        --boot1 dvd
        --boot2 floppy
        --ioapic on
        --pae off
        --rtcuseutc on
        --accelerate3d on
        --mouse usbtablet
        --usb on
        --audio pulse
        --audiocontroller hda
        --ostype OpenSUSE

|

**Try a distro live CD, the quickest way.
**

  • Make sure that you have write access to the isoDir defined in ~/.vboxliverc
  • look at the list of supported guests:
$ **vboxlive -g**
archbang archlinux centos chakra debian dragonflybsd fedora gentoo kanotix knoppix
 mageia mandriva mepis mint openindiana opensuse pclinux puppylinux ubuntu

  • Download the iso image and run a guest in a virtual machine (example fedora):
$ **vboxlive -o fedora -D**

iso images & Open file menu

An alternative is to start virtual machines from iso images using the option -i rather than -o followed by an OS name.
While the option -o can only accept already defined guests as argument (the ones listed by vboxlive -g), the option -i can be used with any bootable iso image. The filename can be an absolute path. If no path is given, it is considered to be relative, first to the current directory, then to the isoDir directory. Finally, if the file doesn’t exist in any of these locations, an open file menu will be displayed, where you can select any iso image from any directory. Thus if you want the script to start with an open file menu, you can simply use the **-i **option without argument:

$ **vboxlive -i**

Version 2.1.

News options:

|-b --beta|uses beta version (defined in /etc/vboxlive.cfg and ~/.vboxliverc)
|—|
This currently only works for openSUSE and Fedora.
For Ubuntu, use the** -R --release** option followed by the codename (even for beta)


$ vboxlive -o opensuse -b
$ vboxlive -o fedora -b
$ vboxlive -o ubuntu -R <oneiric|natty|maverick|...>

|
|-u --url|only prints the url of the iso image for the given distro:


$ vboxlive -U -o opensuse
$ vboxlive -U -o opensuse -b

|
|-G --guestUrls|checks the validity and prints the URLs defined in /etc/vboxlive.cfg and ~/.vboxliverc
You can specify the versions (32 or 64bit) of the iso images to look for:

$ vboxlive -G -a 64

and whether to check for beta (if available) or final releases:

$ vboxlive -G -b

|
|-I --install| installs Oracle VirtualBox (see above).|

**(probably) one of the quickest way to install VirtualBox.
**
vboxlive is useless without VirtualBox. So what would happen if you ran vboxlive and VirtualBox is not installed? You certainly won’t, but assuming someone would? Rather than displaying an error message in such a case, I decided to add a function to “properly” install Oracle VirtualBox - that might be usefull after all, since users occasionally experience problems with that. So, this new method of installing VirtualBox includes two steps (and that’s ALL you need to do):

|
|

  • installing vmscripts as described in post #1. Here are the commands again:

$ su -l
# zypper ar http://download.opensuse.org/repositories/home:/please_try_again/openSUSE_11.4/  PTA
# zypper refresh -r PTA
# zypper in vmscripts

  • installing VirtualBox using vboxlive:
$ vboxlive --install

or

$ vboxlive -I

|http://img43.imageshack.us/img43/9269/vboxlive01.th.png](http://img43.imageshack.us/img43/9269/vboxlive01.png)|

It won’t just install VirtualBox but also the latest Extension Pack and add the current user (you) to the vboxusers group. It will of course install the kernel sources and the compiler, which are required to build the virtualbox kernel module, before the VirtualBox package, so that you won’t have to compile the module manually by running:

/etc/init.d/vboxdrv setup

When the kernel sources are available, the VirtualBox installation script compiles the module following the package installation - as shown in the rpm query below:

$ rpm -q --scripts VirtualBox-4.1 | grep -C 1 '/etc/init.d/vboxdrv setup'
if  $BUILD_MODULES -eq 1 ]; then
  /etc/init.d/vboxdrv setup || true
else

**What happens when running kernel and installed kernel sources versions differ?
**

It’s another common mistake. Sometimes you might install the kernel sources without updating the kernel or you might update the kernel but not reboot. As a consequence, the kernel sources won’t match the running kernel (uname -r) and the compilation of kernel modules will fail. Fortunately, vboxlive will catch this error, abort the script and ask you to reboot before proceeding. http://img403.imageshack.us/img403/3998/vboxlive02.th.png](http://img403.imageshack.us/img403/3998/vboxlive02.png)

Installing VirtualBox automatically

|You might use vboxlive to install VirtualBox - as explained above - but you might also use vboxlive for the purpose for which it was intended, meaning to run OS isos in diskless virtual machines. In this case you would just type a command like the following one to boot the latest openSUSE beta:
|

vboxlive -o -opensuse -b -D
  • -b
    means that you want the beta version - -D
    instructs vboxlive to download the iso image if necessary.

If VirtualBox is not installed, you will be asked if you want to install it. You have to agree in order for the script to proceed. Next, if the text mode web browser links is not found, you will be prompted to install it too. It is needed by vboxlive to get the URLs of the iso images to download. Once these programs are installed and the iso image of the given OS (here openSUSE 12.1 beta) downloaded, a diskless virtual machine will be created and the OS will be booted into it.|http://img214.imageshack.us/img214/8000/vboxlive03.th.png](http://img214.imageshack.us/img214/8000/vboxlive03.png)|

So your scripts and descriptions are superb please_try_again, but its a little hard to find the actual current bash script in all of this. I would ask for a simple SUSE Paste of your latest script for us to use.

Thank You,

Hi James,

I know. The vboxlive has got too long finally (over 15000 characters). It’s too long to be posted in the forum. I will post the code in SUSE Paste later (not today). But why don’t you install the vmscripts package from my repo? It won’t hurt. The latest version of vboxlive is included in this package.

$ **rpm -ql vmscripts
**
/etc/vboxlive.cfg
/etc/vm-create.cfg
/usr/bin/VBoxExtensionPack
/usr/bin/bridge2nat
/usr/bin/nat2bridge
/usr/bin/popup
/usr/bin/vboxlive
/usr/bin/vm-bridge
/usr/bin/vm-create
/usr/share/doc/packages/vmscripts
/usr/share/doc/packages/vmscripts/COPYING

Hi James,

I know. The vboxlive has got too long finally (over 15000 characters). It’s too long to be posted in the forum. I will post the code in SUSE Paste later (not today). But why don’t you install the vmscripts package from my repo? It won’t hurt. The latest version of vboxlive is included in this package.

I understand about the size thing that is for sure and the limit is even lower with the blog setup. As for using the repository, I prefer to place all scripts into ~/bin to work with and examine them which can be different than if you want to install them in the right location to run them. And, I look at all of your scripts with amazement wondering how you figure this stuff out. As time goes on, I pick up more and more, but I just look at my many examples to determine a lot of the harder stuff. None the less, I think that having a SuSE Paste of your script for others here to see can also be of value, but I am just one voice of many here I am sure. The VBoxLive script is just super and I would want to make it as easy to get as I could, but not just that, you want to use a distribution method that several here can understand.

Anyway, when you get time it would be great to see VBoxLive in SuSE Paste.

Thank You,

Ok, here’s a gzipped tar archive if you prefer: http://www.unixversal.com/linux/openSUSE/vmscripts-1.2.tgz.
And here’s the latest vboxlive code: http://www.unixversal.com/linux/openSUSE/vboxlive.
vboxlive reads its configuration from /etc/vboxlive.cfg and the user’s ~/.vboxliverc.

# source system and user configuration files
cfgfiles=(/etc/vboxlive.cfg ~/.vboxliverc)
....
....
for cfg in ${cfgfiles[li]} ; do
[/li]	[ -f $cfg ] && source $cfg && CFG=YES 
done

It uses popup to display menus and messages boxes (although it will work without):

# use the popup library if found
which popup &>/dev/null && source $(which popup)

And it needs VBoxExtensionPack to install the (host) extensions (not to be confused with guest additions!)

[ -x /usr/bin/VBoxExtensionPack ] && sudo /usr/bin/VBoxExtensionPack

Hmm… Notice that the absolute path above wasn’t necessary (nor very clever if you intend to move the files).

Anyway at this level of “complexity” and while sourcing or calling other files, it sounds more reasonable to use a rpm and make it available in a repo, as this is the distribution method that anyone will understand under openSUSE and other rpm based distros. By the way the package is also available for Fedora and Mandriva, but the function to install VirtualBox is limited to openSUSE (I could probably extend it to Fedora). I would suggest installing the package and put the files that you want to modify in ~/bin (which should have a higher priority in your PATH than /usr/bin and /usr/local/bin). Before adding menus, try vboxlive -i to open any iso image and vbox -m to boot any distro (at least the ones listed in the config file).

Version 2.2 (beta)

I added the option -h ( or –hdd) optionally followed by a size in GB, which creates a VDI resizable disk and attaches it to the virtual machine. Obviously it won’t be a diskless vm anymore, but I thought that adding this feature would be a plus. Use it if you plan to install the distro on a (virtual) disk. The default size of 8GB can be changed by setting the variable hdsize to another value in your ~/.vboxliverc.

Examples:


$ vboxlive -H -o opensuse  	# create a virtual machine called "opensuse" with a 8 GB virtual disk (default size)
$ vboxlive -H 4 -o opensuse     # create a virtual machine called "opensuse" with a 4 GB virtual disk
$ vboxlive -o opensuse   	# create a diskless virtual machine called "opensuse-LiveCD"

Once a virtual disk exists for a virtual machine, the option -H won’t create a new virtual disk nor resize the existing one. But it can be used to start to boot the virtual machine that has a disk attached rather than the diskless one.


$ vboxlive -H -o opensuse  	# boots the  virtual machine "opensuse" 
$ vboxlive -o opensuse  	# boots the diskless  virtual machine "opensuse-LiveCD"
$ vboxlive -o opensuse -d  	# boots opensuse in the default virtual machine called "LiveCD"

The system-wide config file /etc/vboxlive.cfg doesn’t get overwritten when the package is updated. Though you might want to use the latest version of this file, installed as /etc/vboxlive.cfg.rpmnew, by renaming it to /etc/vboxlive.cfg.

|vboxlive works on openSUSE 12.1 with a minor change that actually only affects the installation of VirtualBox - which most people won’t do using this script anyway, because when they get to read this howto they will most likely have VirtualBox already installed. However the script provides an easy way to install Oracle VirtualBox, as it will install it automatically if it’s missing (including the latest extension pack) as soon as you run your first virtual machine. Here’s how to install VirtualBox and start Ubuntu Oneiric live CD in a virtual machine on (a fresh) openSUSE 12.1:
|

sudo zypper ar http://download.opensuse.org/repositories/home:/please_try_again/openSUSE_12.1/  PTA
sudo zypper ref -r PTA
sudo zypper in vmscripts
vboxlive -o ubuntu -D

Instead of ubuntu, you could type kubuntu, fedora, opensuse … or any of the distros listed in the output of vboxlive -g.

Notice that it uses Oracle 11.4 repo. As soon as Oracle provides a repo for openSUSE 12.1 (?), the following line should be changed accordingly in /etc/vboxlive.cfg (or in your user ~/.vboxliverc):

VirtualBox_rel="11.4"

|http://img577.imageshack.us/img577/464/vboxliveopensuse121.th.png](http://img577.imageshack.us/img577/464/vboxliveopensuse121.png)|

Thanks a lot!
This automation is great!
Is there an wiki entry for this? I’ve not found any!

Euh … nope… but it would probably help me understand my code. lol!

The following command will run 12.2 RC2 live CD in a virtual machine:

$ vboxlive -b -o opensuse -D

You don’t need to download the iso image or install VirtualBox. The script takes care of that.

http://desmond.imageshack.us/Himg694/scaled.php?server=694&filename=vboxlive122.png&res=crop](http://img694.imageshack.us/img694/562/vboxlive122.png)

If you updated the vmscripts package, the file /etc/vboxlive.cfg on your system will NOT be overwritten. The rpm will install /etc/vboxlive.cfg.rpmnew instead. You should rename this file to /etc/vboxlive.cfg in order to use the latest urls - among others openSUSE 12.2 RC2 download url.