Hibernation on Lenovo ThinkPad T14 Arch Linux
1. BIOS Setting: Enable Linux S3 Sleep
- Reboot and enter BIOS (
Enteron Lenovo T14). - Go to Power → Sleep.
- Set Sleep State to Linux S3.
- Save and exit.
2. Check Deep Sleep Support
cat /sys/power/mem_sleep
- Example output:
s2idle [deep] deepis required for hibernation.
3. Create a Swap File
If your swap partition is as large as your RAM, this is not necessary.
For 16 GB RAM, a 16–18 GB swap file is recommended:
sudo fallocate -l 16G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile
Check it:
swapon --show
Make it permanent in /etc/fstab:
/swapfile none swap sw 0 0
4. Find Swap File Offset and Device
The kernel needs to know:
- Underlying device of the filesystem containing
/swapfile:
df /swapfile
- Example output:
Filesystem 1K-blocks Used Available Use% Mounted on /dev/nvme0n1p2 488281250 1234567 487000000 1% /
-
Here, the root device is
/dev/nvme0n1p2. -
Swap file offset (in 4 KiB blocks) using
filefrag:
sudo filefrag -v /swapfile | head -n 4
-
Look at the physical offset of the first extent (column
physical_offsetof the first line). -
Multiply by 4096 if your kernel boot parameter needs bytes, or use the number directly if it expects 4 KiB blocks.
-
Example:
5324800.
5. Configure Kernel Boot Parameters for Resume
When booting the kernel via EFI directly, you need:
resume=/dev/nvme0n1p2 resume_offset=5324800
resume=→ the device containing your swap file.resume_offset=→ offset of the swap file.
Check current EFI entries:
sudo efibootmgr
- Modify the entry to add the parameters:
efibootmgr \
-c \
-d /dev/nvme0n1 \
-p 1 \
-L "Arch Linux" \
-l '\vmlinuz-linux' \
-u "root=UUID=6c224d0d-80f2-4e70-925a-459b50344859 rw resume=UUID=6c224d0d-80f2-4e70-925a-459b50344859 resume_off
set=5324800 initrd=\initramfs-linux.img"
- Replace 6c224d0d-80f2-4e70-925a-459b50344859 with the UUID of your root partition.
6. Test Hibernation
- Ensure swap is active:
swapon --show
- Trigger hibernation:
sudo systemctl hibernate
- Laptop should save RAM to swap and power off.
- On boot, it should resume your session.
-
It is pretty obvious if this worked.
-
Check logs:
journalctl | grep -i resume
7. Debugging Tips
| Issue | Check / Fix |
|---|---|
| Laptop doesn’t power off | Confirm BIOS is Linux S3 and cat /sys/power/mem_sleep shows deep. |
| Resume fails | Ensure resume= points to the correct device and resume_offset= matches swap file first extent. |
| Swap too small | Swap ≥ RAM (16 GB → 16–18 GB). |
| Kernel doesn’t recognize swap | Re-run mkswap /swapfile and swapon /swapfile. |
This ensures the swap file is hibernate-ready even without a dedicated swap partition.