Page 1 of 1

Can only start VM as root not as regular user

Posted: 22. Nov 2012, 08:00
by rickratta
opensolaris solaris 11 mostly 2009/06
I had virtualbox running fine until I upgraded to 4.2.4.
Additionally my system is now headless.
I am using VNC to login to the machine and start virtual box from an xterm on my desktop.
I am getting the following error trying to start a previously created Windows XP VM as a regular user.
----
Failed to open a session for the virtual machine WindowsXP.

Cannot open host device '/devices/pci@0,0/pci-ide@1f,1/ide@0/sd@0,0:c,raw' for readonly access. Check the permissions of that device (VERR_ACCESS_DENIED).

Result Code: NS_ERROR_FAILURE (0x80004005)
Component: Console
Interface: IConsole {db7ab4ca-2a3f-4183-9243-c1208da92392}
---
However if I start virtualbox as the root user, the VM starts fine.

Any ideas ?

Thanks

-rick

Re: Can only start VM as root not as regular user

Posted: 22. Nov 2012, 14:30
by rahvee_clevertrove
Trying to reply.

Re: Can only start VM as root not as regular user

Posted: 22. Nov 2012, 14:34
by rahvee_clevertrove
It sounds like the device ownership has reset itself - this sometimes happens, for example, when rebooting the system and a zpool gets mounted or unmounted, so the OS recreates the device nodes.

Most likely you need to chown the device node and try again.

For what it's worth, the simplesmf virtualbox-guest-control project http://code.google.com/p/simplesmf/ allows you to easily start/stop guests, along with the chown of your device right before starting it.

Re: Can only start VM as root not as regular user

Posted: 22. Nov 2012, 16:29
by rickratta
Thanks for the response.
From the error it looks like the device node is the console.
When are these permissions supposed to be set to the correct value ? At install ?
Is the vboxconfig.sh supposed to do it ?

From what I can see in that script it only manipulates vboxdrv and vboxusbmon with devfsadm.

And what are the permissions supposed to be when set correctly ?

I'm trying to understand what the problem is and why it is occurring in the first place.

Thanks

-rick

Re: Can only start VM as root not as regular user

Posted: 22. Nov 2012, 18:52
by rickratta
Got it.
I don't understand it but changing the permissions on /devices/pci@0,0/pci-ide@1f,1/ide@0/sd@0,0:c,raw seemed to get
the vm started. It's a mystery to me how and when these permissions get set.

But thanks for the help.

-rick

Re: Can only start VM as root not as regular user

Posted: 23. Nov 2012, 15:44
by rahvee_clevertrove
The device you mentioned says "pci-ide" in it. That is not the console, that is the raw storage device that you have wrapped in the vmdk. If you "cat" the vmdk (which is actually a txt file) you'll see that it references some device, like perhaps /dev/rdsk/c0d0t4 or whatever. If you "ls -l" that thing, you'll see it's actually a symlink that points to the long name you mentioned.

The symlink destination is prone to change from time to time. So the best thing for you to do is read the vmdk file, find out what device it is referencing, and then make a habit of always chowning it a moment before starting the VM. If you want it to happen automatically, you can do it with simplesmf; if you want to do it manually, I would recommend writing a one-line script, or a shell alias, so you won't have to look it up again in the future.