No USB support for GuestVMs when hosted on 13.2 running VirtBox 5.0.6

I just migrated my 13.2/KDE host machine from the Oracle Repository to the OBS Virtualization Repository and Reloaded Virtualbox 5.0.6

I am now (again) am able to open my two VMs, a Win10 and a LEAP42.1RC1.

In both guests, Devices reports no USB devices available.

I have the Oracle Extension Pack Loaded and active on the host (version 5.0.6r103037) which I believe is required (?) for USB 2 or USB 3 support.
My guest settings (both VM) have USB2.0 support enabled

Suggestions?

You probably have the KVM Paravirtualization feature enabled, which is new in 5.0.
Unfortunately, systemd misdetects the VM as KVM then instead of VirtualBox and therefore the guest additions are not started.

systemd has been updated to fix this in Leap and Tumbleweed, but not in 13.2 or 13.1 (yet?).

Workarounds:

  • set “Paravirtualization” (System->Acceleration) to “None” in the VM’s settings
  • edit /etc/init.d/vboxadd (in the guest) and remove the check whether it runs inside VirtualBox
  • uninstall openSUSE’s guest additions and install Oracle’s (they just run unconditionally)

I Already have Paravirtualization set to none.
In the VM, I get

carl@Leap141RC1VM:/etc/init.d> systemd-detect-virt
oracle

but if I look in /etc/init.d/vboxadd I see:

....
start()
{
    begin "Starting the VirtualBox Guest Additions ";

    if  -x /usr/bin/systemd-detect-virt  ]; then
      if  "x$(systemd-detect-virt)" != "xoracle"  ]; then
          fail "Not running on a virtualbox guest"
      fi
    fi

.......

note “oracle” vs “xoracle”

Maybe this explains why I had to manually modprobe all the guest kernel modules

I could just change “xoracle” to “oracle”, but I’ll wait for comment

No, that is correct.

It compares “x$(systemd-detect-virt)” (i.e. ‘x’ plus the output of systemd-detect-virt) with “xoracle”, that’s done to make it work if systemd-detect-virt would return an empty string.

What does “systemctl status vboxadd” say after a fresh boot of the guest?

Also, USB support is disabled by default in openSUSE’s virtualbox package for security reasons.
Did you copy /usr/lib/udev/rules.d/60-vboxdrv.rules to /etc/udev/rules.d/ and modify it as instructed in the file?
I.e. remove the ‘#’ comment sign on the indicated lines (on the host).
That’s necessary to make USB work.

Sorry, I missed the “x” in “x$(systemd-detect-virt)”

systemctl status vboxadd
vboxadd.service
   Loaded: loaded (/opt/VBoxGuestAdditions-5.0.6/init/vboxadd; enabled)
   Active: active (exited) since Fri 2015-10-16 13:07:41 EDT; 53min ago
  Process: 696 ExecStart=/opt/VBoxGuestAdditions-5.0.6/init/vboxadd start (code=exited, status=0/SUCCESS)

udev rules - Nope, had no idea.

I can follow that instruction.
Is there a “openSUSE” changes list that I need to read somewhere, rather than do it one missing feature at a time?

The only doc I see in the packages is the Standard Oracle pdf for 5.0.6

I am not aware of anything else you would have to do that isn’t necessary for Oracle’s version as well.

I made the necessary udev rules changes, restarted udev but saw no change.

So I rebooted my host, and attempts to start a VM are greeted with:

 Kernel driver not installed (rc=-1908)

The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing

'/sbin/rcvboxdrv setup'

as root. If it is available in your distribution, you should install the DKMS package first. This package keeps track of Linux kernel changes and recompiles the vboxdrv kernel module if necessary.

where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT. 


This process does not work, the executable is now at /usr/sbin/rcvboxdrv setup but fails with a message that this is done by a package.

I do have|virtualbox-host-kmp-desktop - Host kernel module for VirtualBox installed,
|
but seem to be missing a rule (or ?) to reload the modules on boot|

I am also beginning to realize that “sudo rpm -e --noscripts VirtualBox-5.0”
may have removed the package, but did not clean up rules, etc that had been installed.

I found the [old] Oracle Udev rule still in place in /etc/udev/rules.d, so likely there are others

You need to reboot, although I suppose unloading and reloading the vboxdrv kernel module (i.e. restart vboxdrv.service) would work too.
So I rebooted my host, and attempts to start a VM are greeted with:

This process does not work, the executable is now at /usr/sbin/rcvboxdrv setup but fails with a message that this is done by a package.

You cannot build the kernel module. The openSUSE host kmp package contains the module in pre-compiled form, the source code is not included.

I do have|virtualbox-host-kmp-desktop - Host kernel module for VirtualBox installed,
|
but seem to be missing a rule (or ?) to reload the modules on boot|

There’s vboxdrv.service (/etc/init.d/vboxdrv) that needs to be enabled/started on boot to load the module.

systemctl status vboxdrv

I am also beginning to realize that “sudo rpm -e --noscripts VirtualBox-5.0”
may have removed the package, but did not clean up rules, etc that had been installed.

It probably left the kernel module installed. The error message was something about DKMS, which rebuilds the kernel module for the current kernel automatically if it is not available.
Maybe try to uninstall dkms and reinstall virtualbox-host-kmp-desktop.

I found the [old] Oracle Udev rule still in place in /etc/udev/rules.d, so likely there are others

Shouldn’t that be in /usr/lib/udev/rules.d/?
I don’t think the Oracle package installs anything to /etc/…
Although maybe it doesn’t package the rule, but creates it in /etc/ the first time it runs or during installation. A packaging error I’d say, a package should own all files that it installs, rpm would then remove them (unless they are marked as config files which might also be the case here).
Anyway, remove it.

I don’t know what else might be left behind, as I never installed the Oracle package here.

Further evidence of a mess.

HPDV7-Linux:/home/carl # ls -l /usr/lib/systemd/system/vbox*
-rw-r--r-- 1 root root 495 Oct  4 14:50 /usr/lib/systemd/system/vboxautostart-service.service
-rw-r--r-- 1 root root 501 Oct  4 14:50 /usr/lib/systemd/system/vboxballoonctrl-service.service
-rw-r--r-- 1 root root 483 Oct  4 14:50 /usr/lib/systemd/system/vboxdrv.service
-rw-r--r-- 1 root root 477 Oct  4 14:50 /usr/lib/systemd/system/vboxweb-service.service


None of these files seem to be from the OBS Virtualization repo.(search in YAST)
Based on date (Oct4) I am guessing they are from the Oracle Repo

I don’t have DKMS loaded on this host, which adds to the mystery as to why the virtualbox 5.0 from oracle refused to clean up and get out of the way.

No, they aren’t.
The openSUSE packages still contains old legacy sysvinit scripts. (and vboxweb-service is part of virtualbox-web).

So remove them as well.

Btw, you can check whether a file belongs to an installed package (and which one) via “rpm -qf filename”.

I don’t have DKMS loaded on this host, which adds to the mystery as to why the virtualbox 5.0 from oracle refused to clean up and get out of the way.

I thought you had, and DKMS might have rebuilt the Oracle kernel module causing the problem.

But now I think that the problem is rather because the vboxdrv.service in /usr/lib/systemd/system/ overrides/shadows openSUSE’s /etc/init.d/vboxdrv and so the service isn’t started correctly on boot.
Removing the files you listed should fix it then, but maybe you also have to run “sudo systemctl vboxdrv” (or “sudo chkconfig vboxdrv on”) afterwards.

Thanks for the uber-hints.

I removed the four files.

systemctl was no help.

This sequence got things going

HPDV7-Linux:/etc/init.d # ./vboxdrv status
VirtualBox kernel module is not loaded.
VirtualBox kernel module is not loaded.
HPDV7-Linux:/etc/init.d # ./vboxdrv start
redirecting to systemctl start .service
Starting VirtualBox kernel modules 

VM started up and USBs are available for assignment to the VM

All seems good for now.

Just to avoid a misunderstanding here:
“systemctl enable vboxdrv” does not start/load anything. But it tells the system that vboxdrv should be started during the boot.
“systemctl start vboxdrv” (or “/etc/init.d/vboxdrv start” which systemctl actually runs in this case) would start it now, in the currently running system (if it hasn’t been started already) and load the kernel module.

Ah so, understand.

I was successful with the init.d method.

Thanks