Bug 200276

Summary: emulators/virtualbox-ose: Permission denied when attempting to run on fresh install
Product: Ports & Packages Reporter: Will B <will.brokenbourgh2877>
Component: Individual Port(s)Assignee: Virtualbox Team (Nobody) <vbox>
Status: Closed Overcome By Events    
Severity: Affects Some People CC: decke, freebsd-bugzilla, grahamperrin, me, swills, w.schwarzenfeld
Priority: --- Keywords: needs-patch, needs-qa
Version: Latest   
Hardware: amd64   
OS: Any   

Description Will B 2015-05-18 01:05:16 UTC
Problem
- - - -
After clean install of FreeBSD 10.1 and 'emulation/virtualbox-ose', when trying to run the program, the following is output to the console:
  
  "exec: /usr/local/lib/virtualbox/VirtualBox: Permission denied"

I must chmod +x /usr/local/lib/virtualbox/VirtualBox as root in order to use it.

Expectation
- - - - - -
VirtualBox should launch without needing to change run permissions, especially as root.

Thank you,

Will Brokenbourgh
Comment 1 Dan LaManna 2016-06-07 00:15:26 UTC
Duplicated on FreeBSD 10.3.
Comment 2 Steve Wills freebsd_committer freebsd_triage 2016-06-07 01:02:34 UTC
I believe this is by design. You should add yourself to the vboxusers group as documented in the virtualbox-ose pkg-message. This command will show the pkg-message at any time in case you need it:

pkg info -D virtualbox-ose

I think we can close this bug report.
Comment 3 Will B 2016-06-07 01:32:13 UTC
(In reply to Steve Wills from comment #2)
I failed to mention it in my initial report, but I *was* part of the vboxusers group and the problem persisted.
Comment 4 Steve Wills freebsd_committer freebsd_triage 2016-06-07 02:27:43 UTC
(In reply to Will B from comment #3)
Ah, I see. And you're sure you logged out and back in?
Comment 5 Will B 2016-06-07 02:42:02 UTC
(In reply to Steve Wills from comment #4)
I just did a fresh install of FreeBSD 10.3, then virtualbox-ose.  When configured as described in the package message, VirtualBox starts fine as a non-root user now.

I do remember VirtualBox did not launch properly before, even when the instructions in the package message were followed, followed by a reboot.

I'm fine with this being closed now unless Dan's problem is still not solved...
Comment 6 Bernhard Froehlich freebsd_committer freebsd_triage 2016-06-07 11:35:34 UTC
As soon as you run VirtualBox as root once it will overwrite some permissions in /tmp or /var which it needs to properly start. That means the next start will fail with a very cryptic error message.
Comment 7 Graham Perrin freebsd_committer freebsd_triage 2016-07-01 00:14:11 UTC
(In reply to Bernhard Froehlich from comment #6)

Please, can we be more specific about those changes to permissions? 

When I found symptoms of the problem, around ten days ago: 

[PC-BSD Testing] VirtualBox will not launch, permission denied, on 11.0-CURRENTJUNE2016
http://lists.pcbsd.org/pipermail/testing/2016-June/010739.html 

– and more recent output, below, shows VirtualBox still not working without superuser privileges. 

---- 

$ date ; freebsd-version ; uname -a
Friday  1 July 2016 at 01:06:26 BST
11.0-CURRENTJULY2016
FreeBSD hpelitebook850g2-pcbsd.university.brighton.ac.uk 11.0-CURRENTJULY2016 FreeBSD 11.0-CURRENTJULY2016 #5 b7bc135(linux-drm-4.6): Thu Jun 23 02:22:14 UTC 2016     root@devastator:/usr/obj/usr/src/sys/GENERIC  amd64
$ virtualbox
exec: /usr/local/lib/virtualbox/VirtualBox: Permission denied
$ sudo virtualbox
Password:
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
Qt WARNING: libpng warning: iCCP: known incorrect sRGB profile
$ virtualbox
exec: /usr/local/lib/virtualbox/VirtualBox: Permission denied
$
Comment 8 Gary 2016-07-01 10:48:00 UTC
What is the output of

ls -lad /usr/local/lib/virtualbox /usr/local/lib/virtualbox/VirtualBox

Also please paste the output of

groups
Comment 9 Graham Perrin freebsd_committer freebsd_triage 2016-07-01 17:33:42 UTC
(In reply to Gary from comment #8)

$ ls -lad /usr/local/lib/virtualbox /usr/local/lib/virtualbox/VirtualBox
drwxr-xr-x+ 5 root  wheel         61  9 Jun 17:46 /usr/local/lib/virtualbox
-r-s--x---  1 root  vboxusers  28952  6 Jun 05:55 /usr/local/lib/virtualbox/VirtualBox
$ groups
gjp4 wheel operator
$
Comment 10 Gary 2016-07-01 17:34:51 UTC
(In reply to Graham Perrin from comment #9)
You need to be in the vboxusers group.  You also need to log out and back in again once you have added yourself to the group.
Comment 11 Graham Perrin freebsd_committer freebsd_triage 2016-07-01 17:36:22 UTC
Maybe relevant: 

[PC-BSD Testing] PC-BSD User Manager GUI seems to fail to add me to a required group
http://lists.pcbsd.org/pipermail/testing/2016-July/010753.html
Comment 12 Gary 2016-07-01 17:38:56 UTC
(In reply to Graham Perrin from comment #11)
group membership is a property determined on login and stays with your session until logout.  It is not dynamically re-evaluated when you change /etc/groups.

check to see if the group modification has been made with

grep ^vboxusers /etc/group

If it has, logout and login again and it should work
Comment 13 Graham Perrin freebsd_committer freebsd_triage 2016-07-01 18:07:10 UTC
(In reply to Gary from comment #12)

Thanks for the explanation. 

Now, VirtualBox does launch as expected. 

(The application seems to stop responding when I choose 'Add' from the Machine menu, I'll treat this as a separate issue.)
Comment 14 Will B 2016-10-06 05:46:53 UTC
Perhaps the post-install information should tell the user to add themselves to the `vboxusers` group in addition to/instead of the `operators` group as it does now.  This might clear up some of the issues.
Comment 15 Gary 2016-10-06 15:35:07 UTC
(In reply to Will B from comment #14)
It does

-- BEGIN QUOTE --
You also have to add all users to your vboxusers group in order to use vbox.

% pw groupmod vboxusers -m jerry
-- END QUOTE --
Comment 16 Will B 2016-10-06 15:47:31 UTC
@Gary, thanks for that.  For some reason I thought it said you had to add to the `operators` group.  Maybe that was a long time ago.  Thanks again. :-)
Comment 17 Gary 2016-10-06 15:50:12 UTC
(In reply to Will B from comment #16)
It also mentions the operator group, for access to USB devices

https://svnweb.freebsd.org/ports/head/emulators/virtualbox-ose/pkg-message?revision=415503&view=co

-- BEGIN QUOTE --
USB Support:
============

For USB support your user needs to be in the operator group and needs read
and write permissions to the USB device.

% pw groupmod operator -m jerry
-- END QUOTE --
Comment 18 Will B 2016-10-06 15:53:50 UTC
@Gary, fair enough. That's what I get for posting something passed my bedtime.
Comment 19 Walter Schwarzenfeld 2018-01-17 07:11:44 UTC
Is this still relevant?
Comment 20 Will B 2018-01-17 17:06:15 UTC
(In reply to w.schwarzenfeld from comment #19)
Don't know, I don't use FreeBSD anymore.