1. VirtualBox common issues
    1. Guest Additions issues
    2. Exchange files between host and guest in Linux
    3. Extension pack
    4. Missing VM
    5. VM copying
      1. Case
      2. Solution
    6. VM failed to start
      1. Case
      2. Solution
    7. QT FATAL
      1. Case
      2. Solution
    8. VERR_VMX_NO_VMX
      1. Case
      2. Solution
    9. Other notes related with VirtualBox
      1. DKMS
      2. Groups
      3. UUID
      4. Help about VirtualBox

Author: Edmund Laugasson

VirtualBox common issues

Following commands are tested in Ubuntu Linux and/or Linux Mint 64-bit LTS-version.

Guest Additions issues

case: Guest Additions not working

solution

howto from official manual

please ensure that

sudo apt update && sudo apt install build-essential dkms linux-headers-generic

Even better - install some more metapackage of linux-headers with newer versions:

apt search linux-headers-generic
p   linux-headers-generic                                      - Generic Linux kernel headers                                        
p   linux-headers-generic:i386                                 - Generic Linux kernel headers                                       
p   linux-headers-generic-hwe-16.04                            - Generic Linux kernel headers (dummy transitional package)          
p   linux-headers-generic-hwe-16.04:i386                       - Generic Linux kernel headers (dummy transitional package)          
p   linux-headers-generic-hwe-16.04-edge                       - Generic Linux kernel headers (dummy transitional package)          
p   linux-headers-generic-hwe-16.04-edge:i386                  - Generic Linux kernel headers (dummy transitional package)          
i   linux-headers-generic-hwe-18.04                            - Generic Linux kernel headers                                       
p   linux-headers-generic-hwe-18.04:i386                       - Generic Linux kernel headers                                       
p   linux-headers-generic-hwe-18.04-edge                       - Generic Linux kernel headers                                       
p   linux-headers-generic-hwe-18.04-edge:i386                  - Generic Linux kernel headers

man aptitude explains the first letter (i - installed, p - not installed)

           The first character of each line indicates
           the current state of the package: the most common states are p, meaning that no trace of
           the package exists on the system, c, meaning that the package was deleted but its
           configuration files remain on the system, i, meaning that the package is installed, and v,
           meaning that the package is virtual. The second character indicates the stored action (if
           any; otherwise a blank space is displayed) to be performed on the package, with the most
           common actions being i, meaning that the package will be installed, d, meaning that the
           package will be deleted, and p, meaning that the package and its configuration files will
           be removed. If the third character is A, the package was automatically installed.

Full list of flags: aptitude reference manual -> Accessing package information

Depends on what you are running but HWE headers and kernel might be good idea (usually newer version) if you haven't updated your Ubuntu installation for a while. Otherwise choose just linux-headers-generic to install current headers metapackage, that is always depending on newest version.

Another option is to install exact version, which is not recommended: linux-headers-$(uname -r)

then reconfigure Guest Additions:

sudo rcvboxadd setup

Then reboot the machine.

Check installed Guest Additions version (quit with q):

service vboxadd status
vboxadd.service
   Loaded: loaded (/opt/VBoxGuestAdditions-6.1.6/init/vboxadd; enabled; vendor preset: enabled)
   Active: active (exited) since Mon 2020-05-11 18:28:54 EEST; 9h ago
 Main PID: 837 (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 4660)
   CGroup: /system.slice/vboxadd.service

mai   11 18:28:50 VirtualBox vboxadd[837]: modules.  This may take a while.
mai   11 18:28:50 VirtualBox vboxadd[837]: VirtualBox Guest Additions: To build modules for other installed kernels,
mai   11 18:28:50 VirtualBox vboxadd[837]: VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
mai   11 18:28:50 VirtualBox vboxadd[837]: VirtualBox Guest Additions: or
mai   11 18:28:50 VirtualBox vboxadd[837]: VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
mai   11 18:28:54 VirtualBox useradd[1226]: failed adding user 'vboxadd', data deleted
mai   11 18:28:54 VirtualBox useradd[1227]: failed adding user 'vboxadd', data deleted
mai   11 18:28:54 VirtualBox vboxadd[837]: VirtualBox Guest Additions: Running kernel modules will not be replaced un
mai   11 18:28:54 VirtualBox vboxadd[837]: the system is restarted
mai   11 18:28:54 VirtualBox systemd[1]: Started vboxadd.service.

Exchange files between host and guest in Linux

student   1599  0.0  0.0  56756   352 ?        S    mai  11   0:00 /usr/bin/VBoxClient --seamless
student   1600  0.0  0.0  56756   356 ?        S    mai  11   0:00 /usr/bin/VBoxClient --clipboard
student   1601  0.0  0.1 191196  4244 ?        Sl   mai  11   0:00 /usr/bin/VBoxClient --clipboard
student   1602  0.0  0.0 188992  2812 ?        Sl   mai  11   0:00 /usr/bin/VBoxClient --seamless
student   1610  0.0  0.0  56756   352 ?        S    mai  11   0:00 /usr/bin/VBoxClient --draganddrop
student   1611  0.0  0.0 189508  2876 ?        Sl   mai  11   0:32 /usr/bin/VBoxClient --draganddrop
student   1617  0.0  0.0  56756   352 ?        S    mai  11   0:00 /usr/bin/VBoxClient --vmsvga-x11
student   1618  0.0  0.0 193172  3896 ?        Sl   mai  11   0:00 /usr/bin/VBoxClient --vmsvga-x11

Then adding new share will make it appear (depending on distro, desktop environment, apps and its configuration) onto desktop or/and file manager. If there are permissions issues - please check that VirtualBox and Extension Pack are the same version and installed, configured properly (see previous issue).

In case of VirtualBox 6.1.4 there is a Guest Additions bug (extension stopped after working 60 seconds), to watch previous command:

Extension pack

what is installed:

sudo vboxmanage list extpacks

Install new extension pack and replace old one:

sudo vboxmanage extpack install --replace /path/Oracle_VM_VirtualBox_Extension_Pack-x.x.x-xxxxxx.vbox-extpack

Step-by-step

remove old extension pack:

sudo vboxmanage extpack uninstall "Oracle VM VirtualBox Extension Pack"

clean up

sudo vboxmanage extpack cleanup

install new one:

sudo vboxmanage extpack install /path/Oracle_VM_VirtualBox_Extension_Pack-x.x.x-xxxxxx.vbox-extpack

More information in extension pack section at VirtualBox manual.

Missing VM

Sometimes it might happen that VM is missing. One possible bug exist.

One reason might be missing .vbox file located at

~/VirtualBox VMs/Example VM/Example VM.vbox

In the same folder there is usually also the file

~/VirtualBox VMs/Example VM/Example VM.vbox-prev

One workaround would to close VirtualBox and then just copy the .vbox-prev file into same location with .vbox extension:

cd ~/VirtualBox VMs/Example VM/
cp "Example VM.vbox-prev" "Example VM.vbox"
... and reopen VirtualBox.
If still the VM did not appear into VirtualBox VMs list then there is possible to add the VM back via Machine->Add menu or CTRL+A shortcut key by browsing the .vbox file and adding it.

Yet another way, when there is no .vbox* files left - create a new VM using old .vdi virtual disk image file. If there is no .vdi file then the VM is gone. It would be useful to have copy of VM either just the folder or exported into .ova - ask lecturer whether she/he has preinstalled VM as .ova somewhere.

VM copying

Case

Copying VM folder to another storage and trying to add the machine (Machine->Add or CTRL+A) returns:

Cannot register the hard disk '/path/to/VMs/<VM name>/<VDI name>.vdi' {a73ccd48-a9b8-4274-954a-308c40634cae} because a hard disk '/path/to/VMs/<VM name>/<VDI name>.vdi' with UUID {1690f3e8-dc15-42ff-975b-4c9fa1c0b448} already exists.

Result Code:
NS_ERROR_INVALID_ARG (0x80070057)
Component:
VirtualBoxWrap
Interface:
IVirtualBox {0169423f-46b4-cde9-91af-1e9d5b6cd945}

Solution

Run at command line (replace with appropriate information about path and filename):

VBoxManage internalcommands sethduuid "/path/to/VMs/<VM name>/<VDI name>.vdi"

