You are not logged in.

#1 2024-03-10 17:39

dlrider
Member
Registered: 2024-02-26
Posts: 18

Hibernation?

I don't see hibernate option when shutdown/sleep.  I've got everything else set, installed for full profile, using Plasma x11 sesson, including a swap partition of 8.8 Gb for 8 Gb RAM system.  What are the steps to enable hibernation?

Offline

#2 2024-03-10 17:46

dlrider
Member
Registered: 2024-02-26
Posts: 18

Re: Hibernation?

Running Aquarius.

Offline

#3 2024-03-11 11:03

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,256
Website

Re: Hibernation?

You could try follow this guide for Ubuntu https://www.linuxandubuntu.com/home/how … untu-linux and post back

Offline

#4 2024-03-11 20:41

NoMoreWindows
Member
Registered: 2024-01-03
Posts: 62

Re: Hibernation?

I gave up on hibernation. You need a large swap file and I never got it to work the way I wanted.
Windows hibernation works like a charm and I never managed to make Linux do something even closely similar.
If I recall well, hibernating took longer than regular shutdown/restart, when it worked at all.

Let me know if you succeed in doing something satisfactory with it.

Offline

#5 2024-03-11 22:51

seb3773
Member
Registered: 2023-11-01
Posts: 74

Re: Hibernation?

Well, I use hibernation sucessfully on several laptops with q4os... (trinity version)
I can suggest you to try my laptop configuration script for q4os, start with no swap partition or swap file (delete it if you already have one)- it will ask you if you want to enable hibernation and will take care of creating the swap file &  configuration needed.

*Just saw the first post, didn't realize you're using plasma desktop. Never tried the script on plasma, but I think it should work the same... Can't try it now, but if you want I can make a test tomorrow on a plasma install of q4os to check if it's ok.

Last edited by seb3773 (2024-03-11 22:56)


My Q4OS scripts: win10 theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

#6 2024-03-12 01:33

seb3773
Member
Registered: 2023-11-01
Posts: 74

Re: Hibernation?

I tried to extract from my script only the part you need, here it is (in attachment)
just download it, then do in terminal:

sudo chmod +x sethibernate.sh
sudo ./sethibernate.sh

Just be sure you don't have any swap file existing or resume_offset=... in GRUB_CMDLINE_LINUX_DEFAULT (in file /etc/default/grub)
(in this case remove the swap file / partition first; and remove  'resume_offset=xxx ' in GRUB_CMDLINE_LINUX_DEFAULT)

The script will create a swap file with the required size, then activate hibernation & set to hibernate if sleep for more than 1h30 (you can adjust it to your needs)

It will set "hibernate then sleep" to lid close action too. ( for laptop)


Tell me if it works for you smile

Last edited by seb3773 (2024-03-13 17:33)


Attachments:
sh sethibernate.sh, Size: 3.16 KiB, Downloads: 24

My Q4OS scripts: win10 theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

#7 2024-03-13 02:13

dlrider
Member
Registered: 2024-02-26
Posts: 18

Re: Hibernation?

q4osteam wrote:

You could try follow this guide for Ubuntu https://www.linuxandubuntu.com/home/how … untu-linux and post back

First, thank you, for pointing me toward something that should be for Q4OS.  I didn't want to follow other things and find that it doesn't quite fit somewhere.

So the explanation missed that pm-utils need to be installed (after I searched for pm-hibernate), so I got that going and found that it won't react to pm-hibernate.  I guess that basically means no win here.  I cruised through the system bios looking for a setting that may block hibernation or that needs to be turned on -- nada.

I'll mull it over, but for now suspend will have to do.  I just wanted to have the system hibernate before losing battery power (to save power in this old battery) if I happen to not be there to babysit.

Offline

#8 2024-03-13 02:33

dlrider
Member
Registered: 2024-02-26
Posts: 18

Re: Hibernation?

seb3773 wrote:

The script will create a swap file with the required size, then activate hibernation & set to hibernate if sleep for more than 1h30 (you can adjust it to your needs)

Because I have a swap partition, not file, will this work?  Can the system have both, but hibernate use swapfile?

Edit:  Well regardless, I removed the swap partition and removed the swap line from fstab file.  Ran the script but got an error at line 55: unexpected end of file.   I'll review it later.  I don't see anything onscreen that says anything else ran up to line 55, other than the echoed message from line 2.

Last edited by dlrider (2024-03-13 06:45)

Offline

#9 2024-03-13 09:32

seb3773
Member
Registered: 2023-11-01
Posts: 74

Re: Hibernation?

dlrider wrote:

Ran the script but got an error at line 55: unexpected end of file.   I'll review it later.  I don't see anything onscreen that says anything else ran up to line 55, other than the echoed message from line 2.

Sorry, it's my fault, an ending part was missing, I corrected it, it should run ok now smile

