Enabling Hibernation on Linux Laptops

use a gimped picture of flapjack with my wretchedghost logo as flapjack and several other thinks like laptop brands as the whale and the other dude

After purchasing yet another second-hand laptop i have run several hurdles to get them Linux worthy and even that seemed to hard for some.

Why I do this to myself

Even when I have a setup that I enjoy my mind always wanders to what if there is something better. I would like my current laptop to be this or that, or I want a laptop to run for days without charging but also be super light and well, the list goes on.

This has brought me to the plethora of devices that I have purchased. I will present them here and give them a score for their Linux-worthiness, yes that is a word, and I just coined it.

In order by purchase:

  1. System76 Darter Pro - 15.6" 300-350 nits, i7 8th gen CPU, 16GB RAM,
  2. Lenovo Chromebook C… - 15.6" 250-300 nits, Celeron processor (Got it during Covid for my daughter, then when she went back to school I hacked it and removed all traces of ChromeOS and installed Arch on it).
  3. Macbook Air M1 - Broke (I broke it by deleting the boot drive twice and I was tired of having to go to the Mac store just to get it fixed).
  4. Lenovo X1 Extreme - 400-500 nits, Sold
  5. Dell XPS 13 9315 - 13" 500 nits, (The system I am currently writing on)
  6. Razr 14 2023 - 14" 500 nits, Broke (It overheated and started to produce graphical glitches and artifacts, and never powered up again).
  7. Lenovo X1 Carbon Gen 8 - 14" 400 nits, (Great machine. Will hold its battery for weeks when hibernating, battery does drop quite when running, and tends to get hot quickly with fans running most of the time while on to compensate).
  8. Lenovo Legion 7 - 16" 500 nits, AMD CPU RTX 3080 GPU (Get really hot but I then purchased a dedicated laptop cooler and the device has been working flawlessly).
  9. LG Gram 17z90n - 17" 400 nits (I love the screen size but that is where the positive review stops. The keyboard is not great as one out of every 10-20 presses it doesn’t recognize the character being pressed, unless you type very slowly then it will work fine. The battery just doesnt exist and doesnt charge on Linux period. It will be recognized and show the value of the battery percentage when the boot-loader ran but it will never show the current value. Believe me I have tried everything and have spend days and many hours just to get that one thing to work. Plugged in, and with a decent charge the laptop works fine, but if it has a low percentage at boot, it will run in a low power mode where it reminds me of the days running the OS on a HDD. Even when plugged into power, the battery will not hold a charge and will remain at whatever percentage it was at boot. On Windows it works and functions normal like any laptop should but any Linux distro suffers from some baked in code HP built).
  10. Dell XPS 15 9500 - 15.6" 500 nits, i7, 16GB RAM, dual NVMe slots, 8X watt power supply (This laptop took a little work for it to be Linux-worthy but after getting it running and disabling the GPU, this laptop runs phenominally. There are some critiques such as with Dell XPS laptops of that generation where the keys feel shifted more to the right meaning I will have to move my left hand more to the right than feels natural to type. Once moved though its fine. The trackpad is huge and if I may say, too huge. The laptop is quite hefty. Its really heavy and it almost feels like it shouldnt be that heavy but they wanted a Mac-style one-handed open lid function which required it to be heavier than it otherwise would be. It does get hot but I found someone online who put a whole bunch of thermal pad all over the inside of the laptop, and well that seemed to work quite nicely. The fingerprint button works great and battery life to me seems to work well for 8-10 hours on normal simple usage).
  11. Dell XPS 13 9380 - 13" 500 nits (Currently used as the desktop at my parent’s house running ElementaryOS)

From my old draft what is the deal with suspend and hibernation on modern laptops

Dude why is suspend and hibernate on modern laptops such a hit or miss on Linux?!!

I have a tradition that I’ve been doing for a few years now. Everytime I receive my yearly Christmas bonus I look into getting another piece of hardware, whether it be a laptop, a component for my servers or my workstation, or HDDs. In this case it was another laptop. One more to the many that I already have. I don’t need another laptop but my desire to find the perfect laptop is the driving force for this newest purchase.

My current situation

I know that a perfect laptop doesn’t exist. To get the right size of laptop to do multiple funtions. To be bright enough in daylight conditions. Keyboard has to be a step aboce decent, I’m not super picky with a keyboard. Touchpad is actually where I prefer a little extra funtionality or sensitivity due to using a Rugged Extreme Dell laptop that seems like its designed for dirt and grime and to be used with gloves. Its a very poor touchpad experience. And my most important and highest gripe is battery life. I don’t like using a laptop for an hour or two then immediately see the battery go from 80% or 60% down to 30% or less. But even more painful than that is getting the laptop to stay alive when the lid is closed.

