Enabling Hibernate on Ubuntu 19.04 Disco Dingo

So I decided to migrate my ThinkPad X230 from Ubuntu 18.04 to the newly released Ubuntu 19.04, codenamed “Disco Dingo”. To get Disco (or any recent, SystemD-ladden Ubuntu releases) to play nice with hibernate, you need to plan ahead.

  1. Prepare swap partition. In the installation process, prepare and create a swap partition as large as the system’s RAM. My X230 has 16GB and that would be the size for my swap partition. The easiest way to do this is by creating one when you install your system. On “Installation type” select “something else” to create custom partition configuration.

    And create a swap partition the size of the system RAM

    Or resizing your existing storage to accommodate the swap partition. As a last resort, you can opt to use a swap file

  2. Check whether hibernate is supported. Do
    surfer@M5-X230:~$ cat /sys/power/state
    freeze mem disk

    …If disk is listed, then your system support hibernate

  3. Update grub to point to the swap partition on resume. Get the location of your swap partition:
    surfer@M5-X230:~$ grep swap /etc/fstab 
    # swap was on /dev/sda1 during installation
    UUID=14cee2ec-9d37-4ac0-b594-eae0e55814aa none swap sw 0 0

    Open /etc/default/grub

    surfer@M5-X230:~$ sudo nano /etc/default/grub




    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=14cee2ec-9d37-4ac0-b594-eae0e55814aa"

    Save, and update the grub config

    surfer@M5-X230:~$ sudo update-grub

    Configure the initramfs

    sudo nano /etc/initramfs-tools/conf.d/resume

    Update to:

  4. Re-enable Hibernate menu. Update the policy kit
    sudo nano /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

    Copy paste the following value and save the file

    [Re-enable hibernate by default in upower]
    [Re-enable hibernate by default in logind]
  5. Configure Lid switch actions. If you want the laptop to automatically enter hibernation when you close the lid, we need to configure them here:
    sudo nano /etc/systemd/logind.conf

    The file contains several action that can be configured during login process. The one that is relevant for our purposes is:


    Uncomment and modify it to


    Additonally, if you own a laptop dock and you would like to be able to use your laptop when it’s connected to an external monitor while the lid is closed, uncomment:




    …and save the file. Restart the systemd logind service

    surfer@M5-X230:~$ sudo systemctl restart systemd-logind.service
  6. Test out hibernating. You can try hibernate your machine by doing
    surfer@M5-X230:~$ sudo systemctl hibernate

10 Comments Add yours

  1. John Pepper says:

    This worked for me for one time only and then went back to failing. Is any body ever going to sort hibernate on Ubuntu. The same hardware hibernates successfully on other operating systems and did with Ubuntu up to 16.04.

    1. ikhsan says:

      Would you mind sharing your hardware configuration? Are you using lid action to initiate hibernate and resume? This is working fine so far with my X230

  2. John Pepper says:

    It’s not a laptop. Desktop with two internal drives with different operating systems, using grub to select. Both drives have own swap partition. Correct partition is selected for resume. Usually hard boots after hibernate, but recovered correctly just once after following above procedure. I used to have hibernate option in the settings power screen, but no longer.

  3. Tomasz Samsel says:

    Works like a charm for me. Thank you very much for sharing. I seen other tutorials, and issue seams to be always with configuring resume partition correctly, but first one i see with lid action etc. Very complete. Thanks again.

  4. kazuaro says:

    Thanks, I finally have hibernate working on my laptop with a dead battery.

  5. Leo Germani says:

    In the code on item 4 there is a truncated line.

    The content of that line should be:


    1. ikhsan says:

      Fixed, thanks!

  6. I’d be super curious (and thankful, frankly) to see an update of this post for 2020 and with using POPOS/Ubuntu where they are not using grub any longer and have switch ed to systemd (I know POPOS went through a lot of trouble to make systemd switch, but it looks like it has invalidated a whole range of super useful blog posts on getting hibernate and suspend-then-hibernate working. :-/ ).

    Please ping me @awws on twitter if you do do this. (or know how…).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.