acpipowerbutton function - is it just for fun? ;-)

Discussions related to using VirtualBox on Linux hosts.

acpipowerbutton function - is it just for fun? ;-)

Postby bodo » 1. Jun 2010, 00:06

Hey,

I am observing this since several versions in my virtualbox, basically whatever I do I can not get acpipowerbutton to work (i tested so far only on windows clients with up-2-date guest additions) - it gets simply ignored by guest. I followed any recommendation I could find. my setup atm is as follows:
- newest gentoo x64 with all updates
- kernel 2.6.34 with acpi enabled
- virtualbox 3.20 running in headless mode, all machines run under unprivileged user account(vbox) <--- hmmm, just got an idea, could this be a problem somehow? i have seen a couple of weird issues with vmware and network cards when running as unpriviledged user

btw. use specs above only as loose guideline, i have seen the same problem on x86 version of virtualbox 3.x (running on different cpu) with any earlier kernel I have used (2.6.20+), recently I upgraded just a few days ago, before I was using 2.6.33 with vbox 3.1.6 and same problem. which gives me an idea that I must be simply missing something, because it couldn't be that this feature simply doesnt work, right?

I have 2 guest atm - w2k8sp2x64 and w2k3sp2x86, both of them experiencing the same issue. here is the example of how w2k3 is configured:
Name: W2K3
Guest OS: Windows 2003
UUID: 971002e2-51fc-4e46-84a1-9b3072766d35
Config file: /vol/vbox/.VirtualBox/Machines/W2K3/W2K3.xml
Hardware UUID: 971002e2-51fc-4e46-84a1-9b3072766d35
Memory size: 640MB
Page Fusion: off
VRAM size: 8MB
HPET: off
Number of CPUs: 1
Synthetic Cpu: off
CPUID overrides: None
Boot menu mode: message and menu
Boot Device (1): DVD
Boot Device (2): HardDisk
Boot Device (3): Not Assigned
Boot Device (4): Not Assigned
ACPI: on
IOAPIC: on
PAE: on
Time offset: 0 ms
RTC: local time
Hardw. virt.ext: on
Hardw. virt.ext exclusive: on
Nested Paging: on
Large Pages: off
VT-x VPID: on

W2K8 is very similar for all ACPI/APIC settings. In guests, device manager -> my machine's driver is:
Advanced Configuration and Power Interface (ACPI) PC -> W2K3
ACPI x64-based PC -> W2K8
oh yeah, guest is of course setup to shutdown whenever powerbutton is pressed.
btw. checked the tip with sounds/audio - no effect at all.

As i said at the beginning anytime I try to run VBoxManage controlvm W2K3 acpipowerbutton it simply gets ignored. however a while ago I have noticed that sometimes if I am on the the machines' local console (using builtin vrdp of vbox) and as far as I remember I have to logon for this as well then sometimes I am able to get the guest to shutdown by using acpipowerbutton. this is however a bit too weird and does not always work either, so I thought I would ask here about any experiences...

Any ideas guys?
bodo
 
Posts: 12
Joined: 4. Apr 2010, 19:43
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: acpipowerbutton function - is it just for fun? ;-)

Postby Sasquatch » 1. Jun 2010, 20:37

I think it is some sort of security thing for servers, that they don't shut down when you accidently hit the power button. I can't shut down my Windows Server 2003 either with the acpipowerbutton, but my XP VMs do respond to it. When I log on to the console of the server, the acpipowerbutton does work. When I lock the session, it too does not respond to the ACPI command. It seems that you have only a few options, one of them is to use poweroff, essentially pulling it's power cord, or set the system to log on automatically to the console and never let it lock. There are of course other options you can use, like a save state.

With the new version however, you can send a command to the VM if the GA are fully updated. With that, you can send the shutdown command too, using 'shutdown -s', which defaults to a 30 second count down until it shuts down.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Sasquatch
Volunteer
 
Posts: 17800
Joined: 17. Mar 2008, 13:41
Location: /dev/random
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux

Re: acpipowerbutton function - is it just for fun? ;-)

Postby bodo » 1. Jun 2010, 23:40

I think it is some sort of security thing for servers, that they don't shut down when you accidently hit the power button. I can't shut down my Windows Server 2003 either with the acpipowerbutton, but my XP VMs do respond to it. When I log on to the console of the server, the acpipowerbutton does work. When I lock the session, it too does not respond to the ACPI command. It seems that you have only a few options, one of them is to use poweroff, essentially pulling it's power cord, or set the system to log on automatically to the console and never let it lock. There are of course other options you can use, like a save state.


