Unable to do a cold shutdown (have to press powerbutton)

Hi

My goal is to do a perfect cold shutdown of my box without having to manually holding the power button after the operating system has halted.

I have long lived with this problem. It appears when I try to cold shutdown my freebsd server. [CMD=]shutdown -p now[/CMD] is the correct way to to a cold shutdown of a freebsd machine (I think). [CMD=]halt -p[/CMD] uses equivalent methods for shutting down as [CMD=]shutdown -p now[/CMD]
I think.

What happens (in chronological order) is this:

  1. shutdown -p now
  2. On screen I see this:
    Code:
    *** FINAL System shutdown message from root@stack.example.org ***          
    System going down IMMEDIATELY                                                  
                                                                                   
                                                                                   
    Aug  2 21:11:58 stack shutdown: power-down by root:
    
    System shutdown time has arrived
    Stopping cron. 
    Stopping sshd.
    Stopping devd.
    Writing entropy file:.
    Terminated
    .
    Aug  2 21:12:00 stack syslogd: exiting on signal 15
    Waiting (max 60 seconds) for system process `vnlru' to stop...done
    Waiting (max 60 seconds) for system process `byfdaemon' to stop...done
    
    Waiting (max 60 seconds) for system process `syncer' to stop...Syncing disks, vnodes remaining...0 0 0 0 0 0 done
    All buffers synced. 
    Uptime: 38s
    acpi0: Powering system off
  3. Manually have to walk to the computer and press and hold the powerbutton for some seconds to get the system to power down completely

The hardware list for this server goes like this:
MSI 975X Platinum PowerUp Edition (BIOS version: W7246IMS V7.9)
Intel(R) Core(TM)2 Duo @ 2.40GHz
4GB (1024MB*4) Kingston 667 DDR2 memory
80GB Western Digital Blue IDE HDD
4*500GB Seagate Barracuda 16M/32M SATA2 HDD​

It currently runs 8.1-STABLE, and this has been a problem with all the versions of freebsd I've tried (>6.2-RELEASE).

Some things I've tried:
  • reading shutdown(8)
  • reading acpi(4)
  • reading this handbook page
  • updating to latest official bios version from MSI (7.9)
  • keeping up to date with freebsd-stable for as long as I can remember
  • asking this question in the official norwegean BSD/UNIX forum back in 2008, not able to solve any further

From reading this handbook page and afterwards reading acpi(4), I understand that adding acpi to a possible custom kernel is not necessary.

And yes, shutting down from other Operating Systems and LiveCDs like OpenSolaris, SLAXS, Ubuntu LiveCD. So I bet my shoes it has to do with FreeBSD and not my hardware.

I'm really out of ideas now.

I kindly appreciate any answers to bring me further to my goal for this thread.
 
You're using the posting tag the wrong way, which makes the actual commands disappear. Please re-read [url]http://forums.freebsd.org/showthread.php?t=8816[/url]
 
Looks like you may have covered everything.

% kldstat
Should show acpi.ko loaded.

If so can you put the machine to sleep?
# acpiconf -s3
and wake it without problems?

# acpiconf -s5
will do a shutdown but without allowing BSD to unmount clean. Same as pushing the power button while the machine is running. If you have your BIOS set for a shutdown upon push of power button.

These are the config files that are used. You can look at (edit) them in a text editor.
/etc/rc.shutdown
/etc/rc.resume
/etc/rc.suspend

Read this part of the handbook
http://www.freebsd.org/doc/en/books/handbook/acpi-debug.html
 
Thanks everyone for answering.

I have not tried to set any sysctl variables before shutdown.

I did not know about % kldstat. Useful stuff indeed.

Code:
root@stack ~ # kldstat
Id Refs Address            Size     Name
 1   15 0xffffffff80100000 d705b0   kernel
 2    1 0xffffffff80e71000 19e010   zfs.ko
 3    2 0xffffffff81010000 3860     opensolaris.ko
 4    1 0xffffffff81014000 24e48    snd_hda.ko
 5    2 0xffffffff81039000 75638    sound.ko

The acpi.ko module is not loaded. I was of the impression that it was compiled into the GENERIC kernel already? How can I compile it and load it(?) - I could not # find / -name '*acpi.ko*' it (I have a GENERIC world and kernel).

In the meantime I will try my luck with # acpiconf -s3, # acpiconf -s5, # init 0, and then you all know what happened
 
I'm back already :stud

Code:
# acpiconf -s3
acpiconf: request sleep type (3) failed: Operation not supported
# acpiconf -s5
acpiconf: invalid sleep type (5)
#
But I would not expect much yet, as acpi.ko is not loaded yet.

# init 0 gives the same result as # shutdown -p now and # halt -p, they stop at saying
Code:
acpi0: Powering off system using ACPI

Just curious, if anyone happen to know: How common is this problem? At the norwegean forum, one person said he lived happily with some really old computers even if he had to turn off the computer manually every once in a while.
 
I typically wait until "the operating system has
halted" and toggle the switch on the power
supply off and on. (Seems more convenient than
the power-off button).
 
You don't have acpi working. That's why it does not power off or sleep. You already knew that.

This box has a Generic kernel and I have

Code:
$ uname -a
FreeBSD.... 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri May  1 08:49:13 UTC 2009     root@walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
Code:
$ locate acpi | grep kernel
/boot/kernel/acpi.ko
/boot/kernel/acpi.ko.symbols
/boot/kernel/acpi_aiboost.ko
/boot/kernel/acpi_aiboost.ko.symbols
/boot/kernel/acpi_asus.ko
/boot/kernel/acpi_asus.ko.symbols
/boot/kernel/acpi_dock.ko
/boot/kernel/acpi_dock.ko.symbols
/boot/kernel/acpi_fujitsu.ko
/boot/kernel/acpi_fujitsu.ko.symbols
/boot/kernel/acpi_ibm.ko
/boot/kernel/acpi_ibm.ko.symbols
/boot/kernel/acpi_panasonic.ko
/boot/kernel/acpi_panasonic.ko.symbols
/boot/kernel/acpi_sony.ko
/boot/kernel/acpi_sony.ko.symbols
/boot/kernel/acpi_toshiba.ko
/boot/kernel/acpi_toshiba.ko.symbols
/boot/kernel/acpi_video.ko
/boot/kernel/acpi_video.ko.symbols
Code:
$ sysctl -a | grep acpi
..EDIT.....
hw.acpi.supported_sleep_state: S1 S3 S4 S5
hw.acpi.power_button_state: S5
hw.acpi.sleep_button_state: S1
hw.acpi.lid_switch_state: NONE
hw.acpi.standby_state: S1
hw.acpi.suspend_state: S3
hw.acpi.sleep_delay: 1
............

I'm not sure where to point you. I don't know why you don't have that module.
Make sure acpi is enables in BIOS.
You have to have acpi.ko loaded for acpi to work.

# kldload
# kldunload
will load and unload kernel modules.
Put an entry in /boot/loader.conf to make it permanent.

Good luck and let us know what you find out.

Someone else may know the answer to this.

How common is this problem?
Only with the old PII types and earlier that did not support acpi. They did support apm though.
 
Thanks for answering.

This is strange indeed. I have many of the same modules in my /boot/kernel/, but not specifically acpi.ko. If I could only somehow compile that acpi.ko, the system will be able to shutdown - I hope. How can I compile it in? Does the kernel config have to be custom afterall?

Code:
# locate acpi | grep kernel
locate: database too small: /var/db/locate.database
# find / -name '*acpi*' | grep kernel
/boot/kernel.old/acpi_aiboost.ko.symbols
/boot/kernel.old/acpi_ibm.ko.symbols
/boot/kernel.old/acpi_video.ko
/boot/kernel.old/acpi_wmi.ko.symbols
/boot/kernel.old/acpi_dock.ko
/boot/kernel.old/acpi_wmi.ko
/boot/kernel.old/acpi_toshiba.ko.symbols
/boot/kernel.old/acpi_fujitsu.ko.symbols
/boot/kernel.old/acpi_aiboost.ko
/boot/kernel.old/acpi_video.ko.symbols
/boot/kernel.old/acpi_dock.ko.symbols
/boot/kernel.old/acpi_panasonic.ko.symbols
/boot/kernel.old/acpi_hp.ko.symbols
/boot/kernel.old/acpi_panasonic.ko
/boot/kernel.old/acpi_sony.ko
/boot/kernel.old/acpi_hp.ko
/boot/kernel.old/acpi_sony.ko.symbols
/boot/kernel.old/acpi_fujitsu.ko
/boot/kernel.old/acpi_ibm.ko
/boot/kernel.old/acpi_asus.ko
/boot/kernel.old/acpi_toshiba.ko
/boot/kernel.old/acpi_asus.ko.symbols
/boot/kernel/acpi_aiboost.ko.symbols
/boot/kernel/acpi_sony.ko
/boot/kernel/acpi_video.ko.symbols
/boot/kernel/acpi_fujitsu.ko.symbols
/boot/kernel/acpi_ibm.ko
/boot/kernel/acpi_asus.ko
/boot/kernel/acpi_aiboost.ko
/boot/kernel/acpi_hp.ko.symbols
/boot/kernel/acpi_toshiba.ko.symbols
/boot/kernel/acpi_panasonic.ko.symbols
/boot/kernel/acpi_dock.ko.symbols
/boot/kernel/acpi_video.ko
/boot/kernel/acpi_ibm.ko.symbols
/boot/kernel/acpi_panasonic.ko
/boot/kernel/acpi_hp.ko
/boot/kernel/acpi_wmi.ko.symbols
/boot/kernel/acpi_sony.ko.symbols
/boot/kernel/acpi_wmi.ko
/boot/kernel/acpi_fujitsu.ko
/boot/kernel/acpi_toshiba.ko
/boot/kernel/acpi_dock.ko
/boot/kernel/acpi_asus.ko.symbols
#

Also, this is mentioned about acpi in the dmesg:

Code:
# dmesg|grep acpi
acpi0: <IntelR AWRDACPI> on motherboard
acpi0: [ITHREAD]
acpi0: Power Button (fixed)
acpi0: reservation of 0, a0000 (3) failed
acpi0: reservation of 100000, cfde0000 (3) failed
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
acpi_button0: <Power Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
acpi_tz0: <Thermal Zone> on acpi0
atrtc0: <AT realtime clock> port 0x70-0x73 irq 8 on acpi0
fdc0: <floppy drive controller> port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on acpi0
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
ppc0: <Parallel port> port 0x378-0x37f,0x778-0x77b irq 7 on acpi0
acpi0: <IntelR AWRDACPI> on motherboard
acpi0: [ITHREAD]
acpi0: Power Button (fixed)
acpi0: reservation of 0, a0000 (3) failed
acpi0: reservation of 100000, cfde0000 (3) failed
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
acpi_button0: <Power Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
acpi_tz0: <Thermal Zone> on acpi0
atrtc0: <AT realtime clock> port 0x70-0x73 irq 8 on acpi0
fdc0: <floppy drive controller> port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on acpi0
uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
ppc0: <Parallel port> port 0x378-0x37f,0x778-0x77b irq 7 on acpi0
#

Code:
# sysctl -a | grep acpi
... EDIT ...
hw.acpi.supported_sleep_state: S1 S4 S5
hw.acpi.power_button_state: S5
hw.acpi.sleep_button_state: S1
hw.acpi.lid_switch_state: NONE
hw.acpi.standby_state: S1
hw.acpi.suspend_state: NONE
hw.acpi.sleep_delay: 1
......

It seems I'm currently not able to suspend. This is wrong. I'm not able to anything, really.
 
If I could only somehow compile that acpi.ko, the system will be able to shutdown - I hope.

I'm not exactly sure if this is going to solve the problem, but if your /usr/src is populated, the command
# cd /usr/src/sys/modules/acpi/acpi && make && make install should get acpi.ko into /boot/modules , and then # kldload acpi should work.
 
AFAIK, in your first post, the shutdown mentioning
acpi0 means it is loaded. (I find it entertaining
to read the "operating system halted" message and
shutoff by toggling the power switch, as above.
Also, those rare times it gives some other error,
or warning pre-shutdown, the message stays onscreen
and is not obliterated by the shutdown itself. )
 
teckk said:
Looks like you may have covered everything.
% kldstat
Should show acpi.ko loaded.
...
Code:
>kldstat
Id Refs Address    Size     Name
 1   17 0xc0400000 9d6030   kernel
 2    1 0xc0dd7000 1b724    snd_hda.ko
 3    2 0xc0df3000 567b0    sound.ko
 4    1 0xc0e4a000 a05554   nvidia.ko
 5    1 0xc1850000 2ec74    vboxdrv.ko
 6    1 0xc421a000 10000    msdosfs.ko
 7    1 0xc42eb000 10000    ext2fs.ko
there isno acpi.ko. However `shutdown -p now` works great.
 
sw2wolf said:
Code:
>kldstat
Id Refs Address    Size     Name
 1   17 0xc0400000 9d6030   kernel
 2    1 0xc0dd7000 1b724    snd_hda.ko
 3    2 0xc0df3000 567b0    sound.ko
 4    1 0xc0e4a000 a05554   nvidia.ko
 5    1 0xc1850000 2ec74    vboxdrv.ko
 6    1 0xc421a000 10000    msdosfs.ko
 7    1 0xc42eb000 10000    ext2fs.ko
there isno acpi.ko. However `shutdown -p now` works great.

It's part of GENERIC these days.

For a good time, try [cmd=""]kldstat -v | grep acpi[/cmd]

Note that kldstat(8) with the -v flag is likely to be exceptionally noisy.
Code:
> kldstat -v | wc -l
     339
 
I tried out foo_daemon advice (built acpi.ko, since it were not built already). I have had some difficulties loading the module though:

Code:
# kldload acpi.ko
kldload: can't load acpi.ko: Exec format error

What does this mean?
 
Do a $ dmesg before and after you try the kldload: are there new lines with more information?
Also, What is the output of $ grep __FreeBSD_version /usr/src/sys/sys/param.h
versus $ sysctl kern.osreldate ?
 
These lines where new in the dmesg after # kldload acpi.ko:
Code:
interface acpi.1 already present in the KLD 'kernel'!
linker_load_file: Unsupported file type

Here are the other two commands:

Code:
root@stack ~ # grep __FreeBSD_version /usr/src/sys/sys/param.h 
 * __FreeBSD_version numbers are documented in the Porter's Handbook.
#undef __FreeBSD_version
#define __FreeBSD_version 801500	/* Master, propagated to newvers */
root@stack ~ # sysctl kern.osreldate
kern.osreldate: 801500
root@stack ~ #
 
Well, that confirms that you do have acpi compiled into the kernel (as it is supposed to be in GENERIC) and that your sources are synced properly. I'm pretty much out of ideas..
 
Back
Top