How to enable hibernation with swap partion on Linux Mint 19

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
ngiampaoli
Level 1
Level 1
Posts: 11
Joined: Tue Aug 11, 2015 12:17 pm

Re: How to enable hibernation with swap partion on Linux Mint 19

Post by ngiampaoli » Fri Aug 10, 2018 1:32 pm

Thank you for the tutorial
It works great. :D

Valsodar
Level 3
Level 3
Posts: 142
Joined: Thu Jul 19, 2018 11:30 pm
Location: Sofia, Bulgaria
Contact:

Re: How to enable hibernation with swap partion on Linux Mint 19

Post by Valsodar » Fri Aug 10, 2018 7:44 pm

Just a question: why would anyone to enable hibernation? It's a too slow process to be useful.

gm10
Level 12
Level 12
Posts: 4078
Joined: Thu Jun 21, 2018 5:11 pm

Re: How to enable hibernation with swap partion on Linux Mint 19

Post by gm10 » Sat Aug 11, 2018 1:44 am

Valsodar wrote:
Fri Aug 10, 2018 7:44 pm
Just a question: why would anyone to enable hibernation? It's a too slow process to be useful.
Not really, only takes seconds, in particular with an SSD. Depends on what you do with your machine but for me it's certainly faster than closing everything down, saving every document, and re-opening it all again next time you start the computer. It's been my default for years on both Linux and Windows machines.

Valsodar
Level 3
Level 3
Posts: 142
Joined: Thu Jul 19, 2018 11:30 pm
Location: Sofia, Bulgaria
Contact:

Re: How to enable hibernation with swap partion on Linux Mint 19

Post by Valsodar » Sat Aug 11, 2018 5:54 am

Nah, I don't close anything. Just suspend it to RAM. Takes 2 seconds to powerdown/wake up.

gm10
Level 12
Level 12
Posts: 4078
Joined: Thu Jun 21, 2018 5:11 pm

Re: How to enable hibernation with swap partion on Linux Mint 19

Post by gm10 » Sat Aug 11, 2018 6:51 am

Valsodar wrote:
Sat Aug 11, 2018 5:54 am
Nah, I don't close anything. Just suspend it to RAM. Takes 2 seconds to powerdown/wake up.
Sure, you could also just leave it running, but neither of those solutions actually turns your computer off to the point where you can cut the power.

Maybe I should have clarified that in my original response: I want to turn my computer off. :D

User avatar
BG405
Level 7
Level 7
Posts: 1537
Joined: Fri Mar 11, 2016 3:09 pm
Location: England

Re: How to enable hibernation with swap partion on Linux Mint 19

Post by BG405 » Tue Aug 14, 2018 1:42 pm

gm10 wrote:
Sat Aug 11, 2018 6:51 am
neither of those solutions actually turns your computer off to the point where you can cut the power.
Exactly. Although I use suspend (sleep) by default on my D255E netbook, Hibernate is an essential function in the event of low or critical battery levels when one can't access a mains socket. Especially so with the Dell (server machine) in case of a power cut, as its battery is well past its use-by date.

Suspend / sleep still drains the battery, albeit rather slowly, meaning the Acer has to be plugged in when I get home in order to avoid unnecessary battery wear.
Dell Inspiron 1525 - LM17.3 CE 64-------------------Acer D255E 2GB - Manjaro KDE, LM17.3 KDE 32
Toshiba NB305 - Manjaro KDE------------------------K7S5A AMD 1.2GHz - LM17.3 Xfce 32 & WinXP-Pro
Acer Aspire E11 ES1-111M - LM18.2 KDE 64 ----Dell PII 350 64MB - Puppy 4.3 & Win98-SE

kryssb
Level 1
Level 1
Posts: 15
Joined: Fri Apr 28, 2017 5:11 pm

Re: How to enable hibernation with swap partion on Linux Mint 19

Post by kryssb » Tue Aug 28, 2018 5:40 pm

Hello,

I am sorry to say this doesn't work for me. I do get the button but hibernation does not work at all.
I have been running LMDE2 for more than one year and then decided to move to Mint 19 to get newer software. LMDE2 with kernel 3.16 had some glitches but in the last 6 months hibernation worked like a charm. I tend to believe the problem is in kernel 4.15, because all I get is freezing the machine in a coma state, when I have to push the power button to kill it. When rebooting, the system has a fresh start. Remembering what the disk activity was like in LMDE2 and checking what it is like now, I would say the hibernation process never writes a single byte to the swap partition. Of course I put the UUID of the swap partition (checked also by GParted) into the grub file. I would appreciate suggestions, here below is the output of /var/log/pm-suspend.log. Thanks in advance