Last edited by seb3773 (2024-03-13 14:25)


My Q4OS scripts: win10 theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

#10 2024-03-13 12:58

seb3773
Member
Registered: 2023-11-01
Posts: 74

Re: Hibernation?

Ok, I did some tests, the script as it is is not sufficient. It sets correctly the swap file and the configuration but we need one more step:  it seems the swap can't be used for hibernation if it is used for swapping by the kernel. So, I see two options:
-Stop using the swap for swapping ( tongue ) , this can be done by creating the file local.conf in /etc/sysctl.d and add this : vm.swappiness=1

-Using zram for swapping and the swap file for hibernation, a better option in my opinion. (this way the kernel can swap pages, and you can hibernate too)

So, I modified the script to install zram first and then install hibernation mechanism.
It should work now smile  (tested successfully on Trinity & Plasma desktop.. this is DE agnostic.)


* I think this can be done too by keeping the /swap partition (for kernel swapping) and using the swap file for hibernation, will take a look at it; but zram is so good for performances that I think this is a good solution. (need to take a look at zswap too...)

NoMoreWindows wrote:

Windows hibernation works like a charm and I never managed to make Linux do something even closely similar.
If I recall well, hibernating took longer than regular shutdown/restart, when it worked at all.

I tested hibernation (the way it is done in the script provided) on several laptops, and I can assure you it doesn't takes longer than regular restart, roughly the same time in fact. It is very similar to windows hibernation behavior.

But, you're right about windows hibernation working "out of the box", and that it is not the case at all with linux distributions... Maybe this is a point Q4OS Team can look at, something like an option to activate hibernation that will take care of all the configuration needed. (this will be very usefull for laptops users for example)
Until then, I'm using a script I wrote (qlaptop.sh) to configure Q4OS installations on laptops; but I'm sure Q4OS Team can provide something better and more user friendly smile

Last edited by seb3773 (2024-03-13 17:33)


Attachments:
sh sethibernate.sh, Size: 3.16 KiB, Downloads: 29

My Q4OS scripts: win10 theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

#11 2024-03-14 02:25

dlrider
Member
Registered: 2024-02-26
Posts: 18

Re: Hibernation?

I decided to start from scratch, installing another SSD and making sure I selected the install option hibernation. I turned off the swap partition (swapoff), deleted the swap partition and resized the ext3 partition (using gparted). I ran your script; results attached.

It should kick in hibernate after the timeout period (90 minutes), but can it do hibernate on demand?  Neither before or after does hibernate appear with the shutdown/restart/sleep launch window.

It appears zram is working for swapfile.

$ free
               total        used        free      shared  buff/cache   available
Mem:         8068908     2534948      156508      119456     5800936     5533960
Swap:       12116880       11776    12105104

Last edited by dlrider (2024-03-14 02:26)


Attachments:
pdf results.pdf, Size: 21.41 KiB, Downloads: 33

Offline

#12 2024-03-14 09:04

seb3773
Member
Registered: 2023-11-01
Posts: 74

Re: Hibernation?

dlrider wrote:

making sure I selected the install option hibernation.

Maybe that's the problem, I always install Q4OS without swap partition (because a swap file is more versatile - and it's size can be rather easily changed, I don't see the benefits of using a swap partiton)  and apply my script after installation done. I don't know how it is set when you select swap partition at installation... Maybe something is setup differently when you install with the swap partition, because I tested the script on a clean plasma install and it works, I mean you can hibernate and you have the option to hibernate in the shutdown menu:

ksnapshot-UN82v1.jpg

I suspect when you install this way (with swap partition), the kernel is using the swap for swapping pages, so it's not possible to hibernate. I will try to install with swap partition to understand how the setup is done. Something else that is coming to my mind, why are you using ext3 instead of ext4 ? (although I doesn't think it matters for the hibernation)

Some questions to help to resolve the problem:
what is the output of this command on your system :  sudo swapon -s
and this one : cat /etc/fstab

Last edited by seb3773 (2024-03-14 09:24)


Attachments:
jpg ksnapshotUN82v1.jpg, Size: 30.86 KiB, Downloads: 27

My Q4OS scripts: win10 theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

#13 2024-03-14 09:11

NoMoreWindows
Member
Registered: 2024-01-03
Posts: 62

Re: Hibernation?

seb3773 wrote:

Maybe this is a point Q4OS Team can look at, something like an option to activate hibernation that will take care of all the configuration needed.

Like a music band only needs one hit song to become known to the masses, a Windows like hibernation in Q4OS might be the one hit feature that could earn Q4OS the much wider recognition it deserves.

Offline

#14 2024-03-14 10:50

seb3773
Member
Registered: 2023-11-01
Posts: 74

Re: Hibernation?

Just tried to install q4os+plasma DE with a swap partition, never did it before, (with default install parameters) in virtualbox and hibernation seems to work "out of the box" (???) ...  And it's ok too with q4os trinity.

So:
- It seems I was wrong about the swap partition that can't be used for kernel swapping AND hibernation function, it seems it works (but I have serious doubts about the default size which is 1Gb, doesn't seem enough if we have a lot of memory pages to 'hibernate' and if it's already used by kernel swapping - that's why I prefer a swap file instead of a partition by the way, it's easier to resize - )
Maybe I was right about the swap on a file, but /swap on a partition seems to be ok to 'share' kernel swapping & hibernation.

- I don't understand why it's not working for you, is there a relation to ext3 partition instead of ext4 ?..

At this point, I think we need Q4OS Team knowledge...
--> why a default 1gb swap partition, isn't it better to calculate the size needed in relation of available ram ?
--> why not a swap file (easier to manage)
--> why it's not working for dlrider ?...

Last edited by seb3773 (2024-03-14 12:13)


My Q4OS scripts: win10 theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

#15 2024-03-14 13:12

dlrider
Member
Registered: 2024-02-26
Posts: 18

Re: Hibernation?

seb3773 wrote:
dlrider wrote:

making sure I selected the install option hibernation.

Maybe that's the problem, I always install Q4OS without swap partition (because a swap file is more versatile - and it's size can be rather easily changed, I don't see the benefits of using a swap partiton)  and apply my script after installation done. I don't know how it is set when you select swap partition at installation...

Some questions to help to resolve the problem:
what is the output of this command on your system :  sudo swapon -s
and this one : cat /etc/fstab

Interesting.  I'll try install without hibernation with another install process.

$ sudo swapon -s
[sudo] password for dlrider:
Filename                                Type            Size            Used            Priority
/dev/zram0                              partition       4034452         138868          100
/swap                                   file            8082428         0               -2


cat /etc/fstab:
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=7F46-B7B1                            /boot/efi      vfat    defaults,noatime 0 2
UUID=dcdaf202-8a97-402a-8a9a-79170eb1c0d3 /              ext4    defaults,noatime,discard 0 1
UUID=3b49bc01-622b-428f-b92f-fc5d896ba8be swap           swap    defaults,noatime,discard 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
/swap                                     none           swap    sw,pri=0 0 0

Offline

#16 2024-03-14 13:14

dlrider
Member
Registered: 2024-02-26
Posts: 18

Re: Hibernation?

NoMoreWindows wrote:
seb3773 wrote:

Maybe this is a point Q4OS Team can look at, something like an option to activate hibernation that will take care of all the configuration needed.

Like a music band only needs one hit song to become known to the masses, a Windows like hibernation in Q4OS might be the one hit feature that could earn Q4OS the much wider recognition it deserves.

And sometimes I think:  right-click > run as administrator (or root or something)

Offline

#17 2024-03-14 13:55

dlrider
Member
Registered: 2024-02-26
Posts: 18

Re: Hibernation?

dlrider wrote:

Interesting.  I'll try install without hibernation with another install process.

Same results.  I did this using Trinity (TDE) as well.  No hibernate.  It just must be something with this machine... or me.

Offline

#18 2024-03-14 16:02

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,256
Website

Re: Hibernation?

We will take a closer look at this issue and post some result here. This may take some time, so be patient please. In any case, the ability to hibernate is hardware dependent.

--> why a default 1gb swap partition, isn't it better to calculate the size needed in relation of available ram ?
Q4OS just use the original Debian Calamares partitioning method. We believe Debian developers have tuned it thoroughly, so it works the same way as for plain Debian installation.

--> why not a swap file (easier to manage)
We are using the Debian default again. It's possible to choose the swap file option in Calamares, if you would partition a disk from scratch.

--> why it's not working for dlrider ?...
Maybe the current kernel doesn't support hibernation for the hardware in question ? We will make some testing a post back with a result later.

Offline

#19 2024-03-14 17:07

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,256
Website

Re: Hibernation?

@dlrider
What is the result of the command:
$ sudo systemctl hibernate

Offline

#20 2024-03-15 00:42

dlrider
Member
Registered: 2024-02-26
Posts: 18

Re: Hibernation?

dlrider@q4os-latitude-e6430:~$ sudo systemctl hibernate
[sudo] password for dlrider:
Call to Hibernate failed: Sleep verb "hibernate" not supported

Hardware info attached.

Last edited by dlrider (2024-03-15 00:45)


Attachments:
png Screenshot_20240314_194406.png, Size: 25.24 KiB, Downloads: 34

Offline

#21 2024-03-15 09:23

seb3773
Member
Registered: 2023-11-01
Posts: 74

Re: Hibernation?

dlrider wrote:

dlrider@q4os-latitude-e6430:~$ sudo systemctl hibernate
[sudo] password for dlrider:
Call to Hibernate failed: Sleep verb "hibernate" not supported

