Page 2 of 2

Re: headless-Server doesn't shutdown :-(

Posted: 5. Aug 2009, 16:37
by virtualpier
I've found a nice solution imho :P

Winexe (http://eol.ovh.org/winexe/) works like the "old" Sysinternals PSTools for Windows...
It's very easy to install it following the istruction on the site.

Well, with winexe, you can send ANY command you want to a windows host (with proper credentials of course), something like a remote cmd.exe (or a netcat shell :P)

So, my first command was a "cmd /C dir c:\", to test the connection..perfect.
Then i issued the first shutdown command ('shutdown -s -t 00'), without success ("computer is locked...")
I've tried to force shutdown with the command 'shutdown -s -f -t 00' and... problem solved 8)

So, we can still use acpipowerbutton command :)

What do you think?

Re: headless-Server doesn't shutdown :-(

Posted: 5. Aug 2009, 17:15
by Perryg
Reading through here I see the common denominator to be the screen saver.
We all know these things cause problems on a VM. Have you tried to eliminate this by turning off the screen savers on the VM?
If they are running a headless server I see no purpose for them or power savers either. IMHO

Re: headless-Server doesn't shutdown :-(

Posted: 5. Aug 2009, 18:54
by virtualpier
Hi Perryg, in my opinion, the real problem is not the screensaver himself but the LOCKED user session.
acpipowerbutton signal seems to be ignored when a user session is LOCKED (eg. screensaver + password).
The only way i found to resolve this issue is to send, with winexe, a shutdown -s -f command, to force shutdown and it works.

Well, we've taught to screesaver + password (altough in headless mode) to avoid that, if some admin forget an open session, another "user" which found our credentials in some way, can log into a VM so easily :P

Re: headless-Server doesn't shutdown :-(

Posted: 5. Aug 2009, 19:42
by Sasquatch
Virtualpier, from where are you running that command? If it's from a Windows machine, you can use the shutdown command to remotely shut down a system too.

Code: Select all

shutdown -m \\computername -f -s -t 3
That will shut down the computer with 'computername', force it even if a user is logged on and do it after 3 seconds.

Re: headless-Server doesn't shutdown :-(

Posted: 5. Aug 2009, 19:53
by vbox4me2
That will only work when the local user is authenticated to the server you are shutting down, and the user has shutdown rights, some time ago I wrote about that, as you don't want a cmd file on the Host holding the username and password readable. I use a seperate user with only shutdown rights for this, net use the default printer, send the shutdown, net use /delete. (why? because you are going to use this for example with ups unattended use)

Re: headless-Server doesn't shutdown :-(

Posted: 5. Aug 2009, 20:30
by virtualpier
@sasquatch:

Our VirtualBox is installed on a linux box which runs n VMs (both Windows and Linux).
Windows VMs are configured to start screensaver after 1 min of inactivities and to ask for password (Locked workstation).

When the Windows VM is Locked (user logged in - ask for password - or rundll32.exe user32.dll, LockWorkStation if you prefer), the host command
VBoxManage controlvm VM_name acpipowerbutton (think to a bash script to stop a VM for example) seems to be ignored (windows is unable to shutdown a Locked Workstation).
If the user is logged off, there is no problem.

To solve this problem i am currently using winexe (a sort of pstools for linux): this tool allow me to remotely connect (from the Vbox host for example) to a windows VM and execute any command. Xp provide the shutdown command that, with -f option, force the shutdown of a Locked Workstation too.

@Vbox4me2

You're right :) to perform the shutdown command i need to enter the user/password of the currently logged on user (with the privileges to shutdown, of course).
It's very interesting the use of a separate user only to do a shutdown... Local Security Policy, isn't it?

Re: headless-Server doesn't shutdown :-(

Posted: 5. Aug 2009, 22:09
by vbox4me2
Its a policy yes, something like allowshutdown with users and groups as value.

Re: headless-Server doesn't shutdown :-(