EDIT I installed stable kernel 4.9.124 and hibernation works flawlessly again. Although I really don't feel expert enough to point fingers, it looks that in this respect there's a regression in the kernel between 4.9 and 4.15, which might affect only some machines.

Code: Select all

Initial commandline parameters: 
mar 28 ago 2018, 00.26.24, CEST: Running hooks for hibernate.
Running hook /usr/lib/pm-utils/sleep.d/000kernel-change hibernate hibernate:
/usr/lib/pm-utils/sleep.d/000kernel-change hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/000record-status hibernate hibernate:
/usr/lib/pm-utils/sleep.d/000record-status hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/00logging hibernate hibernate:
Linux pc-studio 4.15.0-33-generic #36-Ubuntu SMP Wed Aug 15 16:00:05 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Module                  Size  Used by
nvidia_drm             40960  1
nvidia_modeset       1114112  5 nvidia_drm
nvidia              14364672  180 nvidia_modeset
snd_hda_codec_hdmi     49152  4
drm_kms_helper        172032  1 nvidia_drm
drm                   401408  4 nvidia_drm,drm_kms_helper
ipmi_devintf           20480  0
uvcvideo               86016  0
videobuf2_vmalloc      16384  1 uvcvideo
joydev                 24576  0
videobuf2_memops       16384  1 videobuf2_vmalloc
videobuf2_v4l2         24576  1 uvcvideo
videobuf2_core         40960  2 uvcvideo,videobuf2_v4l2
hid_tmff               16384  0
snd_usb_audio         196608  1
input_leds             16384  0
videodev              184320  3 uvcvideo,videobuf2_core,videobuf2_v4l2
ff_memless             16384  1 hid_tmff
snd_usbmidi_lib        32768  1 snd_usb_audio
media                  40960  2 uvcvideo,videodev
arc4                   16384  2
snd_hda_codec_idt      57344  1
snd_hda_codec_generic    73728  1 snd_hda_codec_idt
snd_hda_intel          40960  4
snd_hda_codec         126976  4 snd_hda_intel,snd_hda_codec_idt,snd_hda_codec_hdmi,snd_hda_codec_generic
snd_hda_core           81920  5 snd_hda_intel,snd_hda_codec,snd_hda_codec_idt,snd_hda_codec_hdmi,snd_hda_codec_generic
snd_hwdep              20480  2 snd_hda_codec,snd_usb_audio
snd_pcm                98304  5 snd_hda_intel,snd_hda_codec,snd_usb_audio,snd_hda_core,snd_hda_codec_hdmi
snd_seq_midi           16384  0
snd_seq_midi_event     16384  1 snd_seq_midi
snd_rawmidi            32768  2 snd_seq_midi,snd_usbmidi_lib
snd_seq                65536  2 snd_seq_midi_event,snd_seq_midi
ipmi_msghandler        53248  2 nvidia,ipmi_devintf
snd_seq_device         16384  3 snd_seq,snd_rawmidi,snd_seq_midi
snd_timer              32768  2 snd_seq,snd_pcm
fb_sys_fops            16384  1 drm_kms_helper
syscopyarea            16384  1 drm_kms_helper
sysfillrect            16384  1 drm_kms_helper
sysimgblt              16384  1 drm_kms_helper
gpio_ich               16384  0
intel_rapl             20480  0
x86_pkg_temp_thermal    16384  0
intel_powerclamp       16384  0
coretemp               16384  0
kvm_intel             212992  0
rt2800pci              16384  0
kvm                   593920  1 kvm_intel
rt2800mmio             16384  1 rt2800pci
rt2800lib             114688  2 rt2800mmio,rt2800pci
rt2x00pci              16384  1 rt2800pci
rt2x00mmio             16384  2 rt2800mmio,rt2800pci
irqbypass              16384  1 kvm
rt2x00lib              53248  5 rt2800lib,rt2x00pci,rt2800mmio,rt2x00mmio,rt2800pci
crct10dif_pclmul       16384  0
crc32_pclmul           16384  0
ghash_clmulni_intel    16384  0
pcbc                   16384  0
mac80211              778240  3 rt2800lib,rt2x00pci,rt2x00lib
snd                    81920  23 snd_hda_intel,snd_hwdep,snd_seq,snd_hda_codec,snd_hda_codec_idt,snd_usb_audio,snd_timer,snd_rawmidi,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_usbmidi_lib,snd_seq_device,snd_pcm
aesni_intel           188416  0
aes_x86_64             20480  1 aesni_intel
crypto_simd            16384  1 aesni_intel
glue_helper            16384  1 aesni_intel
cryptd                 24576  3 crypto_simd,ghash_clmulni_intel,aesni_intel
intel_cstate           20480  0
intel_rapl_perf        16384  0
cfg80211              622592  2 rt2x00lib,mac80211
lpc_ich                24576  0
eeprom_93cx6           16384  1 rt2800pci
mei_me                 40960  0
soundcore              16384  1 snd
mei                    90112  1 mei_me
shpchp                 36864  0
mac_hid                16384  0
sch_fq_codel           20480  6
parport_pc             36864  0
ppdev                  20480  0
lp                     20480  0
parport                49152  3 lp,parport_pc,ppdev
ip_tables              28672  0
x_tables               40960  1 ip_tables
autofs4                40960  2
btrfs                1122304  0
xor                    24576  1 btrfs
zstd_compress         163840  1 btrfs
raid6_pq              114688  1 btrfs
dm_mirror              24576  0
dm_region_hash         20480  1 dm_mirror
dm_log                 20480  2 dm_mirror,dm_region_hash
uas                    24576  0
usb_storage            69632  2 uas
hid_generic            16384  0
usbhid                 49152  0
hid                   118784  3 hid_tmff,hid_generic,usbhid
ahci                   36864  3
r8169                  86016  0
libahci                32768  1 ahci
mii                    16384  1 r8169
              total        used        free      shared  buff/cache   available
Mem:       16405528     1544412    13090336       84452     1770780    14807808
Swap:      16777212           0    16777212
/usr/lib/pm-utils/sleep.d/00logging hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/00powersave hibernate hibernate:
/usr/lib/pm-utils/sleep.d/00powersave hibernate hibernate: success.

Running hook /etc/pm/sleep.d/10_grub-common hibernate hibernate:
/etc/pm/sleep.d/10_grub-common hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/40inputattach hibernate hibernate:
/usr/lib/pm-utils/sleep.d/40inputattach hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/50unload_alx hibernate hibernate:
/usr/lib/pm-utils/sleep.d/50unload_alx hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/60_wpa_supplicant hibernate hibernate:
Selected interface 'wlp5s0'
OK
/usr/lib/pm-utils/sleep.d/60_wpa_supplicant hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/75modules hibernate hibernate:
/usr/lib/pm-utils/sleep.d/75modules hibernate hibernate: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/90clock hibernate hibernate:
/usr/lib/pm-utils/sleep.d/90clock hibernate hibernate: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/94cpufreq hibernate hibernate:
/usr/lib/pm-utils/sleep.d/94cpufreq hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/95anacron hibernate hibernate:
Warning: Stopping anacron.service, but it can still be activated by:
  anacron.timer
/usr/lib/pm-utils/sleep.d/95anacron hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/95hdparm-apm hibernate hibernate:
/usr/lib/pm-utils/sleep.d/95hdparm-apm hibernate hibernate: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/95led hibernate hibernate:
/usr/lib/pm-utils/sleep.d/95led hibernate hibernate: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler hibernate hibernate:
nVidia binary video drive detected, not using quirks.
/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/99video hibernate hibernate:
/usr/lib/pm-utils/sleep.d/99video hibernate hibernate: success.