Over the years I’ve had many laptops and desktops. My desktops never are suspended or put into sleep mode other than the monitors. They are either on or off. Laptops on the the other hand, need to be ready to go at a moments notice. For the most part my laptops perform well in suspend for the most part but never quite what I want and expect.

What laptops I currently have and why they don’t fully fit the bill

Starting out I’ll rate my laptops from newest to oldest and how functional they are for me. These laptops may be great for certain workloads or functional in this niche which is most likely what gravitated me towards them in the first place but each one has a hang-up that keeps me looking for something better.

  1. Razer Blade 14 (2023) Ryzen 9 7940HS RTX 4070 Mercury White Edition- I bought this as a gaming laptop. It come with Windows 11, I downgraded it to Window 10, which is actually an upgrade in my opinion. I use it almost exclusively for gaming.
  2. Dell XPS 9315 13.4" i5-1230U 1.0GHz 8GB RAM 512GB - I bought this due to it being a good price but also for the fact that online it was shown to be a great laptop. It is a great laptop, I love the high 500 nits, and compact-ness of the laptop. I also really like the keyboard, which the newest XPS laptops seems to excel at. I do not like the fact that it will not suspend-to-RAM which has made me have to use Hibernation only when the lid is closed. This means I have to go through the entire boot cycle and entering in my LUKS password everytime I re-open my laptop.
  3. System 76 Darter Pro (Darp5) 2018 - This purchase at the time was the most expensive laptop I have ever bought at $1,800 and it was a workhorse. It was the first computer I ever ran Gentoo on for any considerable amount of time and it was a beast. The only thing it lacked was suspend-to-RAM support even though s2idle and deep are supported. I had to do the same with my Dell XPS and set it to hibernate.
  4. Lenovo N4000 Chromebook - Functions almost as good as it did when running the ChromeOS software. The suspend-to-RAM works for weeks without losing barely if any battery percentage. The laptop is a decent size and the screen brightness is OK. The build quality is lacking and cheap. The left Ctrl button sticks all the time even though I have cleaned it out several times.
  5. Macbook M1 Air - Runs Asahi Linux.
  6. Dell XPS 13 9380 Windows 11 Intel Core i5-8365U 1.60GHz 8GB RAM 512GB SSD 13.3" - Another 8th Gen CPU with the same issues as the new XPS 9315. No suspend-to-RAM. The design on this laptop is good and the keyboard, although not as great as the new XPS versions, works well. The brightness is 300 nits.
  7. Dell Alienware 17r5 - Got this in a trade. My daughter uses it for gaming and homework. Runs Windows due to Roblox requirements. Boo
  8. Dell Latitide 4th Gen i3 CPU - Functions exceptionally well. Runs Linux Mint and suspends-to-RAM as good as my chromebook.

Between all of these laptops, not one is my ideal laptop. Each have great pros and cons as with any device but I’m like Doctor Evil, why can’t I have freaking sharks with laser beams attached to their heads? /images/laptop/doctor-evil.gif

After all of this research I found a ton of information on the sleep states and how hibernation and suspend work, especially with LUKS encryption.

Hibernation/Sleep Levels (S-States)

s0 (Working/On) - Normal operation. s0ix (Modern Sleep) - Found on most modern laptops. Also functions with s2idle or Suspend-to-idle which offers low power mode with quick resume. s1 (Sleep) - CPU stops, RAM stays powered on, but uses less power than s0. s2 (Sleep) - CPU power off, RAM stays powered on. Deeper sleep than s1. s3 (Suspend-to-RAM / Standby / Deep) - Mostly powered off, RAM stays powered on, fast resume, great battery life) My preferred but harder to find devices that support this after the Intel gen 10 series. Gen 11 onward usually only have sxi0. s4 (Hibernate / Suspend-to-Disk) - All power off, RAM content is saved to disk (swap), slowest resume which goes through the entire boot cycle, zero power use. The current way to get hibernation to work on Linux devices that do not support s3 anymore. Provides a very efficient hibernation that does not drain battery if at all but requires the system to completely boot up again. If you have LUKS encryption enabled at boot time you will be required to type in your password every time it wakes from s4. This is the current way I have on my Dell 9315. Not my ideal but functions well enough. s5 (Off) - Full Shutdown.