Open the file /path/to/VMs/<VM name>/<VM name>.vbox and correct following things (in bold):
lines 11-14:
      <HardDisks>
        <HardDisk uuid="{a73ccd48-a9b8-4274-954a-308c40634cae}" location="
/path/to/VMs/<VM name>/<VDI name>.vdi" format="VDI" type="Normal"/>
        <HardDisk uuid="{a73ccd48-a9b8-4274-954a-308c40634cae}" location="
/path/to/VMs/<VM name>/<VDI name>.vdi" format="VDI" type="Normal"/>
      </HardDisks>


lines 195...197:
        <AttachedDevice nonrotational="true" type="HardDisk" hotpluggable="false" port="0" device="0">
          <Image uuid="{a73ccd48-a9b8-4274-954a-308c40634cae}"/>
        </AttachedDevice>

For more information, please look in command line:
VBoxManage internalcommands

More information:

VM failed to start

Case

Installing new kernel, etc and at some reason new kernel modules are not compiled. Sometimes a new GCC version installation might be needed in case of very new version of kernel and old GNU/Linux distribution.

Solution

Make sure beforehand that dkms package is installed (see other notes at the below).

sudo vboxconfig

vboxconfig located at /sbin/ folder and access might be limited for regular users who have not it in path (to check: env | grep PATH)

Workaround (if previous do not work):

sudo /usr/lib/virtualbox/vboxdrv.sh setup
Restarting VB kernel modules:
sudo rcvboxdrv restart

Check whether kernel modules are loaded:
sudo rcvboxdrv status

QT FATAL

Case

Qt FATAL: This application failed to start because it could not find or load the Qt platform plugin "xcb". It usually happens on 32-bit platforms.

Solution

ldd /usr/lib/virtualbox/plugins/platforms/libqxcb.so | grep not
    libQt5XcbQpaVBox.so.5 => not found
    libQt5DBusVBox.so.5 => not found
    libQt5GuiVBox.so.5 => not found
    libQt5CoreVBox.so.5 => not found

sudo updatedb
locate libQt5XcbQpaVBox.so.5

/usr/lib/virtualbox/libQt5XcbQpaVBox.so.5

sudo ln -s /usr/lib/virtualbox/libQt5XcbQpaVBox.so.5  /lib/i386-linux-gnu/
sudo ln -s /usr/lib/virtualbox/libQt5DBusVBox.so.5  /lib/i386-linux-gnu/
sudo ln -s /usr/lib/virtualbox/libQt5GuiVBox.so.5  /lib/i386-linux-gnu/
sudo ln -s /usr/lib/virtualbox/libQt5CoreVBox.so.5  /lib/i386-linux-gnu/


check:
ls -l /lib/i386-linux-gnu/ | grep Qt

VERR_VMX_NO_VMX


Case

Please ensure that hardware virtualization (VT-x/AMD-V) is set both in BIOS, UEFI and in exact virtual machine.


Solution

Turn virtualization support on in BIOS, UEFI. Hints: 1 (MS Windows), 2 (Ubuntu, etc)

Change either graphically from settings:

or run the command in terminal:
VBoxManage modifyvm <uuid|vmname> [--hwvirtex on|off]
e.g. VBoxManage modifyvm 171efacc-1d43-ab9d295ce-1f84e64f492a --hwvirtex on

For more information about using VBoxManage, please see here.

Other notes related with VirtualBox

DKMS

DKMS - Dynamic Kernel Module Support

Please make sure that the package dkms is installed before you use VirtualBox.

In Ubuntu:

sudo apt-get update && sudo apt-get -y install dkms && sudo ldconfig && sudo dpkg --configure -a && sudo apt-get clean

Groups

When installing VirtualBox (VB), make sure that the user, who needs to use VB, are added to groups vboxusers, vboxsf. The last one is needed to share folders between host and guest in UNIX-like systems.

UUID

Overview (including UUID) of existing hard disk drives:

VBoxManage list hdds

VBoxManage showhdinfo <path>/<name>.vdi

Overview (including UUID) of existing virtual machines:

VBoxManage list vms

Filter with search string "ubuntu" (if you have used such name in virtual machine names, it is also case sensitive):
VBoxManage list vms | grep ubuntu

Help about VirtualBox

# # #

If you find something to add, improve, etc - please let me know.