Starting a VM with "su -c vboxuser" causes error

Discussions related to using VirtualBox on Linux hosts.
Post Reply
CpServiceSpb
Posts: 5
Joined: 21. Nov 2019, 23:55

Starting a VM with "su -c vboxuser" causes error

Post by CpServiceSpb »

I installed VirtualBox 6.0.14, extensoions pack on UBuntu 18.04 x64.
And I get error while start virtual machine:

starting VM = su -c "VBoxManage startvm u1804arm --type headless" vboxuser
Waiting for VM "u1804arm" to power on...
VBoxManage: error: The virtual machine 'u1804arm' has terminated unexpectedly during startup with exit code 1 (0x1)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component MachineWrap, interface IMachine
How is to solve it ?
There is impossible to use virtual machines.

I saw the same error in Windows Host topic, but there was solution.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Starting a VM with "su -c vboxuser" causes error

Post by socratis »

CpServiceSpb wrote:
su -c "VBoxManage startvm u1804arm --type headless" vboxuser
Can you explain to me why you're starting the VM like that? What if you start it like this:
  • 
    VBoxManage startvm u1804arm --type headless
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
CpServiceSpb
Posts: 5
Joined: 21. Nov 2019, 23:55

Re: Starting a VM with "su -c vboxuser" causes error

Post by CpServiceSpb »

I want to run under vbox user, not under root user.
And I want to store VMs list not to user home folder but to 3rd indeprendent folder.
Last edited by socratis on 22. Nov 2019, 11:42, edited 1 time in total.
Reason: Removed unnecessary verbatim quote of the whole previous message.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Starting a VM with "su -c vboxuser" causes error

Post by socratis »

CpServiceSpb wrote:I want to run under vbox user, not under root user.
Great! Nobody should be running VirtualBox as 'root'.

So... what happens if you login as 'vboxuser' and try the command on my previous comment? Directly from the 'vboxuser' account?

Start simple, then go fancy...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Starting a VM with "su -c vboxuser" causes error

Post by scottgus1 »

CpServiceSpb wrote:I want to store VMs list not to user home folder but to 3rd indeprendent folder.
Having a common folder for all host PC users is possible. It involves the VBOX_USER_HOME environment variable, see the Virtualbox manual, "Global Configuration Data" (in 6.0.14's manual, section 10.1.3) Then there would be no special 'su'-driven commands; standard commands will work.
CpServiceSpb
Posts: 5
Joined: 21. Nov 2019, 23:55

Re: Starting a VM with "su -c vboxuser" causes error

Post by CpServiceSpb »

Yes,
VBoxManage startvm u1404x64 --type headless
gives positive result.
But .............

There are processes:
vboxuser  2645  0.0  0.1  181768   6384 ?  S    01:12   0:00 /usr/lib/virtualbox/VBoxXPCOMIPCD
vboxuser  2651  0.0  0.3  819032  13060 ?  Sl   01:12   0:09 /usr/lib/virtualbox/VBoxSVC --auto-shutdown
root     16117  0.0  0.3  255500  14008 ?  S    23:51   0:00 /usr/lib/virtualbox/VBoxXPCOMIPCD
root     16123  0.3  0.4  761692  18692 ?  Sl   23:51   0:00 /usr/lib/virtualbox/VBoxSVC --auto-shutdown
root     16141 31.3  4.6 2161408 187228 ?  Sl   23:51   0:10 /usr/lib/virtualbox/VBoxHeadless --comment u1404x64 --startvm uuid --vrde config
As we can together see there are some virtual box processes launched from root including immediately working virtual machine.
  1. But I want that all would be done from non root user.
    As following, folder /.config/VirtualBox with all its content is located at /root folder
  2. I want to locate such folder with its content at other location, even not under vbox user folder.
    Regarding VBOX_USER_HOME, what are diffirencies beetwen VBOX_USER_HOME and VBOX_HOME ?
    And phpVirtualBox doesn' t see VMs list.
  3. I need phpVirtualBox working.
So can you help me to reach 1st, 2nd and 3rd points ?

P.S.: As I remember virtualbox 5.2. worked on Ubuntu 14.04 under vbox user fine as well with phpVirtualBox.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Starting a VM with "su -c vboxuser" causes error

Post by socratis »

You see? That's exactly the problem... You start by NOT telling us your whole setup, by NOT divulging all the information, by NOT stating what your end goal is. We have to extract it slowly bit-by-bit.

phpVirtualBox is a program that relies on VirtualBox, but modifies its configuration files in unknown ways to us, and with unknown consequences. They have their own phpVirtualBox support channels. If you are having this problem with a standalone version of VirtualBox (after a complete uninstallation of phpVirtualBox), then we can continue this discussion.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
CpServiceSpb
Posts: 5
Joined: 21. Nov 2019, 23:55

Re: Starting a VM with "su -c vboxuser" causes error

Post by CpServiceSpb »

As I mentioned above the main trouble as I consider as a trouble it is launching virtualbox under root and at the time my impossibility to run it under vbox user !
I pointed it as point 1. :)

And a smaller one is to store all configuration folder/files as virtual machines at other 3rd path folder from users home folders to much easier to back up it.
I pointed it as point 2. :)

Regarding phpVirtualBox, ok, the question is closed.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Starting a VM with "su -c vboxuser" causes error

Post by socratis »

CpServiceSpb wrote:As I mentioned above the main trouble as I consider as a trouble it is launching VirtualBox under root
Why would you want to run it as 'root'? Just login as 'vboxuser' and run it as 'vboxuser'. Which you did, successfully.
CpServiceSpb wrote:And a smaller one is to store all configuration folder/files as virtual machines at other 3rd path folder from users home folders to much easier to back up it.
The VMs and the configuration data, are "per user". So, if you simply login as 'vboxuser', and you create (and register) your VMs as 'vboxuser', then all the data and the configuration will be stored under the 'vboxuser' account; the data (VMs) in '/home/vboxuser/VirtualBox VMs', and the configuration in '/home/vboxuser/.config/VirtualBox'. So, that's as clean as it gets.

If on the other hand you login as 'root', and then try to 'su -c vboxuser' then you're going the wrong way. Leave the 'root' out of the equation. If you do not involve the 'root' user, everything gets simplified. Not sure why you want to complicate things unnecessarily with other roles, environmental variables, etc.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply