Announcement

Collapse
No announcement yet.

I can't activate Hibernate

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] I can't activate Hibernate

    Hello.
    I just fresh installed kubuntu 24.04 LTS.
    My idea was to activate suspend then hibernate, but I realized that the hibernate option does not work (it only happens to me with Kubuntu 240.4, with Kubuntu 22.04 and others, it works fine).

    Suspend works, hibernate doesn't.

    If I run in konsole
    Code:
    systemctl hibernate
    I get this error:
    Code:
    Call to Hibernate failed: Not running on EFI and resume= is not set. No available method to resume from hibernation
    I must add that, during the installation, I made the partition manually, I generated an 8 megabyte partition without format for GPS tables, another ext4 for / and another 16GB for swap.

    They are well introduced in both fstab and grub.

    It did catch my attention that it had 2 swap entries in grub:
    Code:
    UUID=a4dffd64-1033-4a5f-ab95-4118bf41cc5d swap swap defaults 0 0
    /swapfile swap swap defaults 0 0
    I found it strange that this is both the entry to the partition and the swapfile.

    Any ideas about it?

    Thank you very much and greetings.​

    #2
    Semi solved

    I comment semi-solved, because, it is true that, I have corrected the non-hibernation problem, and perhaps I should open a new post...

    The problem resided in the partitions, I had not created a fat32 /boot/efi partition with a boot flag.
    I did fresh install, partition fat32 /boot/efi flag boot.
    Another ext4 partition for /
    And a last swap partition with a swap flag (enough space for my computer).

    Ok, now if I run systemctl hibernate it hibernates correctly, but... hibernate does not appear in logout/shutdown options.
    That's the first problem.

    The second, I do not have the suspend then hibernate option enabled.

    I have gone to the file /etc/systemd/sleep.conf and I have configured it as I had it in Kubuntu 22.04, but it does not work, in system preferences, power options, I do not get the option to suspend-then-hibernate.

    Thanks in advance.

    PS: If I have to create a new post, I will create it.​

    Comment


      #3
      Originally posted by wonder View Post
      /swapfile swap swap defaults 0 0[/code]

      I found it strange that this is both the entry to the partition and the swapfile.
      Trying to debug an installer problem, I concluded that calamares always creates a smallish swap file. (On a btrfs it would always try to set it no-copy-on-write, and if it already existed, left over from a previous install attempt, the setting would fail, causing the installer to crash.)
      Regards, John Little

      Comment


        #4
        Originally posted by wonder View Post
        Code:
        Call to Hibernate failed: Not running on EFI and resume= is not set.
        I must add that, during the installation, I made the partition manually, I generated an 8 megabyte partition without format for GPS tables
        Those indicate you did a BIOS/GPT install... surely in 2024 you didn't want that.

        Your second post implies a successful UEFI install.

        If you have a command that works in a konsole, you can use the "KDE Menu Editor", (right-click the menu button and choose "Edit applications...") to create an entry that runs the command. I've had to do that for suspend in the past.

        The systemctl man page suggests "hybrid-sleep" and "suspend-then-hibernate". Do they work for you?
        Regards, John Little

        Comment


          #5
          Hibernation needs to be enabled in Ubuntu, and with 24.04, some extra steps might be needed. Setting the "resume=blah-blah" in grub is still required.
          Cool thing is, it may be quite possible to use a swap file now, as opposed to requiring a swap partition:
          https://ubuntuhandbook.org/index.php...-ubuntu-21-10/
          This page seems to have the most thorough set of instructions.

          Comment


            #6
            Originally posted by jlittle View Post

            Trying to debug an installer problem, I concluded that calamares always creates a smallish swap file. (On a btrfs it would always try to set it no-copy-on-write, and if it already existed, left over from a previous install attempt, the setting would fail, causing the installer to crash.)
            Correct, it seems that the squid installer makes some type of error or failure in the installation.
            It is not logical that I have created a swap partition during the installation but Calamaris adds an entry in fstab and the resulting swap file (size 512mb). Obviously, I have disabled the swap file entry and deleted the swap file ( I am of old habits, I prefer partition...).

            Originally posted by jlittle View Post

            Those indicate you did a BIOS/GPT install... surely in 2024 you didn't want that.

            Your second post implies a successful UEFI install.

            If you have a command that works in a konsole, you can use the "KDE Menu Editor", (right-click the menu button and choose "Edit applications...") to create an entry that runs the command. I've had to do that for suspend in the past.

            The systemctl man page suggests "hybrid-sleep" and "suspend-then-hibernate". Do they work for you?
            Correct, I did a wrong installation, but until I realized it, it was very difficult for me...
            No, I did not want a BIOS/GPT installation, as seen in the second post, I already did a successful UEFI install.

            "The systemctl man page suggests "hybrid-sleep" and "suspend-then-hibernate". Do they work for you?"
            It works with command, through Konsole, but not in the system.
            In principle, the option should appear in power options, and it does not appear (suspend-then-hibernate).
            I also comment that by command it works, but I have not tested a suspend-then-hibernate long enough to see if, after x configured suspension time, it goes to hibernation.

            But I'm very afraid that it won't work, assuming that, in the logout options, I don't have the option to hibernate...

            Originally posted by claydoh View Post
            Hibernation needs to be enabled in Ubuntu, and with 24.04, some extra steps might be needed. Setting the "resume=blah-blah" in grub is still required.
            Cool thing is, it may be quite possible to use a swap file now, as opposed to requiring a swap partition:
            https://ubuntuhandbook.org/index.php...-ubuntu-21-10/
            This page seems to have the most thorough set of instructions.
            All of this is configured, in grub resume=....blabla...., in fstab...etc...
            That page indicates it so that it is for a swap file, not for a partition, unless uKubuntu 24.04 has changed a lot, it should work the same with a partition, and no, it is not my case, the hibernate button does not appear in logout, It is already very indicative, in the same way that I do not see the option in, energy options, When you are at rest, hibernate after a period of inactivity (which is suspend-then-hibernate).

            I can't think of what could be happening or...if kubuntu 24.04 is still "green"...

            Thanks​

            Comment


              #7
              If you'd prefer to have a swap partition, you can run
              swapoff
              and select to turn off the swap file. I did that some time ago.
              The next brick house on the left
              Intel i7 11th Gen | 16GB | 1TB | KDE Plasma 5.27.11​| Kubuntu 24.04 | 6.8.0-31-generic



              Comment


                #8
                Originally posted by jglen490 View Post
                If you'd prefer to have a swap partition, you can run and select to turn off the swap file. I did that some time ago.
                Yes, yesterday I did it, swapoff, deleted the entry in fstab that referenced the swap file and deleted the swap file (which is 512MB).
                Didn't work...no hibernate option, only works via systemctl hibernate konsole​

                Comment


                  #9
                  Did you follow step 4 in my link above?
                  A few posts here and there link to it specifically for adding the menu option, such as this one:
                  https://www.reddit.com/r/Kubuntu/s/7r4AXffy0M
                  Last edited by claydoh; Jun 03, 2024, 02:41 AM.

                  Comment


                    #10
                    Originally posted by claydoh View Post
                    Did you follow step 4 in my link?
                    A few posts here and there link to it specifically for adding the menu option
                    https://www.reddit.com/r/Kubuntu/s/7r4AXffy0M
                    I think I had seen that link.

                    But I only see two steps:

                    1:
                    Code:
                    Enable Hibernate option in Power-Off Menu:
                    After enabled the function, you can now add a menu option into the system tray shutdown menu.
                    1.) Firstly, open terminal (Ctrl+Alt+T) and run command to create & edit a config file:
                    sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla
                    When the file opens, paste following lines and save it.
                    [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
                    2:
                    Code:
                    It needs an entry in the grub file
                    GRUB_CMDLINE_LINUX_DEFAULT="resume=UUID=xxxyourID"
                    if you have a dedicated swap partition.
                    Well, I have created step 2.

                    Step 1...I don't see it working, the url /etc/polkit-1/localauthority/ does not exist....

                    But....although the hibernate button could be made/added in the logout menu (in kubuntu 22.04 I did not need to do this), the suspend-then-hibernate option is not enabled in power options...​

                    Comment


                      #11
                      Things change in Linux often enough that what was valid in 2022 needs to be done a little differently in 2024.

                      You need to create the dirs and files needed.

                      The full Step 4 that the reddit post used and linked to as its source (and I linked to in post #5):
                      https://ubuntuhandbook.org/index.php/2021/08/enable-hibernate-ubuntu-21-10/#:~:text=Step%204%3A%20Enable%20Hibernate%20option %20in%20Power%2DOff%20Menu%3A
                      There is a step specifically for KDE
                      Last edited by claydoh; Jun 03, 2024, 02:43 AM.

                      Comment


                        #12
                        Originally posted by claydoh View Post
                        Things change in Linux often enough that what was valid in 2022 needs to be done a little differently in 2024.

                        You need to create the dirs and files needed.

                        The full Step 4 that the reddit post used and linked to as its source (and I linked to in post #5):
                        https://ubuntuhandbook.org/index.php/2021/08/enable-hibernate-ubuntu-21-10/#:~:text=Step%204%3A%20Enable%20Hibernate%20option %20in%20Power%2DOff%20Menu%3A
                        There is a step specifically for KDE
                        Yes, yesterday I was also looking at that source: https://ubuntuhandbook.org/index.php...le%20Hibernate %20option%20in%20Power%2DOff%20Menu%3A
                        Completely.

                        They talk about how to enable hibernation, but there, they talk about doing it with a swap file, my intention is to do it with a partition.

                        I did not perform the step of creating the hibernate button in logout options, because I saw that the suspend-then-hibernate option is not operational.

                        Therefore, what interests me most is the suspend-then-hibernate option, which is operational, then I will create the button.

                        From what you say, many things have changed from 04-22 to 04-24 (or at least some) I must create those directories and files to have the hibernate button in logout, ok.

                        But as mentioned, yesterday, using swap partition, I never had the suspend-then-hibernate option operational (perhaps this requires another thread).

                        Thank you.​

                        Comment


                          #13
                          Ummmm
                          c.) Find swap Name and offset


                          For Swap Partition. You just need to get the partition name by running command:
                          swapon --show

                          In the terminal output, just copy the partition name. It’s usually /dev/sdaX for sata, or /dev/nvme0n1px for NVME.
                          and

                          For Swap partition, add resume=/dev/xxx (do replace “/dev/xxx” to yours Swap partition name) as value of “GRUB_CMDLINE_LINUX_DEFAULT”.



                          Read the whole page. It tells you exactly what to do.

                          Originally posted by wonder View Post
                          But as mentioned, yesterday, using swap partition, I never had the suspend-then-hibernate option operational (
                          It might simply not work on your hardware. There is a reason that Ubuntu and others decided to disable it all, those years ago, and still do after regular discussions on the topic.

                          It might be worth testing another type of distro that doesn't disable it, so you can see what may be possible, and what might not work?

                          Maybe test:
                          Code:
                          systemctl suspend-then-hibernate

                          It will depend on the systemd version, so how it work or when it switches between suspend and hibernate may be different.
                          Last edited by claydoh; Jun 03, 2024, 03:30 AM.

                          Comment


                            #14
                            I did it my friend, I did it.
                            I have been doing this process since kubuntu 22.04.
                            I read the entire page, in case there was any different point, I added it in grub (which by the way, since during the installation I already created the swap partition, said entry was already added in grub), and I verified the UUID, everything was correct.
                            There is no suspend-then-hibernate option (apart from the fact that there is no hibernate button in logout when it should appear by default once swap is enabled with enough space).​

                            Edit:
                            Now that I have looked again....the difference is that, it indicates let's add to the grub:
                            "add resume=/dev/xxx (do replace “/dev/xxx” to yours Swap partition name) "
                            Instead of the UUID of the swap partition.
                            Yesterday I added the UUID, although as I mentioned, it is already added by default when installing Kubuntu 24.04, creating manual partitioning and adding a swap partition, in grub, it comes by default:
                            resume=UUID=xxxxx

                            It's the only difference I see, but I don't think that's the cause...​
                            Last edited by wonder; Jun 03, 2024, 03:07 AM.

                            Comment


                              #15
                              Sorry for the delay in updating this post, but I left it "abandoned" for a while and went back to 22.04. I recently saw a series of posts (and one mentioned here) updated, and I tried it, went back to 24.04 and sure enough, now you can activate hibernation and suspend-then-hibernate.

                              In the link from the colleague claydoh referencing this link:
                              https://ubuntuhandbook.org/index.php...-ubuntu-21-10/
                              As it says, point 4 but you have to notice that a little further down it indicates for KDE specifically, it must be done from the line that says:
                              "For KDE user, try this one to create /etc/polkit-1/rules.d/10-enable-hibernate.rules file and add following lines"

                              With that single step, it was enough for me, hibernate button, hibernate enabled and suspend-then-hibernate, too.

                              At the time of this post and the colleague posted it... I don't know if it did the complete step 4, it wasn't all there or... I don't remember the reason why it failed... I don't remember anymore, I've seen that the post has a Last update of 9 September 2024, maybe there was something different... I don't know...

                              I indicate the above as a summary (source, the link indicated by the colleague) in case it helps another user:

                              Assuming that we already have either a file or a swap partition large enough for it (it depends on our RAM), to enable Hibernation and automatically, suspend-then-hibernate will be enabled, we proceed to do the following:

                              Instead of creating a file /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla (it's the old method), create a file /etc/polkit-1/rules.d/10-enable-hibernate.rules with the following content:
                              polkit.addRule(function(action, subject) {
                              if (action.id == "org.freedesktop.login1.hibernate" ||
                              action.id == "org.freedesktop.login1.hibernate-multiple-sessions" ||
                              action.id == "org.freedesktop.upower.hibernate" ||
                              action.id == "org.freedesktop.login1.handle-hibernate-key" ||
                              action.id == "org.freedesktop.login1.hibernate-ignore-inhibit")
                              {
                              return polkit.Result.YES;
                              }
                              });​
                              With that, only the hibernate, hibernate and suspend-then-hibernate button was enabled.​

                              Comment

                              Working...
                              X