Page 1 of 1

[Solved] How to start a VM "headless" upon boot time in MX Linux?

PostPosted: 17. Aug 2019, 10:10
by Esbeeb
Hello,
I'm using Virtualbox 6.0.10 on MX Linux 18.1.

I've created a Windows 10 Home VM, and it works well. Let's say it's name within Virtualbox is "Win10VM". Furthermore, I can connect to it using Remmina, using Virtualbox's built-in RDP capabilities. In that VM, I have Settings -> Display -> Remote Display -> "Enable Server" checked, as well as "Extended Features: Allow Multiple Connections".

I would like for Remmina/RDP to be the primary way that this VM gets connected to, by the various Linux users who might physically sit down in front of, and log into this Linux host system. I would like this Windows 10 Home VM to start headlessly at boot time, Virtualbox not running as the root user (say, as a normal, non-root user called "vmuser", who is not a human user, but exists just for running this VM). Then Virtualbox's RDP server will hopefully listen for those Remmina RDP conections.

Can anyone suggest what I can put into /etc/rc.local, before the "exit 0" line at the end?

Something like:
/bin/su -c "/usr/bin/VirtualBoxVM --headless --startvm 'Win10VM' " - vmuser &

Any suggestions?

Re: How to start a VM "headless" upon boot time in MX Linux?

PostPosted: 17. Aug 2019, 10:26
by socratis

Re: How to start a VM "headless" upon boot time in MX Linux?

PostPosted: 17. Aug 2019, 12:20
by Esbeeb
Yes, I read that documentation, but I think you would need an IQ of about 200 to go on that alone.

I found a recent great tutorial, spelling it out, step-by-step here:
https://kifarunix.com/autostart-virtual ... -on-linux/

I did everything he said, save a few differences here:

1) After adding the non-root user "vmuser" to the group "vboxusers" (as in "sudo usermod -aG vboxusers vmuser"), logging out and logging back in as the vmuser was needed to see the vmuser be a part of the "vboxusers" group, as listed in the "groups" command.

2) I had to use a default allow policy, not a default deny policy, in /etc/vbox/autostartvm.cfg. His example wouldn't work, where you use default deny, but then allow your one user (in my case, "vmuser").

3) In MX Linux 18.1, after having installed VirtualBox 6.0 as per the official VirtualBox documentation (creating a new apt software source under /etc/apt/sources.list.d/, importing the signatures, etc), as opposed to installing VirtualBox 6 from the MX Linux Testing Repo, there is no systemd service called vboxautostart-service.

So I had to set up manual starting the vboxautostart command at boot time, by adding the following line to the end of /etc/rc.local, just before the last line "exit 0":

su -c "/usr/bin/vboxautostart -v --start --background --config /etc/vbox/autostartvm.cfg --logfile /home/vmuser/vboxautostart.log" - vmuser

Re: [Solved] How to start a VM "headless" upon boot time in MX Linux?

PostPosted: 18. Aug 2019, 04:28
by socratis
Thank you for the feedback and the solution, hope someone finds it useful in the future. And thank you for marking the topic as [Solved]... ;)