very interesting, thx! seems to be very similar to the impression I have made so far, interesting difference with xp -> I am going to test it as well and post later. btw. my personal solution to this is using cygwin/sshd and issuing the shutdown remotely over sshd, lot of work but i really needed the feature :-)

With the new version however, you can send a command to the VM if the GA are fully updated. With that, you can send the shutdown command too, using 'shutdown -s', which defaults to a 30 second count down until it shuts down.


and this is sweet, I am going to switch over to this right away. super tip, thx!
bodo
 
Posts: 12
Joined: 4. Apr 2010, 19:43
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: acpipowerbutton function - is it just for fun? ;-)

Postby Sasquatch » 2. Jun 2010, 20:49

bodo wrote:btw. my personal solution to this is using cygwin/sshd and issuing the shutdown remotely over sshd, lot of work but i really needed the feature :-)

Why not just RDP to the server like usual and issue the shutdown from it there? How else do you manage it? ;).

Oh, and a little something I forgot to mention, sometimes you get a dialogue if you are sure you want to shut down the system in case there are still users connected to it. You have to force the shut down, which luckily can be done with the shutdown command too. Just take a look at the /? output.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Sasquatch
Volunteer
 
Posts: 17800
Joined: 17. Mar 2008, 13:41
Location: /dev/random
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux

Re: acpipowerbutton function - is it just for fun? ;-)

Postby bodo » 2. Jun 2010, 23:19

Why not just RDP to the server like usual and issue the shutdown from it there? How else do you manage it? ;).


but can you get rdp to pass commands remotely in a script? i am not aware of this possibility, so if you developed a method to do this, then please share!

with ssh i am running a shutdown command as part of init.d script, something like that:

stop() {
# If we are the original virtualbox script [ $SVCNAME = "virtualbox" ]
if ! isvm ; then
ebegin "Stopping Virtualbox"
unloadmodules
eend $?
else
checkconfig || return $?
checkpath || return $?

ebegin "Stopping Virtualbox: $VBOXNAME"

# this doesn't always work
# su ${VM_USER} -c "PATH=$VBOXPATH VBoxManage controlvm \"$VM_NAME\" $VM_SHUTDOWN &>/dev/null"

# so we will replace it with a workaround
if [ "$(su ${VM_USER} -c "PATH=$VBOXPATH VBoxManage showvminfo \"$VM_NAME\" | grep State | grep runn")" != "" ]
then su ${VM_USER} -c "ssh shutdown@10.10.10.10 '/usr/bin/shutdown -s now'"
fi


while [ "$(su ${VM_USER} -c "PATH=$VBOXPATH VBoxManage showvminfo \"$VM_NAME\" | grep State | grep runn")" != "" ]
do
echo -n "."
sleep 1
done

sleep 1
echo

eend $?
fi
}

and so far it never failed to shutdown the machine when host is coming down etc.
bodo
 
Posts: 12
Joined: 4. Apr 2010, 19:43
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: acpipowerbutton function - is it just for fun? ;-)

Postby Sasquatch » 3. Jun 2010, 20:13

I meant that you just RDP to the server like normal and shut it down from there. No need with scripts and cygwin or anything. But the command options since 3.2.0 will surely help to simplify it.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Sasquatch
Volunteer
 
Posts: 17800
Joined: 17. Mar 2008, 13:41
Location: /dev/random
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux

Re: acpipowerbutton function - is it just for fun? ;-)

Postby bodo » 14. Nov 2010, 23:37

btw. for anybody looking here in the future - I found alternative method to achieve the same result (for windows systems)
1. you have to install samba/tools package on the host
2. then from e.g. host you have to run: /usr/bin/net rpc shutdown -f -t 1 -I XXX.XXX.XXX.XXX -U <shutdown_acc>%<password>

definitive advantage over: "VBoxManage guestcontrol execute VMGUEST "c:\windows\system32\shutdown.exe" --username <shutdown_acc> --password <password> --arguments "/s" --verbose"
...is that it doesnt require "log on locally" right on the windows system (VBoxManage guestcontrol does require it), just "force shutdown remotely" in GPO and you are set, so imho its probably the most secure option so far.
bodo
 
Posts: 12
Joined: 4. Apr 2010, 19:43
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: acpipowerbutton function - is it just for fun? ;-)

Postby Sasquatch » 14. Nov 2010, 23:43

But the above only works if you have direct access to the Guest from the Host. If it runs on Internal or NAT, then it won't work.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Sasquatch
Volunteer
 
Posts: 17800
Joined: 17. Mar 2008, 13:41
Location: /dev/random
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux


Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: No registered users and 18 guests