If you have ATX hardware, for various reasons, you might want your box to poweroff by itself when you shut it down. To achieve this you have to enable apm(8) in the kernel. Here's how to do it:


  1. Obtaining the Sources
  2. Configure the kernel
  3. Build the kernel
  4. Install the kernel
  5. Troubleshooting

Obtaining the Sources

If you are running 3.0, you can get the Sources from the NetBSD FTP Server or from a Mirror close to you. If you are running current, you should check out the Sources from a CVS Mirror close to you.

# cd /
# ftp ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-3.0/source/sets/syssrc.tgz
# tar -zxf syssrc.tgz

Configure the kernel

Edit the file /usr/src/sys/arch/i386/conf and uncomment apm to enable APM, it should look like:

apm0    at mainbus0         # Advanced power management

Alternatetively, you might want to customize (uncomment) these options:

# Tuning for power management, see apm(4) for more details.
#options        APM_NO_IDLE             # Don't call BIOS CPU idle function
#options        APM_V10_ONLY            # Use only the APM 1.0 calls
#options        APM_NO_POWEROFF         # Don't power off on halt(8)
#options        APM_POWER_PRINT         # Print stats on the console
#options        APM_DISABLE_INTERRUPTS=0 # Don't disable interrupts

Build the kernel

# config GENERIC_APM
# cd ../compile/GENERIC_APM
# make depend; make

If everything went OK, your new APM-enabled-kernel should be located in ./netbsd

Install the kernel

# mv /netbsd /netbsd.old
# cp netbsd /
# shutdown -r now

Now when you shutdown the box it should poweroff by itself, without the need for the power button to be pressed.


If something went wrong, test with apm(8). Sample output:

root@antfarm:~# apm
Battery charge state: absent
Battery remaining: 0 percent (0 minutes)
A/C adapter state: connected
Power management enabled


You will need the apm Daemon apmd running for setting your Notebook fall into sleep. For that please add:


to your /etc/rc.conf Also see apmd(8) for more power management issues.

Add a comment
Contact | Disclaimer | Copyright © 1994-2016 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.
NetBSD® is a registered trademark of The NetBSD Foundation, Inc.