mar 28 ago 2018, 00.26.25, CEST: performing hibernate
Initial commandline parameters: 
mar 28 ago 2018, 20.24.32, CEST: Running hooks for hibernate.
Running hook /usr/lib/pm-utils/sleep.d/000kernel-change hibernate hibernate:
/usr/lib/pm-utils/sleep.d/000kernel-change hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/000record-status hibernate hibernate:
/usr/lib/pm-utils/sleep.d/000record-status hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/00logging hibernate hibernate:
Linux pc-studio 4.15.0-33-generic #36-Ubuntu SMP Wed Aug 15 16:00:05 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
Module                  Size  Used by
nvidia_drm             40960  1
nvidia_modeset       1114112  5 nvidia_drm
nvidia              14364672  183 nvidia_modeset
snd_hda_codec_hdmi     49152  4
drm_kms_helper        172032  1 nvidia_drm
joydev                 24576  0
uvcvideo               86016  0
videobuf2_vmalloc      16384  1 uvcvideo
videobuf2_memops       16384  1 videobuf2_vmalloc
videobuf2_v4l2         24576  1 uvcvideo
videobuf2_core         40960  2 uvcvideo,videobuf2_v4l2
snd_usb_audio         196608  1
input_leds             16384  0
videodev              184320  3 uvcvideo,videobuf2_core,videobuf2_v4l2
hid_tmff               16384  0
ff_memless             16384  1 hid_tmff
snd_usbmidi_lib        32768  1 snd_usb_audio
media                  40960  2 uvcvideo,videodev
drm                   401408  4 nvidia_drm,drm_kms_helper
ipmi_devintf           20480  0
ipmi_msghandler        53248  2 nvidia,ipmi_devintf
fb_sys_fops            16384  1 drm_kms_helper
snd_hda_codec_idt      57344  1
snd_hda_codec_generic    73728  1 snd_hda_codec_idt
syscopyarea            16384  1 drm_kms_helper
arc4                   16384  2
snd_hda_intel          40960  4
snd_hda_codec         126976  4 snd_hda_intel,snd_hda_codec_idt,snd_hda_codec_hdmi,snd_hda_codec_generic
snd_hda_core           81920  5 snd_hda_intel,snd_hda_codec,snd_hda_codec_idt,snd_hda_codec_hdmi,snd_hda_codec_generic
snd_hwdep              20480  2 snd_hda_codec,snd_usb_audio
snd_pcm                98304  5 snd_hda_intel,snd_hda_codec,snd_usb_audio,snd_hda_core,snd_hda_codec_hdmi
snd_seq_midi           16384  0
snd_seq_midi_event     16384  1 snd_seq_midi
snd_rawmidi            32768  2 snd_seq_midi,snd_usbmidi_lib
snd_seq                65536  2 snd_seq_midi_event,snd_seq_midi
snd_seq_device         16384  3 snd_seq,snd_rawmidi,snd_seq_midi
snd_timer              32768  2 snd_seq,snd_pcm
gpio_ich               16384  0
sysfillrect            16384  1 drm_kms_helper
intel_rapl             20480  0
x86_pkg_temp_thermal    16384  0
intel_powerclamp       16384  0
coretemp               16384  0
sysimgblt              16384  1 drm_kms_helper
kvm_intel             212992  0
kvm                   593920  1 kvm_intel
irqbypass              16384  1 kvm
crct10dif_pclmul       16384  0
crc32_pclmul           16384  0
ghash_clmulni_intel    16384  0
pcbc                   16384  0
rt2800pci              16384  0
rt2800mmio             16384  1 rt2800pci
rt2800lib             114688  2 rt2800mmio,rt2800pci
rt2x00pci              16384  1 rt2800pci
aesni_intel           188416  0
rt2x00mmio             16384  2 rt2800mmio,rt2800pci
rt2x00lib              53248  5 rt2800lib,rt2x00pci,rt2800mmio,rt2x00mmio,rt2800pci
aes_x86_64             20480  1 aesni_intel
crypto_simd            16384  1 aesni_intel
glue_helper            16384  1 aesni_intel
mac80211              778240  3 rt2800lib,rt2x00pci,rt2x00lib
cryptd                 24576  3 crypto_simd,ghash_clmulni_intel,aesni_intel
intel_cstate           20480  0
snd                    81920  23 snd_hda_intel,snd_hwdep,snd_seq,snd_hda_codec,snd_hda_codec_idt,snd_usb_audio,snd_timer,snd_rawmidi,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_usbmidi_lib,snd_seq_device,snd_pcm
intel_rapl_perf        16384  0
cfg80211              622592  2 rt2x00lib,mac80211
lpc_ich                24576  0
mei_me                 40960  0
eeprom_93cx6           16384  1 rt2800pci
mei                    90112  1 mei_me
soundcore              16384  1 snd
shpchp                 36864  0
mac_hid                16384  0
sch_fq_codel           20480  6
parport_pc             36864  0
ppdev                  20480  0
lp                     20480  0
parport                49152  3 lp,parport_pc,ppdev
ip_tables              28672  0
x_tables               40960  1 ip_tables
autofs4                40960  2
btrfs                1122304  0
xor                    24576  1 btrfs
zstd_compress         163840  1 btrfs
raid6_pq              114688  1 btrfs
dm_mirror              24576  0
dm_region_hash         20480  1 dm_mirror
dm_log                 20480  2 dm_mirror,dm_region_hash
uas                    24576  0
usb_storage            69632  2 uas
hid_generic            16384  0
usbhid                 49152  0
hid                   118784  3 hid_tmff,hid_generic,usbhid
ahci                   36864  3
r8169                  86016  0
libahci                32768  1 ahci
mii                    16384  1 r8169
              total        used        free      shared  buff/cache   available
