Run headless VBox

Discussions related to using VirtualBox on Linux hosts.
Post Reply
andrkac
Posts: 2
Joined: 31. Dec 2021, 16:38

Run headless VBox

Post by andrkac »

I have very basic issue I hope.
Trying to run headless VBox (the latest, 6.1) on Centos 7.9. with access through phpvirtualbox
Seems to be running:

Code: Select all

[root@myserver ~]# ps -ef | grep vbox
vboxuser  1779     1  0 12:08 ?        00:00:00 /usr/lib/virtualbox/vboxwebsrv --background -H 192.168.1.5 -p 18083
vboxuser  1807     1  0 12:08 ?        00:00:00 /usr/lib/virtualbox/VBoxXPCOMIPCD
vboxuser  1848     1  0 12:08 ?        00:00:01 /usr/lib/virtualbox/VBoxSVC --auto-shutdown
root      3138  2397  0 15:40 pts/0    00:00:00 grep --color=auto vbox
[root@myserver ~]# systemctl status vboxdrv
● vboxdrv.service - VirtualBox Linux kernel module
   Loaded: loaded (/usr/lib/virtualbox/vboxdrv.sh; enabled; vendor preset: disabled)
   Active: active (exited) since 2021-12-31 12:07:51 CET; 3h 32min ago
  Process: 862 ExecStart=/usr/lib/virtualbox/vboxdrv.sh start (code=exited, status=0/SUCCESS)

gru 31 12:07:49 myserver systemd[1]: Starting VirtualBox Linux kernel module...
gru 31 12:07:50 myserver vboxdrv.sh[862]: vboxdrv.sh: Starting VirtualBox services.
gru 31 12:07:51 myserver vboxdrv.sh[1102]: VirtualBox services started.
gru 31 12:07:51 myserver systemd[1]: Started VirtualBox Linux kernel module.
[root@myserver ~]# systemctl status vboxweb-service
● vboxweb-service.service
   Loaded: loaded (/usr/lib/virtualbox/vboxweb-service.sh; enabled; vendor preset: disabled)
   Active: active (exited) since 2021-12-31 12:08:02 CET; 3h 32min ago
  Process: 1407 ExecStart=/usr/lib/virtualbox/vboxweb-service.sh start (code=exited, status=0/SUCCESS)

gru 31 12:08:01 myserver systemd[1]: Starting vboxweb-service.service...
gru 31 12:08:01 myserver vboxweb-service.sh[1407]: vboxweb-service.sh: Starting VirtualBox web service.
gru 31 12:08:01 myserver vboxweb-service.sh[1418]: Starting VirtualBox web service.
gru 31 12:08:01 myserver su[1451]: (to vboxuser) root on none
gru 31 12:08:02 myserver vboxweb-service.sh[1898]: VirtualBox web service started.
gru 31 12:08:02 myserver systemd[1]: Started vboxweb-service.service.
Internal address (192.168.1.5 -p 18083) is defined in /etc/default/virtualbox, same as user.
Unfortunately - nothing is listening to on port 18083 (nmap from this and other machine), phpvirtualbox cannot connect (cannot authorize user)

It doesn't depend on firewall and selinux - doesn't matter if I turn them off or not.
Should nmap show VBox port available at all? maybe I doing wrong something else?

----------------------------
Just after writing the above, I've checked more:
Downloaded Remotebox 2.7, which can connect from my (linux mint) desktop to the server. I've created one VM, it is running and I can see its display on my desktop. VM is running on 3389 port and nmap shows it

Code: Select all

3389/tcp open  ms-wbt-server
Looks much better, but:

phpvirtualbox still doesn't work, port 18083 still free.
and...

Code: Select all

VBoxManage list vms
shows NOTHING, when I'm looking on my virtual machine remote desktop - and this is something I completely do not understand.
No, I don't have any VBox servers in my network and I don't have such vm locally.

Why

Code: Select all

VBoxManage list vms
doesn't show running vm?
How to let phpvirtualbox to connect to VBox (both are on the same server)?
_
andrkac
Posts: 2
Joined: 31. Dec 2021, 16:38

Re: Run headless VBox

Post by andrkac »

something to add...

Code: Select all

VBoxManage registervms file.vbox
registers vm correctly, but then - I need to also unregister vm manually when removed
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Run headless VBox

Post by scottgus1 »

phpvirtualbox is a 3rd-party program, which we don't support on these forums. You'll have to ask them about the port question.

If you're trying to get phpvirtualbox to access a host Virtualbox service, that would be between the host OS and phpvirtualbox. The host OS's firewall and ports need to be set up per the host OS's help channels.

If you're trying to get phpvirtualbox to access a VM service, then in addition to the VM OS's firewall, the Virtualbox network must be the correct type. Bridged is best, since the VM is in the LAN as a separate PC. NAT & NAT Network act like 'routers' between the host and the VM, so a port must be forwarded.

Please define your setup more clearly and exactly what you're attempting to do.
Post Reply