back to the beginning

FreeBSD 12.0 Suspend and Resume

Last updated: 2019-02-24

Suspend and resume

A fresh install of FreeBSD 12 had issues with suspend and resume on my hardware.

ACPI - The full package

Adding some additional kernel modules (I think) fixed the USB issue. I was trying to fix the video problem and this went away.

Add to /etc/rc.conf

kld_list="acpi"

While I was at it I also added these other acpi related settings to /etc/sysctl.conf:

hw.acpi.sleep_delay=3
hw.acpi.reset_video=1
hw.acpi.sleep_button_state=S3
hw.acpi.power_button_state=S5
hw.acpi.sleep_delay=3
hw.acpi.verbose=1
hw.syscons.sc_no_suspend_vtswitch=0

And to /boot/loader.conf:

hw.acpi.reset_video="YES"

Before adding these, you should check if these suit your needs (man acpi(4)).

Intel network driver (if_em) buggy

There is a bug in the em driver in FreeBSD 12.0. I built a kernel without the em driver and then I unload it and load it to work around this problem. The em driver doesn't go by that name when dealing with the kernel module; it is if_em.

Step 1: Build kernel without em driver (but load it in /etc/rc.conf (kld_list="if_em").

Add to /etc/rc.suspend (read the comments in the file to know where to put this):

kldunload if_em

Add to /etc/rc.resume:

kldload if_em

Wake monitor after suspend

Waking the monitor after waking from sleep did not initially work by simply going to a terminal from X11 (pressing CTRL-ALT-F1). However, after making other changes it started to work. After your monitor comes back on, press go back to X11 (ALT-F9)

I bound a script to a hotkey to wake the monitors without leaving X11:

xrandr --output DVI-I-1 --off
xrandr --output DVI-I-1 --auto
xrandr --output DVI-D-0 --off
xrandr --output DVI-D-0 --auto
xrandr --output DVI-I-1 --rotate right
xrandr --output DVI-D-0 --rotate left --right-of DVI-I-1

You will need to know your monitor name: run xrandr for that. In my case I have two monitors and this works by forcing them off and then returning them to auto mode.
The last two lines the file set the rotation and position for my monitors. Of course, if you don't have two monitors set up vertically then you won't need those lines.
Actually, my .xinit file sets the rotation and position so that I don't have to do it in the window manager (usually). (Enlightenment had a setup that would not work properly with previously rotated monitors.)

Note that your display may have some ugly artifacts in the window titles and borders. This corruption can be removed by restarting whatever compositor you may be running. You can even add that to the above file if you know how to reset it from the command line. Otherwise you can turn it on and off in the your window manager settings if available.

Add to /etc/rc.conf

kld_list="acpi acpivideo"

Add to /etc/sysctl.conf:

hw.acpi.reset_video=1

Cursor can get corrupted; go to terminal and return to X to fix that.

back to the beginning

Something need fixing? Contact me: