[RESPONDED] How to enable hibernate on Ubuntu?

I’m on Ubuntu 23.04 and I’m trying to enable hibernate (so I can use it instead of suspend, given how much suspend drains battery).

Everything I find online points to this thread to explain how to enable hibernate if it is not enabled on our system. However, this is way above my technical understanding–there is no easy step-by-step explanation on how to do it.

Has anyone does this on Ubuntu on the Framework? If so, how?

While we do not test or support it officially, this will probably get you going.
It’s quite involved (I’ve done it before on 12th gen), and it may lead to additional challenges if you miss a step.

1 Like

Just my 2 cent here.

I am not using the hibernate function on laptops with Linux anymore:

  • I use laptops with large RAM amount 32 or 64 GB ram. Means the SWAP space will have to be at least that large and IMHO, this is a waste of disk space.
  • The boot up process is very fast under Linux.

That was an issue with Windows taking ages to boot where hibernation was a thing.
If I’m on travel and working on some things, I just put it to sleep as I’ll continue 30 minutes later where I stopped.

As a counter point, being able to not have to open and position windows particular to your workflow is something I value. Hibernation works REALLY well on the 11th and 12th Frameworks that I own. It is just a matter of increasing the size of the swap file, updating grub, and adding the GUI elements back into Gnome.

Beyond this you now have several options when finished using your laptop. Suspend, hibernation, or power off.

Granted if your are sitting on 64gb of RAM your swap file will be huge, just kind of how hibernation works.

3 Likes

With how cheap fast storage got this isn’t really a concern. If you are fin with opening everything you need again every-time, good for you. If not hibernation is pretty amazing, especially for window hoarders like me XD.

1 Like

Confirming that this guide works very well. Simple or not, it depends on your context, but well worth it ! So much better for battery life, from finishing the day, until the next working morning, if you want to keep your windows and apps as they are. Also when on the go, between transportation and time when you can use your laptop, etc.

FrameWork 13, 12th Gen Intel, swap partition, Ubuntu 22.04.

1 Like

This is why I meant restart the session at logout.

What this does, as most KDE applications and Libreoffice are session-aware, they will all start and load the files they saved prior shutting down.
This is IMHO the clean way of doing things.

It is the clean way to do it and if all the applications you use support it good for you. I’ll just stick to the more brute force method that just works on everything.

Delighted to hear this. :slight_smile:

1 Like

Followed the guide, but needed to increase the swapfile size to 1.5x RAM size (16GB RAM => 24GB Swap) for it to actually work. For the initramfs I needed to set /swap.img and resume=0 since all else threw errors.

Delighted to finally have this working and be rid of anything holding me back from using my Ubuntu 24.04 install like I used Windows 11 on my Framework 13 Performance Machine.

I dumped windows 25 years ago actually.
And, back in the old days where booting up was an issue, I did so too.
Nowadays, I just make sure session are saved and shut down. Faster :}

thanks for it.

Hibernate now works.

I have issue with step-4 / Enable Hibernate option in Power-Off Menu

Blocked with the genuine menu, don’t see hibernate option appearing

If someone has any idea, that would be much appreciated

Hibernation writes data to a disk partition.
It can also be the swap file - problem is when the swap-file is on an encrypted device it won’t work here (at least last time I tried).
Note that the swap-partition needs to be of the same size (or a little larger) than the RAM you have on you device. Then, and I’m sorry I haven’t tested it in a loooong time, I don’t think you can encrypt the swap partition.

Then, and only then, can hibernation be enabled.

Swapfile on encrypted drive has been working quite well for a while (even with btrfs).

It doesn’t, the hibernate image gets compressed so you can get away with less (and will just fail to hibernate if it can’t fit), what you say is good practice though and storage is still much cheaper than ram XD.

You can but it’s a pain, which is why working encrypted swapfile hibernate is so nice.

I recommend against unencrypted hibernate as that writes very sensitive information to disk, especially in a portable device that may get stolen.

@Adrian_Joachim Thanks for the updates. I’ll have to update my data now :wink:
Even though SWAP was nice to have, I would recommend against it now.
And, as Linux is so fast booting, I wouldn’t hibernate anymore. Well, at least, that’s what I do.

It is still recommended to have it and on an encrypted drive it isn’t really a downside.

I don’t really care how fast it boots I want my stuff to be exactly how I left it which makes hibernate a killer feature.

2 Likes

Hi,

Without any changes that I am aware of, the hibernation resume fails on my FW 13, 12th Gen Intel, 22.04.5 LTS.

As I posted earlier on, in 2024 it worked very well, and has worked consistently until February 2026. [RESPONDED] How to enable hibernate on Ubuntu? - #10 by Matt_Hartley

What I have in the journal is:
$ journalctl -x --no-pager | grep hiber

[...]
Mar 29 20:07:08 FrameWork-Ubuntu kernel: PM: hibernation: Basic memory bitmaps created
Mar 29 20:07:08 FrameWork-Ubuntu kernel: PM: hibernation: Image mismatch: architecture specific data
Mar 29 20:07:08 FrameWork-Ubuntu kernel: PM: hibernation: Read 9778052 kbytes in 0.01 seconds (977805.20 MB/s)
Mar 29 20:07:08 FrameWork-Ubuntu kernel: PM: hibernation: Failed to load image, recovering.
Mar 29 20:07:08 FrameWork-Ubuntu kernel: PM: hibernation: Basic memory bitmaps freed
Mar 29 20:07:08 FrameWork-Ubuntu kernel: PM: hibernation: resume failed (-1)
Mar 29 20:07:13 FrameWork-Ubuntu gsd-media-keys[2546]:
[...]

