Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 749273

Summary: app-emulation/virtualbox: Can't launch VMs using after switching from app-emulation/virtualbox-bin
Product: Gentoo Linux Reporter: Lori <lori>
Component: Current packagesAssignee: Viorel Munteanu <ceamac>
Status: RESOLVED FIXED    
Severity: normal CC: hmun, proxy-maint
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: AMD64   
OS: Linux   
See Also: https://github.com/gentoo/gentoo/pull/27132
Whiteboard:
Package list:
Runtime testing required: ---

Description Lori 2020-10-15 11:37:13 UTC
I have been using app-emulation/virtualbox-bin until recently, when it was removed from the tree. After switching to the source ebuild app-emulation/virtualbox, I can no longer start existing or newly created VM. This is the error I get in a dialog box:

---
The virtual machine 'VM' has terminated unexpectedly during startup with exit code 1 (0x1).

Result Code:  NS_ERROR_FAILURE (0x80004005)
Component: MachineWrap
Interface: IMachine {85632c68-b5bb-4316-a900-5eb28d3413df}
---

Based on web searches this seems to be a relatively generic error, with different potential root causes. A while back I started a thread on the forums trying to solve the issue: https://forums.gentoo.org/viewtopic-t-1119409.html  There were several helpful suggestions that I tried, none of which helped, you can see all details in the thread. To summarize:
- I tried both stable and testing versions. They both build correctly, the GUI starts with no error, but I do get the above error when starting a VM
- I tried with both my existing VMs and newly created VMs
- I tried removing the existing config and starting from scratch
- I tried rebuilding the modules, and rebooting several times
- I tried running as root, to make sure it's not a permissions related issue
- I tried switching back to the binary version, it worked with no issues, switching back to source based I get the failure again

> eix -Ic virtualbox
[I] app-emulation/virtualbox (6.1.14a@10/04/2020): Family of powerful x86 virtualization products for enterprise and home use
[I] app-emulation/virtualbox-additions (6.1.14@10/02/2020): CD image containing guest additions for VirtualBox
[I] app-emulation/virtualbox-extpack-oracle (6.1.14.140239@10/02/2020): PUEL extensions for VirtualBox
[I] app-emulation/virtualbox-modules (6.1.14@10/13/2020): Kernel Modules for Virtualbox

> sudo emerge --info
Password: 
Portage 3.0.8 (python 3.7.8-final-0, default/linux/amd64/17.0/desktop/plasma, gcc-9.3.0, glibc-2.31-r6, 5.4.66-gentoo x86_64)
=================================================================
System uname: Linux-5.4.66-gentoo-x86_64-Intel-R-_Core-TM-_i7-2630QM_CPU_@_2.00GHz-with-gentoo-2.7
KiB Mem:    16293832 total,   4741224 free
KiB Swap:    8388604 total,   8346620 free
Timestamp of repository gentoo: Thu, 15 Oct 2020 10:45:01 +0000
Head commit of repository gentoo: c4a305dd52f8f347bd272b19605e1f320508d4d6
sh bash 5.0_p18
ld GNU ld (Gentoo 2.34 p6) 2.34.0
app-shells/bash:          5.0_p18::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.30.3::gentoo
dev-lang/python:          2.7.18-r4::gentoo, 3.7.8-r2::gentoo, 3.8.5::gentoo
dev-util/cmake:           3.17.4-r1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.34-r2::gentoo
sys-devel/gcc:            6.5.0-r3::gentoo, 9.3.0-r1::gentoo
sys-devel/gcc-config:     2.3.2::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.31-r6::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync8.de.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts: 

local
    location: /usr/local/portage
    masters: gentoo
    priority: 0

bumblebee
    location: /var/lib/layman/bumblebee
    masters: gentoo
    priority: 50

pentoo
    location: /var/lib/layman/pentoo
    masters: gentoo
    priority: 50

steam-overlay
    location: /var/lib/layman/steam-overlay
    masters: gentoo
    priority: 50

torbrowser
    location: /var/lib/layman/torbrowser
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /usr/share/themes/oxygen-gtk/gtk-3.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://mirrors.evowise.com/gentoo/ http://mirrors.xservers.ro/gentoo/ http://ftp.romnet.org/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi activities alsa amd64 bash-completion berkdb bluetooth branding bzip2 cairo calendar cdr cli crypt cscope cuda cups cvs dbus declarative djvu dri dts dv dvb dvd dvdr elogind emboss encode exif ffmpeg flac fontconfig fortran ftp gdbm geoip geolocation gif gimp git gnuplot gphoto2 gpm graphviz gtk gtk3 gui hddtemp iconv icu imagemagick ipv6 java javascript jpeg jpeg2k kde kerberos kipi kwallet lcms libass libglvnd libnotify libtirpc lto lzma mad matroska mmap mmx mng mp3 mp4 mpeg mpi multilib ncurses networkmanager nls nptl nsplugin offensive ogg openexr opengl openmp pam pango pcre pcsc-lite pdf phonon pkcs11 plasma png policykit ppds pulseaudio qml qt5 rdesktop readline rss samba sdl seccomp semantic-desktop sftp smartcard smp spell split-usr sqlite sqlite3 sse sse2 sse3 sse4_1 ssl ssse3 startup-notification subversion svg taglib tcl tcpd theora threads tiff tk truetype udev udisks unicode upower usb v4l vaapi vim-syntax vnc vorbis webp widgets wifi wxwidgets x264 x265 xattr xcb xml xmp xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2 php7-3 php7-4" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_7" PYTHON_TARGETS="python2_7 python3_7" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="intel nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Hermann Mundprecht 2020-10-18 08:50:03 UTC
I have exactly the same problem. Just to add from the VBoxSVC.log:

