VMware Communities
cgiard
Contributor
Contributor

headless / disconnected

I've read a few posts that Fusion supports running "headless" if the GUI application crashes or is killed while the VM is running. Since the VM is actually a separate process, is it possible to start the VM w/o the GUI using the command line? If so, this could be the answer for people that want to run headless server VMs.

Also, if a VM is running headless, will it respond to a SIGTERM and gracefully shutdown the guest OS?

0 Kudos
13 Replies
admin
Immortal
Immortal

If so, this could be the answer for people that want to run headless server VMs.

I don't think it'll work across user logout or as the non-current user (though I haven't tried), so in this respect it won't be a good headless server.

0 Kudos
admin
Immortal
Immortal

It seems like it would be easy to work around. Just have a vmware user with correct permissions and run a daemon as that user that handles spinning of VM processes as that user. Make a simple interface for commanding start, pause, resume, stop, restart, etc. No different than sshd really. Actually, launchd may be able to do it without another daemon, though I've not messed with launchd enough to know.

0 Kudos
rcardona2k
Immortal
Immortal

Headless VMs are a feature of Workstation 6, although I think the user has to stay logged in. You can run headless VMs in Fusion with fast-user switching (without logging off the user). But running headless involves killing the Console 'head' ungracefully.

I think if you log off in any case OS X kills off your processes so you'll want to change the process ownership or run Fusion as a different user such as root. IMO, running anything as root for instance would be bad.

BTW, here's a thread on how to run "headless:"

http://www.vmware.com/community/thread.jspa?messageID=538524

0 Kudos
bgertzfield
Commander
Commander

I've read a few posts that Fusion supports running

"headless" if the GUI application crashes or is

killed while the VM is running. Since the VM is

actually a separate process, is it possible to start

the VM w/o the GUI using the command line? If so,

this could be the answer for people that want to run

headless server VMs.

This is unsupported, but like on our other platforms, you should be able to do the following:

1) Edit your .vmx file, and add:

msg.autoAnswer = TRUE

2) From Terminal, run:

nohup "/Library/Application Support/VMware Fusion/vmware-vmx" "/path/to/vm/foo.vmx"

Let us know if this works for you.

Also, if a VM is running headless, will it respond to

a SIGTERM and gracefully shutdown the guest OS?

I'm not sure if this is present currently -- if it works on Linux, it might work on Mac OS. Sounds like a decent feature to add, though.

0 Kudos
admin
Immortal
Immortal

Also, if a VM is running headless, will it respond

to

a SIGTERM and gracefully shutdown the guest OS?

I'm not sure if this is present currently -- if it

works on Linux, it might work on Mac OS. Sounds like

a decent feature to add, though.

It would be nice if the SIGTERM does a suspend on the guest. Combined with a mechanism to start them at boot, this would make a nice set of dedicated headless machines on your local machine. On shutdown of the host all the guests would suspend, and then on boo of the host all guests would resume.

0 Kudos
Pat_Lee
Virtuoso
Virtuoso

Since "Fusion" is a consumer focused product, these requests may not make the Fusion product. These features requests are more for hosted server products or technical developer products that we will keep in mind as we plan our future roadmap.

Thanks,

Pat Lee

Senior Product Manager - Mac Products

VMware

0 Kudos
cgiard
Contributor
Contributor

Ben,

Thanks for the suggestion. Unfortunately, vmware-vmx dies instantly from (apparently) a SIGINT. I'm guessing it is looking for some environment variables or open file handles. Smiley Sad

0 Kudos
cgiard
Contributor
Contributor

Pat,

Thanks for the response. Hopefully the future roadmap will include server and workstation products, as that would basically give VMware the broadest virtualization platform out there (and would also be very useful to me personally). Smiley Happy

0 Kudos
bgertzfield
Commander
Commander

Hi cgiard,

Looks like you're in luck. There are two undocumented config variables:

signal.suspendOnHUP = "TRUE"

and

signal.powerOffOnTERM = "TRUE"

that you can add to your individual .vmx files, or your ~/Library/Preferences/VMware Fusion/config file, that will let your VMs suspend on SIGHUP, and gracefully power-off on SIGTERM, respectively.

Good luck!

0 Kudos
cj0
Contributor
Contributor

Is there possibly also some other undocumented variable that prevents VMware fusion from blocking logout and reboots?

With:

msg.autoAnswer = “TRUE“ signal.suspendOnHUP = “TRUE“ signal.powerOffOnTERM = “TRUE“

in the .vmx file, fusion still blocks logout and reboots:

"Are you sure you want to suspend the virtual machine and exit?"

"Suspending will preserve your invironment and data for later use."

Yes please, do suspend, but how to autoAnswer this message with "Suspend"?

(and prevent the os from saying: "The application VMware Fusion cancelled logout..."

0 Kudos
admin
Immortal
Immortal

Do you have "VMware Fusion > Preferences > Confirm before closing" selected? If so I'm not sure if autoanswer is supposed to ignore that prompt or if it's a bug or if you're seeing something else, but disabling it may work around the problem.

0 Kudos
cj0
Contributor
Contributor

Yes, "VMware Fusion > Preferences > Confirm before closing" was selected.

0 Kudos
cj0
Contributor
Contributor

After deselecting "VMware Fusion > Preferences > Confirm before closing", the "suspend" message doesn't popup.

However OSX still popups: "The application VMware Fusion canceled logout. To try again, ...".

Sometimes VMware Fusion.app was quit, other times the app itself is even open, showing "Virtual Machine Library".

0 Kudos