VMware Communities
caciola
Contributor
Contributor

Startup on linux server boot

Hello everyone, how do I boot virtual machines when booting the server running the Debian 12 OS with VMware Workstation 17 Pro? (VMs are Debian 12 too).

Labels (1)
Tags (1)
Reply
0 Kudos
9 Replies
louyo
Virtuoso
Virtuoso

You could probably create a small shell script, using vmrun to start the VM's you want. 

Then, create a cron job:

sudo crontab -e

And add

@reboot <name of your shell script with path> &

I use this to run a AV scan on Debian 12, I would think it should work for vmrun.  

caciola
Contributor
Contributor

I appreciate your guidance, but what would a shell script with path look like? Could you give me an example?

Reply
0 Kudos
louyo
Virtuoso
Virtuoso

Ok, so I have a vm named debianb in /vmware2.
I test starting that VM via the command line with:
vmrun start /vmware2/debianB/DebianB.vmx
it starts OK. That is what I need in my script.

So, I create a script in my home directory:
(I use nano, use any text editor):
nano startvms.sh
line1 =#!/bin/bash
line2 = vmrun start /vmware2/debianB/DebianB.vmx
more lines if you want to run more VM's
Control-o to save the script
Control x to exit Nano.
make it executable:
chmod +x startvms.sh

sudo crontab -e
@Reboot~/startvms.sh &

I didn't test that but it is the same that I use to run clamscan

run vmrun --help to see a laundry list of options and commands with examples.

 

Some days the dragon wins. 

caciola
Contributor
Contributor

I had problems with crontab, it didn't work, I run Debian 12, so I activated rc.local and entered the commands to raise my vms, as per your instructions, and everything worked perfectly.
I appreciate your help.

Reply
0 Kudos
louyo
Virtuoso
Virtuoso

glad to hear it. 

caciola
Contributor
Contributor

My current problem is that I am forced to use the "nogui" command to raise the vms, I would really like this not to be necessary, because with the "nogui" command I cannot view the vms, they are all 100% in the background.

 

Reply
0 Kudos
louyo
Virtuoso
Virtuoso

I guess I don't understand what you want to do. If you want to start the VM's prior to login, you won't have GUI, there is no X engine running. I have seen hacks but have no idea if any would work. This is true for any program. If you need the GUI, run the script from startup programs for each user. Or just put a launcher on the panel and give it a click.

This is really a Linux question.

 

Lou

Reply
0 Kudos
caciola
Contributor
Contributor

This is the problem, at boot time there is no X environment raised, and as it is a server there will never be anyone directly using this machine, so the VMs are launched without a gui even using the "nogui" parameter.

Reply
0 Kudos
louyo
Virtuoso
Virtuoso

Well, you could remote into them. Because of all that, our servers are running on ESXi, you can use Player as a Console. For our surveillance systems, I use tightvnc over a VPN connection. 

 

Lou

Reply
0 Kudos