5

In Arch Linux, I would like to run VirtualBox without a window manager.

As a root I can easily do:

xinit /usr/bin/VirtualBox  -- :0 vt1

As a non-root user I get a blank screen. If I open another terminal, kill VirtualBox and read

~/.local/share/xorg/Xorg.0.log  ,

then it does not show any error and is basically the same as the "/var/log/Xorg.0.log" I get as a root.

UPDATE

As noted by Arkadiusz Drabczyk, the problem was with a bug in VB. It works with version 5.2.4-119785.
My final objective is to use VB kind of bare-metal, starting an OS in fullscreen and nothing else, that is:

xinit '/usr/bin/VirtualBox' --startvm "VM name" --fullscreen -- :0 vt1
antonio
  • 1,381
  • 3
  • 16
  • 37
  • 2
    if you don't need the GUI at all, `VBoxHeadless --startvm vmName` should do the trick. (... come to think of it, a `--startvm WhatVMDoYouWantToStart` argument is probably the missing ingredient.) – quixotic Dec 11 '17 at 16:02
  • 2
    @quixotic: of course this is for simplicity. Actual command should be something like: `xinit /usr/bin/VirtualBox --startvm "vm name" --fullscreen -- :0 vt1` – antonio Dec 11 '17 at 18:15

2 Answers2

3

I found several options.

  1. VBoxManage

    VBoxManage startvm "VM name" --type headless
    
  2. VBoxHeadless

    VBoxHeadless --startvm <uuid|name>
    

And bear in mind xinit ..., as you already know.

See also:

https://superuser.com/questions/135498/run-virtualbox-in-background-without-a-window

https://superuser.com/questions/1153939/start-a-vm-in-virtualbox-without-gui

https://forums.virtualbox.org/viewtopic.php?f=1&t=66058

3

I remember I was able to reproduce your problem with not being able to run Virtualbox as non-root user without window manager with older versions of Virtualbox but it works for me with 5.2.4-119785.

However, as stated in the comments you don't need to graphical interface at all. Virtualbox comes with command line interface, it's my preferred method of interacting with it. Say, to list virtual machines:

$ vboxmanage list vms
"ubuntu" {e7fe8912-5484-4b9d-b5fe-431ae648b2dd}
"slackware64-current" {a00e1925-9cb6-4330-8b04-bbce69b49c67}
"slackware-current" {636b85f2-1e02-497b-9c50-22eb285250a3}
"freebsd" {acb77ca6-b051-400a-92bb-b3b2f1905991}
"openindiana" {bdca01dd-ea5d-4323-9fd2-92665d311bda}
"slackware64-14.1" {f9db3ba6-2316-4f92-8264-4abc8e4f71b3}
"slackware-14.2" {ccb5ddba-4ea1-4469-8ebc-21c84b8ca825}
"slackware-14.1-pathes-test" {67bec56d-b7d5-4427-a726-de2b4c1ba700}
"Slackware_new_test" {2e9232b5-bab1-41fc-8db4-ff4aab56f94c}
"slackware64-14.2" {2084cd19-d286-48b5-8e7b-3d1bb7a94d93}
"alpine linux" {be56c6a7-5821-4815-984b-6b40a6367acb}
"openwrt_Chaos_Calmer" {a4fcb438-dfc7-4672-8976-0d21b34357e0}
"linux-mint" {6e5e99d8-2dd8-4798-93ac-ffbf14c6c9db}

To start a virtual machine:

$ vboxmanage startvm "slackware64-14.1" --type headless

You can then access a started virtual machine with ssh, telnet etc.

To remove a virtual machine:

$ vboxmanage unregistervm "slackware64-14.1" -delete

To show info on a given virtual machine:

$ vboxmanage showvminfo slackware64-14.1

To stop a virtual machine:

$ vboxmanage controlvm slackware64-14.1 poweroff

You can even create a new virtual machine in command line: https://gist.github.com/ardrabczyk/65b68d0121f2964cd99e

Arkadiusz Drabczyk
  • 25,049
  • 5
  • 53
  • 68
  • Thank you, but I actually wrote without a Window Manager, not without a window/GUI – antonio Dec 22 '17 at 11:40
  • I know, I said that I was able to reproduce your problem on my system. Try upgrading `virtualbox` if possible. – Arkadiusz Drabczyk Dec 22 '17 at 11:41
  • Sorry, read too fast. After `pacman -Syu` I can run `xinit /usr/bin/VirtualBox -- :0 vt1`, but I am unable to pass parameters to VirtualBox. I would run a VM with: ` xinit /usr/bin/VirtualBox --startvm "VM name" --fullscreen -- :0 vt1 `, but I get only the VirtualBox main app. – antonio Dec 22 '17 at 13:05
  • I'm confused. You asked about `xinit /usr/bin/VirtualBox -- :0 vt1` in your question. Does `virtualbox` now show up? – Arkadiusz Drabczyk Dec 22 '17 at 13:08
  • Yes, _it works_ thanks to your suggestion to upgrade. Now I would like to run a VM, not only the VirtualBox main app. For this I need to pass some parameters to VirtualBox (or use VBoxManage). It works putting `/usr/bin/VirtualBox --startvm "VM name" --fullscreen` in `.xinitrc`. I was wondering if I can pass VB parameters straight from xinit. – antonio Dec 22 '17 at 13:21
  • How about `xinit '/usr/bin/VirtualBox --startvm "VM name" --fullscreen' -- :0 vt1`? I didn't try that. – Arkadiusz Drabczyk Dec 22 '17 at 13:26
  • xinit says "No such a file or directory." It considers all material inside the single quotes as a path. `xinit /usr/bin/VirtualBox '--startvm "VM name" --fullscreen' -- :0 vt1` does not work either (it opens VB window only) – antonio Dec 22 '17 at 13:34
  • This works for me: `xinit '/usr/bin/VirtualBox' --startvm "VM name" --fullscreen -- :0 vt1` – Arkadiusz Drabczyk Dec 22 '17 at 13:51