_Royce_
Enthusiast
Enthusiast

How is Autostart supposed to work for NT4 guest?

Jump to solution

NT4 has no ACPI support therefore clean shutdown isn't possible so enabling Autostart (after setting up Shared VM) will always result in VM not shutting down cleanly. This just doesn't work but there's no mention of it anywhere in the documentation.

Why not provide the ability to select suspend instead of shutdown? That's an easy fix to this problem for NT.

1 Solution

Accepted Solutions
_Royce_
Enthusiast
Enthusiast

For anyone interested, this is now working. Smiley Happy

The solution comprised the following:

  • http://blogs.technet.com/b/jhoward/archive/2005/06/09/405926.aspx do this to get ACPI support enabled (thanks to Bernd Nowak‌ for that suggestion)
    This has an issue in that the VMware host process will have high cpu once you switch to the softex hal.dll. The better approach that doesn't have the CPU issue can be found here: How to poweroff a VM with Windows NT 4
  • A custom shutdown script configured in the guest's VMtools (thanks to wila‌ for suggesting to use scripts). The script needs to call the shutdown.exe downloaded from here: Beyond Logic Shutdown for NT/2000/XP) the "-s poweroff" will both shutdown and poweroff the NT VM (after enabling ACPI support).
  • Implement the autostart/stop solution found here: Autostart VMware Virtual Machines at Boot in Linux | Tommy Butler - I didn't use the Autostart feature of shared VMs as that didn't implement an autostop. Tommy Butler's solution took care of both start and stop. (NOTE: there appears to be a slight issue with autostop not functioning if the main workstation window is open when the host restarts/shutsdown - this is considered to be a minor issue and will most likely be resolved with a logoff script if required).
  • There was an issue with inoperable guest NICs for autostarted VMs. A workaround was found and listed here: Inoperable network for Autostarted Shared VMs - Workstation Pro 12

Thanks again to all those who contributed. I am extremely happy with this outcome. :smileylaugh:

View solution in original post

0 Kudos
14 Replies
wila
Leadership
Leadership

Hello,

You can have Workstation run scripts in the guest on events like shutdown and suspend.

Perhaps you can initiate a guest Shutdown from within the guest?

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
_Royce_
Enthusiast
Enthusiast

I thought about that. I was hoping to be able to shutdown the database first and then shutdown the NT server using the shutdown command, but then how do you tell workstation to power off the VM? In other words, how do I get the VM to power off but trigger it from within? There'd also need to be a 10 second or so delay after the shutdown command is issued and before the VM gets powered off.

0 Kudos
wila
Leadership
Leadership

Hi,

When talking databases and a legacy system like that, I'd say that suspend wasn't a really good option on this anyways.

As for how-to have VMware shut down the VM. If the shutdown script is being used then I would think that Workstation would shut down the VM eventually.

It's a pity I haven't got a NT4 VM down here to test with, but that would be my first try.

I guess you could use some sort of sleep command to delay execution of the script for a bit?

I know it is not in NT4 by itself, but I think later versions of Windows have that (at least I have here)

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
_Royce_
Enthusiast
Enthusiast

True that suspend isn't ideal, but i only envisage this occurring during shutdown from UPS low battery condition, which should be quite a rare occurrence. In that situation, i would expect all clients to have disconnected from the DB as they would have already powered off. In other situations where I need to restart the host server for whatever reason (it's linux so that shoud also be quite rare), I could manually shutdown the VM first.

Now the issue with NT4 and Workstation is that the VM Shutdown function doesn't work. It triggers the shutdown correctly, but then goes into a permanent wait state where its expecting the VM to power off and that will never happen because NT4 doesn't support ACPI power functions. You have to kill the VM process to get out of it (there was another post on this forum about that).

So if Workstation handles the shutdown script by calling the script first and then calling it's internal shutdown handling, that won't work either because it will get stuck waiting for the OS to power itself off and that will never happen. That's why I thought if it were possible to somehow trigger the power off from within the VM, that would solve my problems. I can't really think of a clean solution to this yet. Other than some kind of poling script running on the host watching for some trigger inside the VM and powering off the VM when it gets it.

I've tried lots of posts I found about adding ACPI support to NT4 by using HALs found in recent service packs and making registry updates but none of them worked.

0 Kudos
wila
Leadership
Leadership

Hmm.. I think you're not understanding what I'm saying.

If VMware Tools is installed then it has a feature where it can run scripts when a particular event happens.

There even used to be an option in the GUI to enable/disable this feature, but seems that has been removed in VMware Workstation 12. I do however expect that it still works, on a Windows 7 VM here you can find the scripts in: c:\program files\VMware\VMware Tools\

and you would be looking for a file called power-off-vm-default.bat

Which you can customize to your needs.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
_Royce_
Enthusiast
Enthusiast

I understand exactly what you're saying, but i suspect that you don't understand what I'm saying because perhaps you're not familiar with the limitations of NT4. The script mechanism of VMWare Tools will be subject to the same limitation of the Workstation UI in that a shutdown command results in the UI/VM hanging because the NT4 VM will never self power off.

Therefore the way I see it, the only way to make the scripting useful would be if the script could power off the VM (after it shutdown the database and the NT server and waited say 10 seconds for the NT server to reach the idiotic "it is now safe to power off" screen).