Hardware info attached.

can you try to disable secure boot in BIOS/EFI ? This maybe in relation.


My Q4OS scripts: win10 theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

#22 2024-03-15 23:33

dlrider
Member
Registered: 2024-02-26
Posts: 18

Re: Hibernation?

seb3773 wrote:

can you try to disable secure boot in BIOS/EFI ? This maybe in relation.

Son of gun!  That did it.  Tested both with Trinity and Plasma.  Trinity has more options but basically is sleep or suspend to disk (hibernate).  And it is a surprisingly fast too.  systemctl hibernate works too of course.  Thank you all.  The script makes things easier to do -- I like the non-fiddly stuff outside of a terminal window.

Last edited by dlrider (2024-03-15 23:34)

Offline

#23 2024-03-16 21:15

seb3773
Member
Registered: 2023-11-01
Posts: 74

Re: Hibernation?

dlrider wrote:

Son of gun!  That did it.  Tested both with Trinity and Plasma.  Trinity has more options but basically is sleep or suspend to disk (hibernate).  And it is a surprisingly fast too.  systemctl hibernate works too of course.  Thank you all.  The script makes things easier to do -- I like the non-fiddly stuff outside of a terminal window.

Glad it works for you too now smile Thanks to Q4os team who pointed us in the right direction, I should have think of the systemctl command first to see what's happening tongue

About the  default 1 gb partition swap size:

q4osteam wrote:

--> why a default 1gb swap partition, isn't it better to calculate the size needed in relation of available ram ?
Q4OS just use the original Debian Calamares partitioning method. We believe Debian developers have tuned it thoroughly, so it works the same way as for plain Debian installation.

--> why not a swap file (easier to manage)
We are using the Debian default again. It's possible to choose the swap file option in Calamares, if you would partition a disk from scratch.

Well, although I have profund respect for the work of the debian developers, and although I believe they are making very good choices for this distribution that I really love, in this specific case this is highly debatable.

The default 1Gb swap partition is causing A LOT of problems to a lot of users, just do a search on the web and you will find many many examples of debian users who aren't able to hibernate or have other problems with this setting...

https://groups.google.com/g/linux.debia … jpHobIL1KU

https://www.reddit.com/r/debian/comment … the_worst/

and so on...

The usual consensus seems to be that this default setting is a 'mistake', especially for desktop usage of debian. For server usage, it doesn't really matter, in this case it's very likely the administrator will apply specific settings in relation of the server function, independently of the default settings, but for a desktop usage I really think this is a bad choice. With 1gb swap and ram>1Gb, even if the kernel is compressing pages, you will face problems at a certain point (can't hibernate or simply not enough 'room' for the kernel swapping...). Plus, I really think a file is easier to manage (resizing if needed for example).

Last edited by seb3773 (2024-03-16 23:16)


My Q4OS scripts: win10 theming, perfs optimisation, laptop configuration, ...  for trinity users -->  https://github.com/seb3773/q4osXpack

Offline

#24 2024-03-17 02:23

dlrider
Member
Registered: 2024-02-26
Posts: 18

Re: Hibernation?

I'll say it this simple way, and don't mean any offense:
If the intention of the Desktop Profiler is to offer a "full featured desktop" then it should do what is expected with a modern OS -- hibernate and such.  So the swap file/partition should be automagically set for those of us who don't want to spend a lot of time fiddling.  Shouldn't it know that secure boot should be off or the swap size is not right or ask me if I want that feature?  I didn't choose "ultimately minimal desktop" where I'd expect there probably won't be hibernation availability, or to use a lot of knowledge and experience (that I don't really have) to tweak things.

I appreciate the help here, and that this place is available, and I'm not upset/angry/disappointed. When beginning to look at any new system I don't first think "I'll go to the forums for installation help" -- I'm more hopeful that installation will figure it out for me, or guide me with non-system-admin language.  I'm ok, because I don't expect to do any more fiddling than this level of knowledge -- that's just me.

Offline

#25 2024-03-17 08:27

NoMoreWindows
Member
Registered: 2024-01-03
Posts: 62

Re: Hibernation?

dlrider wrote:

When beginning to look at any new system I don't first think "I'll go to the forums for installation help" -- I'm more hopeful that installation will figure it out for me, or guide me with non-system-admin language.

I think this is very close to the mission statement that Q4OS has for itself and they are doing a good job in that regard.

For me hibernation is also a very important feature that I’m lacking now. I like your suggestion to integrate the solution from this thread into the installer. Let’s make it a feature request!
It’s not that I’m incapable or lazy, I just want my system to work, like I want my car to drive.
Q4OS is offering that to me, but hibernation is an exception.

(But now that it is apparently solved, I’ll try the stuff mentioned in this thread.)

Offline

Board footer

Powered by FluxBB