These S-States determine what your computer or laptop is currently at. As mentioned above, s3, s4, and s0ix are the most commonly used. S0ix is an outlier in Linux due to it not really working right, or maybe its working exactly how Windows intended it to work on Linux. :shrug:

The s3 has been the hardest to reach in this modern day hardware. Laptops that should have been designed to work due to Intel doing weird stuff and ending support on drivers and firmware, but then brought back a generation later or so. Some laptops have even begin to offer a “Windows” sleep state and a “Linux” sleep state in the BIOS. Choose the Linux one if you value your battery when running Linux of course.

Even within the computer space your computer may not be able to run in the sleep state you’d expect it to run in. You can check what your system has available by running this command below:

cat /sys/power/mem_sleep 
s2idle, shallow, deep

In this example we see three options. s2idle, shallow, and deep. s2idle is s2, meaning its basically s0ix. It will sleep quickely but wont really save too much on battery. Effiicient for commute times but not overnight. shallow is s1 sleep. Its basically like turning your monitor off. There is more to it than that but for the most part it’ll drain your battery quite effectively. deep is the ideal and my most saught after state. Even from laptops that offer it like my System 76 Darter Pro (darp5) (2018) running on a Intel Gen 8 CPU, sleep-to-RAM or s3 doesn’t do to great. Leaving it overnight will cause the battery to drain by 10% or more. It could be due to the older battery that is in it but when using it laptop. It doesn’t appear to justify the sharp drop off battery if it was infact suspened-to-RAM. Powering off the laptop completely allows the battery to virtually not drain much over the course of a few days so I think it has something to do more with the laptop and firmware than the battery itself.

You can also set the state manually but will be lost after a reboot by running this below but I have not messed with much since my systems will default to the best option it can: echo deep > /sys/power/state or ehco s2idle > /sys/power/state

Finally we can talk about s4. This options apart from s5 does offer the best life on your battery. On my Dell 9315 XPS, this is option I use due to the Intel 12th Gen lack of a Linux sleep state in the BIOS or in the system. It only has the option for s2idle AKA s0ix. Due to this the battery would drain horrendously quickly when the lid was closed. This laptop under s4 works really well but takes 30 seconds or so to boot up to the desktop environment. I do have LUKS encryption setup so due to this it probably adds on a good 5-10 seconds, but I can’t image using a modern laptop without encryption anymore. I do praise the Dell XPS 9315 for being a well built laptop with a bright screen and great keyboard that requres very little travel and the clicks are satisfiying. But if you don’t enable s4 its not going to be a hugely fun experience in the Linux world unfortunately. Perhaps I explain more about this laptop specifically in another post.

Now to the laptop that does virutally everything I need

My latest laptop purchase is a Lenovo X1 Carbon Gen 8. I can see why now why people love the carbon series so much. I owned a X1 Extreme Gen 3 or Gen 4, I think it was Gen 4, but due to the fact that the GPU (Nvidia RTX 3070) was tied to the HDMI port and other weird quirks on it, getting Linux on it was nigh impossible nor enjoyable. I sold it real quicly.

The X1 Carbon, on the other hand, is great. Mine came with a 4K screen which I really didn’t want but I have set it to run at 2.5K via arandr and the dpi settings in .Xresources is set to 145 just to make everything visible. Rofi plays weird with the 4K screen making everything not to scale but I need to tweak more things to get my i3 and Arch, BTW build complete.

Back to the battery life, this computer does have some weird issues or features. For one it will enter into s3 state and lose 1% battery overnight. Exaclty what I’ve been wanting from a laptop. The strange thing is, is there is a flashing red light on the thinkpad logo on the laptop lid and a flashing white light on the side power button that will flash every 5 seconds or so forever when in s3 state. I thought for sure this would kill the battery more but maybe that is what causes it to drain 1% overnight. I’ve looked at ways to disable the light and found one section in the X1 Carbon Gen 7 page in the Arch Wiki but when I ran the command it said to run the red light stayed on indefinelty until I rebooted the computer. So i wont be running that command again.

Overall this is the experience I’d exect to have in 2026. Why more modern laptops dont offer this is a shame and maybe in the future they will, with people who do the amazing leg work get them working but until then, owning a laptop and having it run like you’d expect it to is a crap-shoot. My word of advice would be do your research and don’t be afraid to try different things on the devices you own.

Tips to get a little more battery on your laptop hardware-wise

Did you know that your super fast and large-sized NVMe drive chews up more battery than a slower/lower-end NVMe stick. Same thing goes with the large and fast RAM DIMMs. Getting a system with a i5 or i3 will also increase the battery life compared to a i7 and especially a i9.