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

Discussions related to using VirtualBox on Linux hosts.
Post Reply
Esbeeb
Posts: 7
Joined: 14. Aug 2019, 07:47

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

Post 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?
Last edited by Esbeeb on 17. Aug 2019, 12:23, edited 1 time in total.
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: How to start a VM "headless" upon boot time in MX Linux?

Post by socratis »

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.
Esbeeb
Posts: 7
Joined: 14. Aug 2019, 07:47

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

Post 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
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: [Solved] How to start a VM "headless" upon boot time in MX Linux?

Post 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]... ;)
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