Over the last six-or-so months, I’ve been testing different Linux distributions, but I’ve not been able to get hibernation to work properly on my eight year old Dell XPS 12 9Q23 with any of them. I’ve tried every suggestion I’ve found on the internet to solve the problem, but to no avail. When I installed Manjaro, however, all the planets suddenly aligned. Manjaro did not support hibernation on the Dell XPS 12 out of the box, but thanks to the Manjaro documentation, I was able to make it work.

Linux is an unpredictable animal, though, and even if this guide contains everything I had to do to get my Dell XPS 12 to hibernate, your milage may vary. I’ve also discovered that hibernation doesn’t work every time, and I have no idea why. Sometimes it helps to turn off Bluetooth, sometimes it helps to terminate a VirtualBox VM, and sometimes I just have to sacrifice a goat and retry a couple of times until it magically works again.

Before we being, here’s a word of advice: Keep in mind that you’re following a guide written by some rando on the internet. Weird and unexpected things might happen, and you of course take full responsibility for everything since you’re taking technical advice from a complete stranger. In a worst case scenario, you might render your Manjaro installation FUBAR, and you will not be able to boot. Recovering your system might not be possible. Consider yourself warned.

The guide assumes that you have a swap partition on your hard drive, and that you’re using GRUB as your boot loader. If that’s not the case - there’s a good chance you’re using a swap file instead of a swap partition - parts of this guide can be used, but you’ll also have to consult other guides on the internet. I’ll try my best to point you in the right direction when that’s necessary.

How To Enable Hibernation in Manjaro

In order to use hibernation, you will need to point the kernel to your swap partition, which is configured via the boot loader. You will also need to configure the initramfs. This tells the kernel to attempt resuming from the specified swap in early userspace. If you don’t have a swap partition yet, refer to the swap article on the ArchWiki for instructions on how to create one.

First, we need to know the location of your swap partition. Run the swapon command from a shell of your choice:

$ swapon

NAME      TYPE      SIZE USED PRIO
/dev/sda3 partition 7,7G 4,5G   -2

The name of the swap partition should be displayed. If the TYPE is not partition but file, you should skip this guide, and follow the instructions in the Power management/Suspend and hibernate - Hibernation article on the ArchWiki instead.

Next, we need to find the UUID of the swap partition:

$ sudo blkid

/dev/sda3: UUID="5d825bb9-1874-42f8-9b1d-1314709da5e6" TYPE="swap" PARTUUID="e96e2512-e351-408f-9677-ad82c3e27f5e"

Copy the UUID key/value pair without the quotes, in this case UUID=5d825bb9-1874-42f8-9b1d-1314709da5e6, and then open GRUB’s default configuration file in your favorite text editor. Personally, I prefer micro.

sudo micro /etc/default/grub

Find the line that begins with GRUB_CMDLINE_LINUX_DEFAULT and add resume= and the UUID key/value pair you copied earlier to the end of the line, but inside the quotes. Here’s an example of what the line in the GRUB configuration file might look like after you’ve edited it:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash apparmor=1 security=apparmor udev.log_priority=3 resume=UUID=5d825bb9-1874-42f8-9b1d-1314709da5e6"

Then regenerate the GRUB configuration with

sudo grub-mkconfig -o /boot/grub/grub.cfg

Next, we have to configure the initramfs. This is done by adding the resume hook in /etc/mkinitcpio.conf. Open the file with

sudo micro /etc/mkinitcpio.conf

Then find the line that begins with HOOKS and add resume somewhere after udev. Here’s an example of what the HOOKS line might look like after you’ve edited it:

HOOKS="base udev autodetect modconf block keyboard keymap plymouth filesystems resume"

Note that if you see systemd in the HOOKS line, a resume mechanism is already provided, meaning that you don’t have to add the resume hook.

If you did have to add the resume hook, the next thing to do is to regenerate the configuration:

sudo mkinitcpio -P

Then, resume hook or not, reboot your system:

reboot

After the reboot, you should be able to hibernate by running the following command:

systemctl hibernate

But, as I mentioned in the beginning of this guide, hibernate might not work for you even if it worked for me. And there can be any number of reasons why it’s not working. Troubleshooting is not in the scope of this guide, but you might have some luck with running journalctl and searching for relevant error messages there.

Good night, and good luck.

Sources