# suspend to disk, s4, hibernate



## cL0N31 (Sep 7, 2016)

so I tried `acpiconf -s4`: FreeBSD did something and then the laptop went off as if it successfully hibernated. When I powered back on, FreeBSD started up as if I did a cold shutdown, showing messages like "system marked clean", etc. After `acpiconf -s3` the laptop was showing a flashing power led, however after trying to wake it up, again, it came up as if it went thru a cold shutdown.

I tried PCBSD on the same hardware and noticed improvements. `acpiconf -s3` works as it should, the laptop successfully resumed from sleep even in X. When trying to hibernate tho, again, laptop didn't resume but started all over, however I didn't notice any "system marked clean" or "wasn't unmounted" during the startup. Tells me that FreeBSD can be tuned out at least for s3 to work.

The handbook says to compare to Linux cause it could be a driver issue. So I'm installing Linux and checking out the manual. Basically it says that in order to successfully use s4, swap is a must and the boot loader config needs to be edited so it can resume from swap. Does FreeBSD also use swap space for s4 and boot loader also need adjustments?


----------



## ljboiler (Sep 7, 2016)

From what I read in the acpi(4) man page, the only way currently to have FreeBSD go to  the S4 state is if your system BIOS supports it (hw.acpi.s4bios).


----------



## cL0N31 (Sep 7, 2016)

my hardware doesn't have s4bios and Linux hibernated and resumed it successfully. The way the handbook puts it, basically if Linux can, FreeBSD can. Besides, I don't have the symptoms the handbook describes such as system hang, panics, powering up after suspend, buggy bios code. It seems that it hibernates fine, just can't resume.
I think that if Linux requires a little work to get it going, FreeBSD probably won't work right out of the box either


----------



## Snurg (Sep 7, 2016)

You might want to read this first. The article is incomplete however. There are some more knobs and dials you may have to fiddle with than mentioned in the article.

For example, the VESA driver built into the FreeBSD kernel seems to be responsible for a high percentage of the resume failures.
I had to build a custom kernel without the VESA driver to make S3 suspend/resume work on my HP Z800 computers.

The PCBSD guys did some effort to take out or at least tame the worst suspend/resume breakers. This is one of the reasons why I use PCBSD on my laptop (which I use rarely and thus don't want to spend considerable time to configure).

S4 suspend/resume (i.e. hibernate) needs some additional functionality (swapping out the memory image and vice versa) that still has to be implemented. Like pm-utils or uswsusp on Linux do. Sadly this needs some knowledge of kernel programming which I do not have.

It would be a good-to-have thing for FreeBSD, too. Waking up from hibernate can be much faster than a cold boot, which could be useful for servers, too.


----------

