VirtualBox

From ConShell
Jump to navigation Jump to search

About

VirtualBox is a free open-source virtualization platform from Oracle (formerly Sun).

http://www.virtualbox.org/

Manual

The online manual can be found here.

Tips

USB support on Linux

Download the Extension Pack at https://www.virtualbox.org/wiki/Downloads

Install it into the VirtualBox application below File => Preferences => Extensions

Ubuntu Installation

aptitude install virtualbox virtualbox-guest-additions-iso

This will get you an slightly older version i.e. 4.1.12. There also appears to be a virtualbox-nonfree package which I have not tried.

To allow regular users to use VirtualBox on Linux i.e. Ubuntu, add the username to the vboxusers group in /etc/group

adduser username vboxusers

Installing the virtualbox-guest-additions-iso package allows you install the guest additions in each guest from the Devices->Install Guest Additions

After upgrading to Ubuntu Trusty, I found I could no longer connect to RDP. Remmina fails to connect. rdesktop returns connection closed.

mdf@mfoster-wkstn:~$ rdesktop 127.0.0.2:33890
Autoselected keyboard map en-us
ERROR: Connection closed

After poking around, I found I need to install the extpack, but it would not install from the GUI, instead returning the error

The installer failed with exit code 127: Error creating textual authentication agent: Error opening current controlling 
terminal for the process (`/dev/tty'): No such device or address

Checking permissions of /dev/tty there is not a problem there.

mdf@mfoster-wkstn:~$  ls -al /dev/tty
crw-rw-rw- 1 root tty 5, 0 Jul 20 14:04 /dev/tty

I attempt to install by hand, it gives same error!

mdf@mfoster-wkstn:~$ VBoxManage extpack install Downloads/Oracle_VM_VirtualBox_Extension_Pack-4.3.10-93012.vbox-extpack 
0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to install "/home/mdf/Downloads/Oracle_VM_VirtualBox_Extension_Pack-4.3.10-93012.vbox-extpack"
VBoxManage: error: The installer failed with exit code 127: Error creating textual authentication agent: Error opening current
controlling terminal for the process (`/dev/tty'): No such device or address
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ExtPackManager, interface IExtPackManager
VBoxManage: error: Context: "int handleExtPack(HandlerArg*)" at line 1143 of file VBoxManageMisc.cpp

Try again, but use sudo, it does the magic

mdf@mfoster-wkstn:~$ sudo VBoxManage extpack install Downloads/Oracle_VM_VirtualBox_Extension_Pack-4.3.10-93012.vbox-extpack 
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Successfully installed "Oracle VM VirtualBox Extension Pack".

Afterwards, I remove the VNC extension and RDP works now using rdesktop, but not remmina.

Command line

The two interesting command line utilities are: VBoxManage and VBoxHeadless

List VMs

VBoxManage list vms

Add -l (long) for a very detailed listing of each VMs attributes.

Info about a VM

The showvminfo command provides quite a bit of detail about a VM.

$ VBoxManage showvminfo mdftestb1
Name:            mdftestb1
Groups:          /
Guest OS:        Ubuntu (64 bit)
UUID:            ff4c6d82-9de7-4ac8-b281-ce6df265756c
Config file:     /home/mdf/VirtualBox VMs/mdftestb1/mdftestb1.vbox
Snapshot folder: /home/mdf/VirtualBox VMs/mdftestb1/Snapshots
Log folder:      /home/mdf/VirtualBox VMs/mdftestb1/Logs
Hardware UUID:   ff4c6d82-9de7-4ac8-b281-ce6df265756c
Memory size:     512MB
Page Fusion:     off
VRAM size:       12MB
CPU exec cap:    100%
HPET:            off
Chipset:         piix3
Firmware:        BIOS
Number of CPUs:  1
PAE:             off
Long Mode:       on
Synthetic CPU:   off
CPUID overrides: None
Boot menu mode:  message and menu
Boot Device (1): HardDisk
Boot Device (2): Network
Boot Device (3): Not Assigned
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          on
Time offset:     0ms
RTC:             UTC
Hardw. virt.ext: on
Nested Paging:   on
Large Pages:     off
VT-x VPID:       on
VT-x unr. exec.: on
State:           aborted (since 2015-04-20T15:07:59.772000000)
Monitor count:   1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address: 
Teleporter Password: 
Tracing Enabled: off
Allow Tracing to Access VM: off
Tracing Configuration: 
Autostart Enabled: off
Autostart Delay: 0
Default Frontend: 
Storage Controller Name (0):            IDE
Storage Controller Type (0):            PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  2
Storage Controller Port Count (0):      2
Storage Controller Bootable (0):        on
Storage Controller Name (1):            SATA
Storage Controller Type (1):            IntelAhci
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1):  30
Storage Controller Port Count (1):      1
Storage Controller Bootable (1):        on
IDE (1, 0): Empty
SATA (0, 0): /home/mdf/VirtualBox VMs/mdftestb1/Snapshots/{cdffd51d-e6b4-44de-b639-cd3cc9472281}.vdi (UUID: cdffd51d-e6b4-44de-b639-cd3cc9472281)
NIC 1:           MAC: 0800275FC13F, Attachment: Bridged Interface 'p2p1', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
Pointing Device: USB Tablet
Keyboard Device: PS/2 Keyboard
UART 1:          disabled
UART 2:          disabled
LPT 1:           disabled
LPT 2:           disabled
Audio:           enabled (Driver: PulseAudio, Controller: AC97)
Clipboard Mode:  disabled
Drag'n'drop Mode: disabled
VRDE:            disabled
USB:             enabled
EHCI:            disabled

USB Device Filters:

<none>

Available remote USB devices:

<none>

Currently Attached USB Devices:

<none>

Bandwidth groups:  <none>

Shared folders:  <none>

VRDE Connection:    not active
Clients so far:     0

View/Manage Hard Drive(s)

$ VBoxManage showhdinfo "/home/mdf/VirtualBox VMs/win7b/win7b.vdi" 
UUID:                 0226f256-633e-42e3-8aaa-34f1ed91f1ee
Accessible:           yes
Logical size:         25600 MBytes
Current size on disk: 12756 MBytes
Type:                 normal (base)
Storage format:       VDI
Format variant:       dynamic default
In use by VMs:        win7b (UUID: 28100c19-5c45-4870-bc6a-ff2ef0448dc5)
Location:             /home/mdf/VirtualBox VMs/win7b/win7b.vdi
VBoxManage modifyhd YOUR_HARD_DISK.vdi --resize SIZE_IN_MB

Note that you'll need to resize the partition after growing the disk. I used gparted which can not only resize the (NTFS) partition but grow the filesystem in one step!


Start a VM

VBoxHeadless -s vmname &

It's usually best to run the command above in a screen session.

At the very least, background it and consider prepending nohup...

Export

VBoxManage export "name of machine" -o export-vmname.ova

Tags: vbox