Mem:       16405528      629492    15006976       20268      769060    15479252
Swap:      16777212           0    16777212
/usr/lib/pm-utils/sleep.d/00logging hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/00powersave hibernate hibernate:
/usr/lib/pm-utils/sleep.d/00powersave hibernate hibernate: success.

Running hook /etc/pm/sleep.d/10_grub-common hibernate hibernate:
/etc/pm/sleep.d/10_grub-common hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/40inputattach hibernate hibernate:
/usr/lib/pm-utils/sleep.d/40inputattach hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/50unload_alx hibernate hibernate:
/usr/lib/pm-utils/sleep.d/50unload_alx hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/60_wpa_supplicant hibernate hibernate:
Selected interface 'wlp5s0'
OK
/usr/lib/pm-utils/sleep.d/60_wpa_supplicant hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/75modules hibernate hibernate:
/usr/lib/pm-utils/sleep.d/75modules hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/90clock hibernate hibernate:
/usr/lib/pm-utils/sleep.d/90clock hibernate hibernate: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/94cpufreq hibernate hibernate:
/usr/lib/pm-utils/sleep.d/94cpufreq hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/95anacron hibernate hibernate:
Warning: Stopping anacron.service, but it can still be activated by:
  anacron.timer
/usr/lib/pm-utils/sleep.d/95anacron hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/95hdparm-apm hibernate hibernate:
/usr/lib/pm-utils/sleep.d/95hdparm-apm hibernate hibernate: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/95led hibernate hibernate:
/usr/lib/pm-utils/sleep.d/95led hibernate hibernate: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler hibernate hibernate:
nVidia binary video drive detected, not using quirks.
/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler hibernate hibernate: success.

Running hook /usr/lib/pm-utils/sleep.d/99video hibernate hibernate:
/usr/lib/pm-utils/sleep.d/99video hibernate hibernate: success.

mar 28 ago 2018, 20.24.33, CEST: performing hibernate

xGuy
Level 2
Level 2
Posts: 55
Joined: Fri Jan 29, 2016 3:56 pm

Re: How to enable hibernation with swap partion on Linux Mint 19

Post by xGuy » Sun Nov 11, 2018 2:58 pm

Many thanks for this excellent HowTo which worked fine for me on Mint 19.

One issue I hit was that when restarting from a hibernation, the GRUB screen had a 30 second timeout rather than the 3 seconds I had set.

After a little investigation I found that inserting the following line into /etc/default/grub fixed this :-
GRUB_RECOVERYFAIL_TIMEOUT GRUB_RECORDFAIL_TIMEOUT=$GRUB_TIMEOUT

This might be down to my environment which is an Asus EeePC Netbook used as a Media Server. The internal HDD layout is as supplied with Windows XP with a standard Windows MBR. Mint 19 is installed on a USB HDD with GRUB2 on its MBR. So booting Mint19 involves pressing ESC a couple of times to get the USB HDD in the Boot Device List.

This set up was simply to prove that Mint 19 64 bit Cinnamon with Wine could run an old version of iTunes just as well as Windows XP can. Which it does (although 1GB RAM is a bit tight).
Last edited by xGuy on Mon Nov 12, 2018 12:26 pm, edited 1 time in total.

gm10
Level 12
Level 12
Posts: 4078
Joined: Thu Jun 21, 2018 5:11 pm

Re: How to enable hibernation with swap partion on Linux Mint 19

Post by gm10 » Sun Nov 11, 2018 3:12 pm

xGuy wrote:
Sun Nov 11, 2018 2:58 pm
After a little investigation I found that inserting the following line into /etc/default/grub fixed this :-
GRUB_RECOVERYFAIL_TIMEOUT=$GRUB_TIMEOUT
I believe you mean GRUB_RECORDFAIL_TIMEOUT ?

xGuy
Level 2
Level 2
Posts: 55
Joined: Fri Jan 29, 2016 3:56 pm

Re: How to enable hibernation with swap partion on Linux Mint 19

Post by xGuy » Mon Nov 12, 2018 8:53 am

Many thanks for pointing out that serious error! It could potentially have caused a lot of wasted time for someone.

I will try to be more accurate in future. Normally I would copy paste from the actual file but in this case I couldn't do that - not even if logged in remotely via VNC. I guess I could have pulled the file over with SSH.

Apologies to anyone misled but hopefully your timely intervention will have forestalled that possibility.

Post Reply

Return to “Tutorials”