[TOC]
Quick Reference to VirtualBox CLI commands
vboxmanage list vms
vboxmanage list runningvms
vboxheadless -s VMNAME
vboxmanage snapshot VMNAME list
vboxmanage snapshot VMNAME restore UUID
vboxmanage snapshot VMNAME take SNAPSHOTNAME
VBoxManage createvm -name VM1 -register
VBoxManage createhd -filename VM1.vdi -size 10000 -register
VBoxManage modifyvm VM1 -sata on -sataportcount 2 -sataport1 VM1.vdi
VBoxManage openmedium dvd ~/.iso
VBoxManage modifyvm VM1 -dvd ~/.iso
VBoxManage modifyvm VM1 -memory 768MB -acpi on
VBoxManage modifyvm VM1 -nictype1 82540EM -hwvirtex on
VBoxManage modifyvm VM1 -bioslogofadein off -bioslogofadeout off
VBoxManage modifyvm VM1 -boot1 dvd -nic1 bridged -bridgeadapter1 eth0
VBoxManage modifyvm VM1 -vrdp on
VBoxManage modifyvm VM1 -vrdpport 7777
rdesktop -a 16 -N 1.2.3.4:3389
mstsc 1.2.3.4:3389
# https://www.virtualbox.org/manual/ch07.html
VBoxManage showvminfo VM1
vboxmanage import example.ova --dry-run --vsys 0 --eula accept
VBoxHeadless -startvm VM1 --vrde off
if vrde/vrdp is on 3389 can be used to get to local console, BUT only one vm can run with vrde at a time
vboxmanage controlvm <vm> pause # suspend the VM, not saving, not snapshotting
vboxmanage controlvm <vm> resume # resume paused/suspended VM
vboxmanage controlvm <vm> savestate # graceful shutdown and saves to hard disk the state
vboxmanage controlvm <vm> poweroff # hard shut down pulling the power cable
vboxmanage controlvm <vm> reset # hard shut down pulling the power cable and then start the vm again
right ctrl key + fn2 to jump to the second tty console
right ctrl key + right alt key to recapture control of the mouse
Installing VirtualBox using the command line (Ubuntu)
https://www.virtualbox.org/wiki/Downloads wget the Install and the ExtensionPack, e.g.
wget http://download.virtualbox.org/virtualbox/4.2.18/Oracle_VM_VirtualBox_Extension_Pack-4.2.18-88780.vbox-extpack
dpkg -i virtualbox-4.2_4.2.18-88780~Ubuntu~raring_amd64.deb
errors due to unmet dependencies
apt-get -f install
installs the unmet dependencies
dpkg -i virtualbox-4.2_4.2.18-88780~Ubuntu~raring_amd64.deb`
VBoxManage list extpacks
vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.2.18-88780.vbox-extpack
VBoxManage list extpacks
Upgrade the extension pack manually using the CLI
sudo VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-4.2.18-88780.vbox-extpack
Importing an OVA and setting the Linux Guest module blacklist
virtualbox import ova
ubuntu based Guest
very long initial boot due to ubuntu expecting a module that virtualbox does not provide
"piix4_smbus 0000.00.07.0: SMBus base address uninitialized - upgrade bios or use force_addr=0xaddr"
after patiently waiting 10 minutes login to the console and...
sudo lsmod | grep i2c_piix4
if it is loaded then...
sudo vi /etc/modprobe.d/blacklist.conf
if the module is not listed then add it to the end
sudo echo "blacklist i2c_piix4" >> /etc/modprobe.d/blacklist.conf
update-initramfs -u -k all
reboot
Windows based guest with 3d acceleration (WDDM)
Settings: Ensure the Guest has at least 128MB video memory, 3d Acceleration enabled Start the VM: Devices -> (mount) Guest Additions; Computer -> CD Drive; double click the executable; reboot
Older instructions on installing virtualbox in Ubuntu
sudo apt-get install dkms
VirtualBox host kernel modules (vboxdrv, vboxnetflt and vboxnetadp) are updated if kernel version changes
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | rpm --import -
sudo echo "deb http://download.virtualbox.org/virtualbox/debian saucy contrib" > /etc/apt/sources.list.d/virtualbox.list
sudo apt-get update
sudo apt-get install virtualbox-4.3
https://www.virtualbox.org/wiki/Linux_Downloads
sudo dpkg -i virtualbox_4.3....deb # helps if DKMS doesn't prevent virtualbox kernel extensions getting clobbered
wget -O virtualbox_1.6.2-31466_Ubuntu_hardy_i386.deb
OR
apt-get install elinks
elinks to text browse to virtualbox.org and download the right .deb
OR
echo "deb http://download.virtualbox.org/virtualbox/debian hardy non-free" > /etc/apt/sources.list.d/virtualbox.list
sudo wget -q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc -O- | sudo apt-key add -
apt-get update
apt-cache search virtualbox
apt-get install -f virtualbox-2.2
still doesn't work, unmet dependencies...
apt-get update //(ensure your apt sources are good... ) apt-get -u upgrade //upgrade packages with -u verbose option
sudo dpkg -i virtualbox_2.2.2 ... Ubuntu_hardy_i386.deb
To fix the "required dependencies" errors (you can't even apt-get install -f libqt...)
virtualbox-2.2: Depends: libqt4-core (>= 4.3.4)
Depends: libqt4-gui (>= 4.3.4)
Depends: libsdl1.2debian (>= 1.2.10-1)
Depends: libxmu6
Depends: libxt6
sudo apt-get -f upgrade
apt-get install -f //this installs all needed dependencies?
Now you get "old vboxdrv kernel modules found... purge..." /etc/init.d/vboxdrv setup
Should the kernel module be compiled now (yes!)
FAILS because I didn't do...
//the following gets the necessary files to compile the vbox kernel module //it can only be run after the above unmet depencies are fixed...
sudo apt-get install linux-headers-$(uname -r) build-essential virtualbox-2.2
In order to have write permissions to /dev/vboxdrv
sudo adduser [your username] vboxusers
OR
usermod -a -G vboxusers [username]
If you install ubuntu server as a guest (hmmm Virtual UBU on Real UBU?)
"Enabling PAE/NX on virtualbox solved my ubuntu server boot error."
In my adventure I had to get access to my boot iso image and copy it to my home dir
sudo mount -t smbfs -o username=winntuser,password=mypassword //windowsserver/sharename /mnt/win
cp /mnt/win/acronis-uni-restore-bartpe-mustang.iso ~/.Virtualbox
ctrl-z //to suspend current job bg //to make current job background job jobs //to see background jobs
cd ~ ls -ahl //to see how much of the file is transferred
vbox commandline for headless control (ie server w/o GUI) # NOTE: Linux is case sensitive! help via which virtualbox; /usr/bin/virtualbox
VBoxManage createhd -filename "winxp.vdi" -size 10000 -register # created in /home/USER_NAME/.VirtualBox/HardDisks/
VBoxManage createvm -name winxp -register # created in /home/USER_NAME/.VirtualBox/Machines/
VBoxManage modifyvm "winxp" -hda "winxp-hd"
VBoxManage registerimage dvd /~/.Virtualbox/acronis-uni-restore-bartpe.iso
VBoxManage modifyvm "winxp" -dvd /full/path/to/iso.iso
VBoxManage modifyvm "winxp" -memory "1024MB" -acpi on -boot1 dvd -nic1 nat
VBoxManage modifyvm "winxp" -vrdp on
vBoxManage showvminfo winxp
VBoxHeadless -startvm winxp
ctrl-z //to suspend current job bg //to make current job background job jobs //to see background jobs
Remote Desktop (port 3389) into the BARTPE cd loading...
Since we're using NAT we can ping around...
BartPe Networking -> cmd
net use \192.168.1.35\external /user:domain\username # It will then prompt for the password
Now we can use the Mustang Plugin for universal restore to access our backup image file on z:\
VBoxManage controlvm
VBoxManage unregistervm [vmname] -delete