From: joshua stein Subject: apmd: run powerdown at boot when not on power To: tech@openbsd.org Date: Sun, 30 Aug 2026 14:18:17 -0500 If one has /etc/apm/powerdown set to do things when the machine goes on battery like set powersave on a Wi-Fi interface, that never gets run on a reboot because apmd only catches a transition. I thought about running powerup at boot too but is that pointless? My powerdown is turning knobs from the defaults, my powerup turns them back to defaults, so running powerup at boot does nothing. Also, powerup and powerdown are terrible names. diff --git usr.sbin/apmd/apmd.c usr.sbin/apmd/apmd.c index e87e5d2c0db..d5dd7c89c0d 100644 --- usr.sbin/apmd/apmd.c +++ usr.sbin/apmd/apmd.c @@ -525,7 +525,7 @@ main(int argc, char *argv[]) sock_fd = bind_socket(sockname); - power_status(ctl_fd, 1, &pinfo); + powerstatus = power_status(ctl_fd, 1, &pinfo); if (statonly) exit(0); @@ -539,6 +539,9 @@ main(int argc, char *argv[]) set_driver_messages(ctl_fd, APM_PRINT_OFF); + if (ctl_fd != -1 && !powerstatus) + do_etc_file(_PATH_APM_ETC_POWERDOWN); + kq = kqueue(); if (kq <= 0) error("kqueue", NULL);