Posted: 22. Sep 2013, 21:53
by emviel
I also ran into this problem and found no solution. I will try to describe everything in detail.

Host: Win 7 x64 (I usually work on it via RDP)
Guest VM's: Win XP

VM's scenario:
-all machines started
-important: NO user logged on
-no screen saver activated
-power settings: turn off monitor -> never; Turn off HDD -> never
-important: all VM windows are minimized on host and untouched for about 15 min (i'll explain below why)

Observation: normally, ACPI shutdown works very well on the VM's but under certain conditions (described below) they don't!

To replicate it's important not to "touch" the machines or bring their windows in foreground (hover mouse over them or push keys while they're in foreground, etc). Just let the VM's get idle. I left them at the beginning for about 30 minutes but it also works with shorter times (10-15 minutes) - with less I haven't tried.

On VM's no user is logged on.

If the VM's are not operated for some time (I didn't count how much) it shows the well known Windows XP logo which moves around (on black background).

The problem: When the ACPI shutdown is issued, the following happens: the Win XP hosts do not poweroff. They still answer to ping. It is like something prevents them to poweroff.

What I've observed:
1. When I login with RDP on the VM I can very shortly see the machine switching from the wellknown screensaver windows logo and afterwards the message window appears "Windows is shutting down" and in about 1-2 seconds the mashine is gracefully powered off.

or

2. On the host: when i maximize the VM window and hover the mouse over it, the same happens as described at point 1.

The issue is: WHY DO I HAVE TO MOVE THE MOUSE OVER THE (IDLE) VM's SCREEN (virtual screen/RDP screen) TO GET THE MACHINE ACPI SHUT DOWN?
(please do not consider the capital letters as shouting, it's just for someone who doesn't read the whole message, or just browses trough it to see the essence. :shock: )

What I've also tried:
1. Scheduled ACPI shutdown of the VM's from the host (vboxamange controlvm vmname acpipowerbutton)-> same result as described before.
2. ACPI shutdown from the Virtualbox Interface -> same result as described before.
3. Scheduled shutdown from within the VM (shutdown -s -f -t 0) -> same result as described before
4. I have also tried remote shutdown via the sysinternals tool: psexec shutdown -s -f -t 0 (with the admin credentials) -> same result as described before

Re: headless-Server doesn't shutdown :-(

Posted: 23. Sep 2013, 13:09
by ChipMcK
You have checked out the power management options of the Guest, no?
Most screen-savers are optional feature of power management

Re: headless-Server doesn't shutdown :-(

Posted: 24. Sep 2013, 14:15
by emviel
I have found the solution: the screensaver / logon screensaver is the showstopper. Please note that the logon screensaver is different from the user screensaver. Remote shutdown / local scheduled shutdown is NOT working when user screensaver or windows logon screensaver is activated and running.

I've found this useful articles:
1. http://kb.vmware.com/selfservice/micros ... Id=9275881
2. http://support.microsoft.com/kb/918449
3. http://support.microsoft.com/kb/329142

The solutions:

Solution 1 (tested-works!)
Link from point 1 solved my problem.
Additionally, I've done the following:
- disabled the screensaver (who needs it in VM's?)
- in the power scheme i've disabled HDD + Monitor poweroff (=set on "Never") - I think this point is not needed.

Solution 2 (not tested but I've red that it's working)
Use psshutdown.exe from Microsoft Sysinternals. The program can be executed from the host or another machine in the network which can reach the VM to be powered off.
It seems that psshutdown.exe is smart enough to avoid the problem with the screensaver.

BR

Re: headless-Server doesn't shutdown :-(

Posted: 24. Sep 2013, 15:57
by ChipMcK
The solutions are specific to Windows as the Guest OS

For those running *unix ???

Re: headless-Server doesn't shutdown :-(

Posted: 14. Nov 2013, 10:24
by emviel
I have also found a good article about ACPI shutdown for Windows Server (should work also on XP but I didn't test it):

http://hashtips.wordpress.com/2013/03/1 ... l-machine/