Background on the shutdown issue with NT4 - still persisting in Workstation 12.

Re: NT4 shutdown UI problem still present

ps. Script options are in the GUI - right click the VMware tools icon inside the guest to manage them.

0 Kudos
wila
Leadership
Leadership

Hi,


Good to hear you got it.

re. right click on the VMware Tools .. you must have an old version (or specific for NT4), or you customized your vmware tools as the right click option on the VMware icon in the guest hasn't given more as "About VMware Tools" for years now.

Nevertheless all those options are available through the command line.


As for NT4, I admit my recollection on it is a bit fuzzy, I've worked several years with NT4 and even liked it (what else can you do after using NT3.51 Smiley Happy ).

You mentioning the "it is now safe to turn off" screen does bring back some memories.

I'm surprised my host here has no NT4 VM, I must have at least one somewhere, but not when I just searched for it on my Workstation 12 host.

Technically you could issue a power off from within the guest via a vix call  (or vmrun) but that's not something I'd recommend as it would mean giving a very old insecure guest direct access to your virtualisation layer and host.

--
Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
Bernd_Nowak
Hot Shot
Hot Shot

Doesn't the tip from the Microsoft blog not help?

Virtual NT4 Guest Server auto power off after shutdown under Virtual Server

_Royce_
Enthusiast
Enthusiast

Interestingly enough, that actually does work to a degree. I had tried that procedure before, but for some stupid reason I used the hal from SP6 and not SP4 and it makes a difference.

Now with the SP4 hal.dll, the VM automatically powers off, but here's the kicker - it only works when you do a shutdown from the Start Menu (inside the VM).

When you do a shutdown from the VM menu (VM -> Power -> Shut Down Guest), it behaves as it did before.

Similarly if you do a soft shutdown from vmrun, it still sits there with the 'It's now safe to shutdown' message.

I also tried calling shutdown from a shutdown script and configuring that script as the "Shut Down Guest Operating System" but the result was the same - the VM doesn't power off. I guess the registry setting and associated hal.dll mentioned in the blog only work when Shutdown is initiated via the start menu.

Any other shutdowns don't appear to power off the guest.

0 Kudos
_Royce_
Enthusiast
Enthusiast

Found this: http://retired.beyondlogic.org/solutions/shutdown/shutdown.htm

Using the shutdown.exe utility and this command line:

shutdown -s poweroff -m "Shutting Down..." -l 2 -c

Called from a shutdown script configured via VMTools... the server now shuts down and powers off when called from the VMWare "Shut Down Guest" Power menu option.

Now the only problem left is why the NIC doesn't initialise properly when the VM is autostarted.

Inoperable network for Autostarted Shared VMs - Workstation Pro 12

If I can get this to work it will be a miracle! Smiley Happy

0 Kudos
_Royce_
Enthusiast
Enthusiast

In addition to the issue with the inoperable NIC on startup, I also discovered that Autostart VMs don't appear to get cleanly shutdown when the Host OS restarts. Have I misunderstood the purpose of Autostart? I would have assumed that Autostarted VMs would be cleanly shutdown.

I did a quick google search and it looks like the answer is that Autostarted VMs don't automatically shutdown. Smiley Sad

0 Kudos
_Royce_
Enthusiast
Enthusiast

For anyone interested, this is now working. Smiley Happy

The solution comprised the following:

  • http://blogs.technet.com/b/jhoward/archive/2005/06/09/405926.aspx do this to get ACPI support enabled (thanks to Bernd Nowak‌ for that suggestion)
    This has an issue in that the VMware host process will have high cpu once you switch to the softex hal.dll. The better approach that doesn't have the CPU issue can be found here: How to poweroff a VM with Windows NT 4
  • A custom shutdown script configured in the guest's VMtools (thanks to wila‌ for suggesting to use scripts). The script needs to call the shutdown.exe downloaded from here: Beyond Logic Shutdown for NT/2000/XP) the "-s poweroff" will both shutdown and poweroff the NT VM (after enabling ACPI support).
  • Implement the autostart/stop solution found here: Autostart VMware Virtual Machines at Boot in Linux | Tommy Butler - I didn't use the Autostart feature of shared VMs as that didn't implement an autostop. Tommy Butler's solution took care of both start and stop. (NOTE: there appears to be a slight issue with autostop not functioning if the main workstation window is open when the host restarts/shutsdown - this is considered to be a minor issue and will most likely be resolved with a logoff script if required).
  • There was an issue with inoperable guest NICs for autostarted VMs. A workaround was found and listed here: Inoperable network for Autostarted Shared VMs - Workstation Pro 12

Thanks again to all those who contributed. I am extremely happy with this outcome. :smileylaugh:

View solution in original post

0 Kudos
wila
Leadership
Leadership

Hi,

That should be how it works yes, a shared VM with autostart enabled should shut down cleanly.

I've not tried this myself but did see a similar complaint earlier this week on the forum.

If you have support on this then I suggest to open a ticket.

https://my.vmware.com/group/vmware/get-help

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
wila
Leadership
Leadership

Glad to hear you got it all sorted out and thanks for providing an answer to all the questions you had during the implementation of this.

Can you please mark your solutions with "Correct Answer" so that people having a similar issue will find the answer easier?

Thanks!

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos