Guide is forth coming for Ubuntu users, but here is a sneak peak at how I personally use hibernate on 11th gen - tested on 22.04.1 as working flawlessly on a vanilla CLEAN installation. I can not make promises for any tweaked/customized setups.
This will be part of a larger Knowledge Base article in the near future.
But this absolutely works, test after test. This guide is not official yet, but it’s coming and yes, it works on:
Ubuntu 22.04 unencrypted, 11th Gen Framework.
Suspend on Linux isn’t going to match Windows. And some modules will draw power even when in a deep suspend state.
There is a solution and it works very well. It’s called “suspend-then-hibernate” and once configured, is wonderful.
Now you’re going to be asked to paste in some things and also look for some things. It’s not difficult, but it will take you a few minutes to get set up.
The advantage is once configured, you can set a time to remain in deep suspend state for say, one hour. Mine is set for half an hour as I know myself if my Framework laptop isn’t used from a suspend state for 30 minutes, I want my laptop to be saved and then turned off (hibernate).
Then if the laptop is still untouched, it will then automatically go into hibernation mode which is powered off…but will remember your exact state it was suspended in. Since it’s saving this to
disk, it’s going to mean you won’t need to worry about draining the battery.
Let’s get started. Remember, you can simply copy and paste these commands into the terminal.
- First, let’s clear old swap file, if this is a default Ubuntu installation:
sudo swapoff -v /swapfile
Then:
sudo rm -f /swapfile
- Now create a new swapfile that is of this recommended size - yes, it’s large…but it means we know that it will remember to store anything you’re throwing at it.
sudo dd if=/dev/zero of=/swapfile count=37000 bs=1MiB
- Now let’s set up our new swapfile.
sudo chmod 600 /swapfile
Then:
sudo mkswap /swapfile
Then:
sudo swapon /swapfile
- Now let’s make sure the entry in fstab is correct.
sudo gedit /etc/fstab
If you’re seeing this below inside of your fstab (and you likely are):
/swapfile none swap sw 0 0
…then this file is ready to be saved. If you see no mention of /swapfile or something else referring to swap, please take a screenshot and refer it back to me for help.
Ordinarily on a default installation, it should be all set up like above already.
Now let’s get your boot up sequence ready for your new hibernation abilities.
- Let’s find the UUID via command using blkid. This will be the main drive, so look for the
drive with:
blkid
My results gave me a /dev/
device and then the UUID. We want to copy that UUID as follows:
Your UUID will have different numbers and letters, so just grab what appears in the similar format as above with a copy/paste.
-
Open a text file, paste in that UUID for later - we’re using it in a second.
-
Still with me? Great! Now let’s get the offset number.
sudo filefrag -v /swapfile
Scroll all the way back up to the top. See the image below? See the highlight? Your number will differ, but this is the number we want. Mine was 7802880. So look for yours, same location, copy it to that open note file I had you open previously.
Let’s add these changes to your grub boot up sequence.
We’re merely going to append the new details to the existing grub entry. It will not overwrite what was done previously.
Using your touchpad/mouse, simply highlight the bolded areas and replace them with the correct information reflecting your own configuration.
sudo sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT/ s/"$/
resume=UUID=b432a6a4-6663-45e6-9b4f-93eaf69ba9a0 resume_offset=7802880"/'
/etc/default/grub
The bold areas need to be replaced with your UUID and your offset that you pasted into that text
file from earlier.
Now that you’ve updated the above command with your UUID and your offset information, paste the newly changed command into the terminal and press enter.
With that done, you can now update grub.
sudo update-grub
And now reboot!
Awesome, so now after reboot…the nuts and bolts of getting suspend-then-hibernate are all set.
Now to get this working on 11th gen with the lid close, there is a bit more work to do. We’re almost done, though! Good news is the rest of this part is easy. In a terminal again:
sudo gedit /etc/systemd/sleep.conf
Ctrl F and look for:
#HibernateDelaySec=
Make sure to remove any # in front of it so it goes from:
#HibernateDelaySec=
Into:
HibernateDelaySec=
Also this is the cool part where you decide how long you’d like to suspend for. What this means is, how long you’d like the suspended state to run until it automatically goes to hibernation.
I usually recommend 30 minutes, but some people prefer 60 minutes before it slides out of the suspended state and goes to hibernation.
HibernateDelaySec=30min
Great, we’ve made our change. Let’s save the file.
- Now let’s make it work with the Framework Lid close.
sudo gedit /etc/systemd/logind.conf
Ctrl F to find HandleLidSwitch=
#HandleLidSwitch=suspend
Into (removing the # again):
HandleLidSwitch=suspend-then-hibernate
And save the file. Reboot.