00:00:00.148170 nspr-2   Loading settings file "/opt/nc/vbox/New group/Test/Test.vbox" with version "1.16-linux"
00:00:00.148497 nspr-2   VirtualBox: object created
00:00:00.705486 nspr-2   Failed to open "/dev/vboxdrvu", errno=13, rc=VERR_VM_DRIVER_NOT_ACCESSIBLE
00:00:17.366679 nspr-4   Failed to open "/dev/vboxdrvu", errno=13, rc=VERR_VM_DRIVER_NOT_ACCESSIBLE
00:00:22.398594 nspr-5   Failed to open "/dev/vboxdrvu", errno=13, rc=VERR_VM_DRIVER_NOT_ACCESSIBLE
00:00:27.389504 nspr-2   Failed to open "/dev/vboxdrvu", errno=13, rc=VERR_VM_DRIVER_NOT_ACCESSIBLE
00:00:27.873538 Watcher  ERROR [COM]: aRC=NS_ERROR_FAILURE (0x80004005) aIID={5047460a-265d-4538-b23e-ddba5fb84976} aComponent={MachineWrap} aText={The virtual machine 'Test' has terminated unexpectedly during startup with exit code 1 (0x1)}, preserve=false aResultDetail=0
00:00:28.408704 nspr-4   Failed to open "/dev/vboxdrvu", errno=13, rc=VERR_VM_DRIVER_NOT_ACCESSIBLE
00:26:25.870447 main     VirtualBox: object deletion starts

the kernel modules are loaded and the devices exist:
crw------- 1 root root      10, 60 Oct 18 10:14 /dev/vboxdrv
crw------- 1 root root      10, 59 Oct 18 10:14 /dev/vboxdrvu
crw------- 1 root root      10, 58 Oct 18 10:14 /dev/vboxnetctl

Kernel version is also 5.4.66-gentoo
Comment 2 Lori 2020-10-21 15:44:38 UTC
The issue persists with the newly released 6.1.14 version.
Comment 3 Lori 2020-10-21 15:48:27 UTC
(In reply to Lori from comment #2)
> The issue persists with the newly released 6.1.14 version.

Sorry, I meant 6.1.16
Comment 4 Hermann Mundprecht 2020-11-28 00:08:31 UTC
I solved the issue on the one of my machines that had this problem.

It was a problem with the ownership of the directories where the VirtualBox binaries reside.
The have to belong to root:root

I fixed this with:
# chown root:root /usr
# chown root:root /usr/lib64
# chown root:root /usr/lib64/virtualbox

The binary version used to install in /opt/VirtualBox/ and therefore I did not notice the problem. According to https://www.virtualbox.org/ticket/16759 the parent folders of the virtualbox binaries have to belong to root:root since 5.1.20

Maybe this could be checked by the ebuild?
Comment 5 Alex La Hurreau 2020-11-28 00:51:18 UTC
(In reply to Hermann Mundprecht from comment #4)
> I solved the issue on the one of my machines that had this problem.
[...]

I can confirm that this solution fixes the issue on my machine as well. For some unknown reason, both /usr and /usr/lib64 (and /usr/lib64/kde4) were owned by UID 1002 GID 1002, which no longer exists on my system. (Perhaps a legacy of some past installation?)

Resetting the ownership of these directories to root:root fixed the issues with running virtualbox as a normal user.
Comment 6 Lori 2020-11-30 19:51:30 UTC
Thank you! I confirm that I needed to change my /usr folder ownership to root and that fixed the issue.

VirtualBox could really improve their error dialogs...
Comment 7 Larry the Git Cow gentoo-dev 2022-09-05 01:22:37 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6abf35b9907a61390aef371e6ead261ef036ab1d

commit 6abf35b9907a61390aef371e6ead261ef036ab1d
Author:     Viorel Munteanu <ceamac.paragon@gmail.com>
AuthorDate: 2022-09-04 08:28:24 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-09-05 01:19:03 +0000

    app-emulation/virtualbox: add check to pkg_pretend
    
    Check /usr, /usr/lib are owned by root.
    
    Closes: https://bugs.gentoo.org/749273
    Signed-off-by: Viorel Munteanu <ceamac.paragon@gmail.com>
    Signed-off-by: Sam James <sam@gentoo.org>

 app-emulation/virtualbox/virtualbox-6.1.38.ebuild | 9 +++++++++
 1 file changed, 9 insertions(+)