I have double checked all the settings from the initial guide (which has been nicely updated for 24.04 too), and my config is fine.

Any ideas, please?

Actually, just by intuition, I unplugged the USB-c 3.2 connection to my external monitor, that provides with power and USB hub. THEN hibernate worked as expected!!

Now I have the same Dell monitor, same USB-C cable, same USB dongle (logitech mouse). So it could be a driver that changed. But this is out of my depth to look for that. I love Linux and Free software, but I am not a sysadmin or kernel/gnome expert :neutral_face:

I supposed I have to rebuild / re-install something ?

But that is enough for me today (I already completed the same hibernate setup on my wife PC Dell, with success, after boosting the laptop from Windows 10 to Ubuntu 22.04.5 too :wink:

Well, after half the afternoon, testing different things, her are my findings:

  • USB-c monitor, or even the U-Green Hub (USB-A, USB-C data, no video, Ethernet Gigabit): randomly worked or not
  • Uninstall “Extension Manager” v0.6.5 to avoid un-necessary headache
  • Starting also afresh, without any Gnome-shell extension (except the system one: Ubuntu Dock and AppIndicator)

1/ After dozens of Hibernate / resume, to test in each possible configuration (battery only, power from original Framework charger, monitor on USB-C data only no power supply, USB-C u-Green hub plugged) I come to the conclusion that the Hibernation works randomly at the moment.

2/ I need to check 2 options in the /etc/default/grub file:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash module_blacklist=hid_sensor_hub nvme.noacpi=1 resume=UUID=62e3f7fc-8d3c-45f7-b438-af31cf3b

What are:

  • module_blacklist=hid_sensor_hub

  • nvme.noacpi=1

I did not put them here when I set up Hibernation 2 years ago.

3/ I looked at the system logs, but there are too many things that I don’t understand to get a direction to look into.

I am posting them here if someone can have a look, please? You could spot something quickly :sweat_smile:

Gnome-logs > Boot.log > export

From 21:34:53, Resume hibernation failed
From 21:35:52, Resume hibernation worked

21:35:52 systemd: Stopped target System Hibernation.
21:35:52 systemd: Stopped target System Hibernation.
21:35:52 systemd: Reached target System Hibernation.
21:35:52 systemd: systemd-hibernate.service: Consumed 1.173s CPU time.
21:35:52 systemd: Finished Hibernate.
21:35:52 systemd: systemd-hibernate.service: Deactivated successfully.
21:35:52 kernel: PM: hibernation: hibernation exit
21:35:52 systemd-sleep: System returned from sleep state.
21:35:52 kernel: PM: hibernation: Basic memory bitmaps freed
21:35:27 systemd-sleep: Entering sleep state 'hibernate'...
21:35:27 kernel: PM: hibernation: hibernation entry
21:35:27 systemd: Starting Hibernate...
21:35:09 gsd-media-keys: Failed to grab accelerator for keybinding settings:hibernate
21:34:53 kernel: PM: hibernation: resume failed (-1)
21:34:53 kernel: Hibernate inconsistent memory map detected!
21:34:53 kernel: PM: hibernation: Basic memory bitmaps created

Export Important messages:

21:35:52 bluetoothd: src/device.c:set_wake_allowed_complete() Set device flags return status: Invalid Parameters
21:35:09 gdm-session-wor: GLib-GObject: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
21:35:07 systemd: Failed to start Application launched by gnome-session-binary.
21:35:07 gdm-session-wor: gkr-pam: unable to locate daemon control file
21:34:55 gnome-session-b: GLib-GIO-CRITICAL: g_bus_get_sync: assertion 'error == NULL || *error == NULL' failed
21:34:54 thermald: Unsupported conditions are present
21:34:53 bluetoothd: src/device.c:set_wake_allowed_complete() Set device flags return status: Invalid Parameters
21:34:53 avahi-daemon: chroot.c: open() failed: No such file or directory
21:34:53 kernel: cros-usbpd-charger cros-usbpd-charger.2.auto: Unexpected number of charge port count
21:34:53 kernel: Module hid_sensor_hub is blacklisted
21:34:53 kernel: PM: hibernation: Failed to load image, recovering.
21:34:53 kernel: Hibernate inconsistent memory map detected!
21:34:53 kernel: Module hid_sensor_hub is blacklisted

4/ I would like to add the syslog - partly filtered with 3 hibernate / resume cycles, but I don’t know how to attached it here (file type not supported), and it is very long. Any advice to post only what is useful would be appreciated :folded_hands:

(sorry, I mistyped a follow-up to my post, with more testing, and I wrongly hit the “Reply” button)

Could you give us a bit more details, like Ubuntu version, Gnome-shell version, other gnome-shell extensions installed?

I had side-effects in the past with some extensions, not-up-to date sometimes, or just conflicting with another piece of the system :sweat_smile: