Hibernate not working in 18.04












1















When I use the command sudo systemctl hibernate, the system seems to go to hibernation, but when restarted, it is a fresh start without any of the previous windows that were left open.



And when I tried sudo pm-hibernate it says sudo: pm-hibernate: command not found.



Here is my drive configuration if that helps:



/dev/sda = SSD with Windows 10 only (Windows C drive and the reserved partition).



/dev/sdb = HDD with NTFS and EXT4 partitions containing regular data only, no OS here currently.



/dev/sdc = SSD (GPT partition) with Ubuntu 18.04 (/ partition), swap area and a shared NTFS game drive.



GRUB is installed on /dev/sda.



EDIT:
I created a new parition table on /dev/sdc using msdos instead of GPT. Then I reinstalled Ubuntu and installed GRUB on /dev/sdc. After these changes, sudo hibernate seems to be working.



ANOTHER EDIT:
Because sudo hibernate seems to go to hibernation without locking the screen (i.e. anyone could turn on the PC and automatically be logged in), I added this line to /etc/sudoers (cln is my username):



cln ALL=NOPASSWD: /usr/sbin/hibernate


and made this executable script:



#!/bin/bash

xdg-screensaver lock
sudo hibernate


Now I am able to just double-click on this script, select Run, and directly go to hibernation while also locking the screen. Much more comfortable.










share|improve this question





























    1















    When I use the command sudo systemctl hibernate, the system seems to go to hibernation, but when restarted, it is a fresh start without any of the previous windows that were left open.



    And when I tried sudo pm-hibernate it says sudo: pm-hibernate: command not found.



    Here is my drive configuration if that helps:



    /dev/sda = SSD with Windows 10 only (Windows C drive and the reserved partition).



    /dev/sdb = HDD with NTFS and EXT4 partitions containing regular data only, no OS here currently.



    /dev/sdc = SSD (GPT partition) with Ubuntu 18.04 (/ partition), swap area and a shared NTFS game drive.



    GRUB is installed on /dev/sda.



    EDIT:
    I created a new parition table on /dev/sdc using msdos instead of GPT. Then I reinstalled Ubuntu and installed GRUB on /dev/sdc. After these changes, sudo hibernate seems to be working.



    ANOTHER EDIT:
    Because sudo hibernate seems to go to hibernation without locking the screen (i.e. anyone could turn on the PC and automatically be logged in), I added this line to /etc/sudoers (cln is my username):



    cln ALL=NOPASSWD: /usr/sbin/hibernate


    and made this executable script:



    #!/bin/bash

    xdg-screensaver lock
    sudo hibernate


    Now I am able to just double-click on this script, select Run, and directly go to hibernation while also locking the screen. Much more comfortable.










    share|improve this question



























      1












      1








      1








      When I use the command sudo systemctl hibernate, the system seems to go to hibernation, but when restarted, it is a fresh start without any of the previous windows that were left open.



      And when I tried sudo pm-hibernate it says sudo: pm-hibernate: command not found.



      Here is my drive configuration if that helps:



      /dev/sda = SSD with Windows 10 only (Windows C drive and the reserved partition).



      /dev/sdb = HDD with NTFS and EXT4 partitions containing regular data only, no OS here currently.



      /dev/sdc = SSD (GPT partition) with Ubuntu 18.04 (/ partition), swap area and a shared NTFS game drive.



      GRUB is installed on /dev/sda.



      EDIT:
      I created a new parition table on /dev/sdc using msdos instead of GPT. Then I reinstalled Ubuntu and installed GRUB on /dev/sdc. After these changes, sudo hibernate seems to be working.



      ANOTHER EDIT:
      Because sudo hibernate seems to go to hibernation without locking the screen (i.e. anyone could turn on the PC and automatically be logged in), I added this line to /etc/sudoers (cln is my username):



      cln ALL=NOPASSWD: /usr/sbin/hibernate


      and made this executable script:



      #!/bin/bash

      xdg-screensaver lock
      sudo hibernate


      Now I am able to just double-click on this script, select Run, and directly go to hibernation while also locking the screen. Much more comfortable.










      share|improve this question
















      When I use the command sudo systemctl hibernate, the system seems to go to hibernation, but when restarted, it is a fresh start without any of the previous windows that were left open.



      And when I tried sudo pm-hibernate it says sudo: pm-hibernate: command not found.



      Here is my drive configuration if that helps:



      /dev/sda = SSD with Windows 10 only (Windows C drive and the reserved partition).



      /dev/sdb = HDD with NTFS and EXT4 partitions containing regular data only, no OS here currently.



      /dev/sdc = SSD (GPT partition) with Ubuntu 18.04 (/ partition), swap area and a shared NTFS game drive.



      GRUB is installed on /dev/sda.



      EDIT:
      I created a new parition table on /dev/sdc using msdos instead of GPT. Then I reinstalled Ubuntu and installed GRUB on /dev/sdc. After these changes, sudo hibernate seems to be working.



      ANOTHER EDIT:
      Because sudo hibernate seems to go to hibernation without locking the screen (i.e. anyone could turn on the PC and automatically be logged in), I added this line to /etc/sudoers (cln is my username):



      cln ALL=NOPASSWD: /usr/sbin/hibernate


      and made this executable script:



      #!/bin/bash

      xdg-screensaver lock
      sudo hibernate


      Now I am able to just double-click on this script, select Run, and directly go to hibernation while also locking the screen. Much more comfortable.







      dual-boot grub2 18.04 swap hibernate






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 3 at 10:52







      CluelessNoob

















      asked Oct 27 '18 at 9:41









      CluelessNoobCluelessNoob

      90021422




      90021422






















          1 Answer
          1






          active

          oldest

          votes


















          2














          This instruction worked for my Ubuntu 18.04 installation.





          1. sudo apt install hibernate It will install hibernate and other dependencies which are needed to hibernate


          2. grep swap /etc/fstab (find UUID)


          3. sudoedit /etc/default/grub
            At the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" add UUID of swap. The line looks like this GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID of swap"


          4. sudo update-grub

          5. Restart, and after restart sudo systemctl hibernate. If everything works ok add menu entry's.

          6. sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
            now paste this:



          [Re-enable hibernate by default in upower] Identity=unix-user:*
          Action=org.freedesktop.upower.hibernate ResultActive=yes [Re-enable
          hibernate by default in logind] Identity=unix-user:*
          Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
          ResultActive=yes





          1. Restart the computer

          2. Install https://extensions.gnome.org/extension/755/hibernate-status-button/






          share|improve this answer


























          • Tried till step 5. Not working. The GRUB line is this: GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1 resume=<UUID>" Is there anything wrong with this, or need I use the exact line you said (with quiet splash)? Also, this is shown when used grep swap /etc/fstab: # swap was on /dev/sdb2 during installation Is that anything to be concerned about?

            – CluelessNoob
            Oct 27 '18 at 10:58













          • Update: I tried with quiet splash resume=<UUID> instead, but still didn't work.

            – CluelessNoob
            Oct 27 '18 at 11:13













          • My grub GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=32564c12-47c9-449c-8fe3-d4ce2e170803" My fstab: # swap was on /dev/sda5 during installation UUID=32564c12-47c9-449c-8fe3-d4ce2e170803 none swap sw 0 0

            – Krzysztof Swiatly
            Oct 27 '18 at 15:50











          • Updated the question.

            – CluelessNoob
            Dec 22 '18 at 12:26











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1087685%2fhibernate-not-working-in-18-04%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          This instruction worked for my Ubuntu 18.04 installation.





          1. sudo apt install hibernate It will install hibernate and other dependencies which are needed to hibernate


          2. grep swap /etc/fstab (find UUID)


          3. sudoedit /etc/default/grub
            At the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" add UUID of swap. The line looks like this GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID of swap"


          4. sudo update-grub

          5. Restart, and after restart sudo systemctl hibernate. If everything works ok add menu entry's.

          6. sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
            now paste this:



          [Re-enable hibernate by default in upower] Identity=unix-user:*
          Action=org.freedesktop.upower.hibernate ResultActive=yes [Re-enable
          hibernate by default in logind] Identity=unix-user:*
          Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
          ResultActive=yes





          1. Restart the computer

          2. Install https://extensions.gnome.org/extension/755/hibernate-status-button/






          share|improve this answer


























          • Tried till step 5. Not working. The GRUB line is this: GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1 resume=<UUID>" Is there anything wrong with this, or need I use the exact line you said (with quiet splash)? Also, this is shown when used grep swap /etc/fstab: # swap was on /dev/sdb2 during installation Is that anything to be concerned about?

            – CluelessNoob
            Oct 27 '18 at 10:58













          • Update: I tried with quiet splash resume=<UUID> instead, but still didn't work.

            – CluelessNoob
            Oct 27 '18 at 11:13













          • My grub GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=32564c12-47c9-449c-8fe3-d4ce2e170803" My fstab: # swap was on /dev/sda5 during installation UUID=32564c12-47c9-449c-8fe3-d4ce2e170803 none swap sw 0 0

            – Krzysztof Swiatly
            Oct 27 '18 at 15:50











          • Updated the question.

            – CluelessNoob
            Dec 22 '18 at 12:26
















          2














          This instruction worked for my Ubuntu 18.04 installation.





          1. sudo apt install hibernate It will install hibernate and other dependencies which are needed to hibernate


          2. grep swap /etc/fstab (find UUID)


          3. sudoedit /etc/default/grub
            At the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" add UUID of swap. The line looks like this GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID of swap"


          4. sudo update-grub

          5. Restart, and after restart sudo systemctl hibernate. If everything works ok add menu entry's.

          6. sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
            now paste this:



          [Re-enable hibernate by default in upower] Identity=unix-user:*
          Action=org.freedesktop.upower.hibernate ResultActive=yes [Re-enable
          hibernate by default in logind] Identity=unix-user:*
          Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
          ResultActive=yes





          1. Restart the computer

          2. Install https://extensions.gnome.org/extension/755/hibernate-status-button/






          share|improve this answer


























          • Tried till step 5. Not working. The GRUB line is this: GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1 resume=<UUID>" Is there anything wrong with this, or need I use the exact line you said (with quiet splash)? Also, this is shown when used grep swap /etc/fstab: # swap was on /dev/sdb2 during installation Is that anything to be concerned about?

            – CluelessNoob
            Oct 27 '18 at 10:58













          • Update: I tried with quiet splash resume=<UUID> instead, but still didn't work.

            – CluelessNoob
            Oct 27 '18 at 11:13













          • My grub GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=32564c12-47c9-449c-8fe3-d4ce2e170803" My fstab: # swap was on /dev/sda5 during installation UUID=32564c12-47c9-449c-8fe3-d4ce2e170803 none swap sw 0 0

            – Krzysztof Swiatly
            Oct 27 '18 at 15:50











          • Updated the question.

            – CluelessNoob
            Dec 22 '18 at 12:26














          2












          2








          2







          This instruction worked for my Ubuntu 18.04 installation.





          1. sudo apt install hibernate It will install hibernate and other dependencies which are needed to hibernate


          2. grep swap /etc/fstab (find UUID)


          3. sudoedit /etc/default/grub
            At the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" add UUID of swap. The line looks like this GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID of swap"


          4. sudo update-grub

          5. Restart, and after restart sudo systemctl hibernate. If everything works ok add menu entry's.

          6. sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
            now paste this:



          [Re-enable hibernate by default in upower] Identity=unix-user:*
          Action=org.freedesktop.upower.hibernate ResultActive=yes [Re-enable
          hibernate by default in logind] Identity=unix-user:*
          Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
          ResultActive=yes





          1. Restart the computer

          2. Install https://extensions.gnome.org/extension/755/hibernate-status-button/






          share|improve this answer















          This instruction worked for my Ubuntu 18.04 installation.





          1. sudo apt install hibernate It will install hibernate and other dependencies which are needed to hibernate


          2. grep swap /etc/fstab (find UUID)


          3. sudoedit /etc/default/grub
            At the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" add UUID of swap. The line looks like this GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID of swap"


          4. sudo update-grub

          5. Restart, and after restart sudo systemctl hibernate. If everything works ok add menu entry's.

          6. sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
            now paste this:



          [Re-enable hibernate by default in upower] Identity=unix-user:*
          Action=org.freedesktop.upower.hibernate ResultActive=yes [Re-enable
          hibernate by default in logind] Identity=unix-user:*
          Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
          ResultActive=yes





          1. Restart the computer

          2. Install https://extensions.gnome.org/extension/755/hibernate-status-button/







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Oct 27 '18 at 15:43

























          answered Oct 27 '18 at 9:55









          Krzysztof SwiatlyKrzysztof Swiatly

          724




          724













          • Tried till step 5. Not working. The GRUB line is this: GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1 resume=<UUID>" Is there anything wrong with this, or need I use the exact line you said (with quiet splash)? Also, this is shown when used grep swap /etc/fstab: # swap was on /dev/sdb2 during installation Is that anything to be concerned about?

            – CluelessNoob
            Oct 27 '18 at 10:58













          • Update: I tried with quiet splash resume=<UUID> instead, but still didn't work.

            – CluelessNoob
            Oct 27 '18 at 11:13













          • My grub GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=32564c12-47c9-449c-8fe3-d4ce2e170803" My fstab: # swap was on /dev/sda5 during installation UUID=32564c12-47c9-449c-8fe3-d4ce2e170803 none swap sw 0 0

            – Krzysztof Swiatly
            Oct 27 '18 at 15:50











          • Updated the question.

            – CluelessNoob
            Dec 22 '18 at 12:26



















          • Tried till step 5. Not working. The GRUB line is this: GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1 resume=<UUID>" Is there anything wrong with this, or need I use the exact line you said (with quiet splash)? Also, this is shown when used grep swap /etc/fstab: # swap was on /dev/sdb2 during installation Is that anything to be concerned about?

            – CluelessNoob
            Oct 27 '18 at 10:58













          • Update: I tried with quiet splash resume=<UUID> instead, but still didn't work.

            – CluelessNoob
            Oct 27 '18 at 11:13













          • My grub GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=32564c12-47c9-449c-8fe3-d4ce2e170803" My fstab: # swap was on /dev/sda5 during installation UUID=32564c12-47c9-449c-8fe3-d4ce2e170803 none swap sw 0 0

            – Krzysztof Swiatly
            Oct 27 '18 at 15:50











          • Updated the question.

            – CluelessNoob
            Dec 22 '18 at 12:26

















          Tried till step 5. Not working. The GRUB line is this: GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1 resume=<UUID>" Is there anything wrong with this, or need I use the exact line you said (with quiet splash)? Also, this is shown when used grep swap /etc/fstab: # swap was on /dev/sdb2 during installation Is that anything to be concerned about?

          – CluelessNoob
          Oct 27 '18 at 10:58







          Tried till step 5. Not working. The GRUB line is this: GRUB_CMDLINE_LINUX_DEFAULT="cgroup_enable=memory swapaccount=1 resume=<UUID>" Is there anything wrong with this, or need I use the exact line you said (with quiet splash)? Also, this is shown when used grep swap /etc/fstab: # swap was on /dev/sdb2 during installation Is that anything to be concerned about?

          – CluelessNoob
          Oct 27 '18 at 10:58















          Update: I tried with quiet splash resume=<UUID> instead, but still didn't work.

          – CluelessNoob
          Oct 27 '18 at 11:13







          Update: I tried with quiet splash resume=<UUID> instead, but still didn't work.

          – CluelessNoob
          Oct 27 '18 at 11:13















          My grub GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=32564c12-47c9-449c-8fe3-d4ce2e170803" My fstab: # swap was on /dev/sda5 during installation UUID=32564c12-47c9-449c-8fe3-d4ce2e170803 none swap sw 0 0

          – Krzysztof Swiatly
          Oct 27 '18 at 15:50





          My grub GRUB_CMDLINE_LINUX_DEFAULT="quiet splash resume=UUID=32564c12-47c9-449c-8fe3-d4ce2e170803" My fstab: # swap was on /dev/sda5 during installation UUID=32564c12-47c9-449c-8fe3-d4ce2e170803 none swap sw 0 0

          – Krzysztof Swiatly
          Oct 27 '18 at 15:50













          Updated the question.

          – CluelessNoob
          Dec 22 '18 at 12:26





          Updated the question.

          – CluelessNoob
          Dec 22 '18 at 12:26


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1087685%2fhibernate-not-working-in-18-04%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Ellipse (mathématiques)

          Quarter-circle Tiles

          Mont Emei