Power Management
- 4 minutes read - 675 wordsWhen I closed my laptop lid, I assumed power management magic things would happen. They did not. Recall, FreeBSD is server/desktop-oriented versus laptop-oriented.1 So, yeah. Dead battery.
After fixing that, I ran into another bug where the laptop wouldn’t wake up from sleeping state. It was a rough start.
Here’s how I learned some of my core basic skills with FreeBSD, learned a bit about power management, learned a bit about systems-level eventing, and got a laptop that doesn’t drain its battery if I shut the lid and walk away.
⚠️ Here’s the first place where a lot of the implicit skills that aren’t documented in the handbook can start to make life difficult. Double check list before you go on to avoid frustration ⚠️
This was the first, but not the last, time, I would need to go to to the forums for help. After I posted, I got a reply that pretty much set me on the path to success. The take-away from T-Daemon’s suggestion:
/etc/sysctl.conf
add line:hw.acpi.lid_switch_state=S3
- Install
pkg install graphics/drm-515-kmod
(and make prompted changes)
This wound up being successful. For the sake of being methodical, first I tried
changing the sysctl
– no success. I backed it out. Then I tried installing
the driver – no success. I made both these changes. It worked!
To save anyone from tangents: S3 is the industry-standard term for sleep state with memory preserved.
If this enough for you, move on. If you need things more spelled-out, keep reading.
Process
Log into the system as root
.
Back Things Up With the Magic of Snapshots
Take a snapshot for if we mess up later! This is one of the real beauties of FreeBSD that will pay dividends once we get our system up and running!
# zfs snapshot -r zroot/ROOT@pristine-2025-03-17
It’s awesome having the ability to have a picture of the root file system, recursively, at its start.
👀 TOIMPROVE: It’s strange to me that FreeBSD has this game changer feature in zfs of snapshots but doesn’t really get you using them early. I think if more people saw the utility in this earlier, they would really love FreeBSD more.
👀 TOIMPROVE: Additionally, now seems like a great time to talk about making a default boot environment to introduce another power user feature that doesn’t need to be at all power-user cloaked in mists of mystery if we make it common to use it!
Update sysctl.conf
# echo hw.acpi.lid_switch_state=S3 >> /etc/sysctl.conf
For fun, confirm switch state: sysctl hw.acpi
to see all the acpi values.
Install the Missing Module
Use pkg
# pkg search drm-515
to make sure it’s there- Get prompted to install
pkg
package and agree; follow prompts and see that such a package exists # pkg install drm-515-kmod
- Follow steps (also: you can re-list with
# pkg info --pkg-message drm-515-kmod
)- Edit
/etc/rc.conf
withkld_list="i915kms"
- Add root and a regular user to
video
group:# pw groupmod video -M normaluser,root
- Edit
Reboot
# reboot
or # shutdown -r now
Verify / Testing
- Login as
root
- FYI:
kldstat
now clearly showsi915kms.ko
as installed. This command lists loaded kernel modules anddrm-515-kmod
(as suggests bykmod
) is just such a thing.kldstat
lists the status of all the kernel modules - Emulate lid close with
acpiconf -s3
- Close lid / Open and … it works.
man acpiconf
explains that “battery statuses e.g. S3, S4, etc. can be changed withacpiconf(1)
. So the issue must have been that the generic driver did not know how to come back out of S3 status when the “wake-up” button was pushed.
Footnotes
- It’s worth pointing out that while this might be the legacy of the platform, recent efforts in 2025 are working very hard to create an excellent laptop environment. In particular, the board has selected a few hardware platforms (In particular the Frame.work laptop) and will be aiming to give it an experience at parity to Linux/Windows/Mac and will then port those insights to other laptop platforms. For more: “Why laptop support, why now: FreeBSD’s strategic move toward broader adoption”