You are not logged in.

#1 2016-01-20 15:00:29

Oinkium
Member
Registered: 2016-01-20
Posts: 3

[SOLVED] systemctl hibernate can't find my swap file

Problem

I've got hibernate to work before, but always with a swap partition.  My current computer, though, is running a dual boot with Windows on an MBR scheme and space and partitions are at a premium.  I'm trying to make it work with a swap file, but when I type

$ systemctl hibernate

the screen goes blank for a few seconds, then goes right back to how it was before.  With

journalctl

I can get a bit of information about why:

Jan 20 14:47:17 Laptop polkitd[400]: Registered Authentication Agent for unix-process:778:157779 (system bus name :1.9
Jan 20 14:47:17 Laptop kernel: PM: Hibernation mode set to 'platform'
Jan 20 14:47:17 Laptop systemd[1]: Reached target Sleep.
Jan 20 14:47:17 Laptop polkitd[400]: Unregistered Authentication Agent for unix-process:778:157779 (system bus name :1
Jan 20 14:47:17 Laptop systemd[1]: Starting Hibernate...
Jan 20 14:47:17 Laptop systemd-sleep[783]: Suspending system...
Jan 20 14:47:23 Laptop kernel: PM: Syncing filesystems ... done.
Jan 20 14:47:23 Laptop kernel: Freezing user space processes ... (elapsed 0.001 seconds) done.
Jan 20 14:47:23 Laptop kernel: PM: Marking nosave pages: [mem 0x00000000-0x00000fff]
Jan 20 14:47:23 Laptop kernel: PM: Marking nosave pages: [mem 0x0009c000-0x000fffff]
Jan 20 14:47:23 Laptop kernel: PM: Marking nosave pages: [mem 0xbf40c000-0xbf5f0fff]
Jan 20 14:47:23 Laptop kernel: PM: Marking nosave pages: [mem 0xbf5f2000-0xbf681fff]
Jan 20 14:47:23 Laptop kernel: PM: Marking nosave pages: [mem 0xbf800000-0xffffffff]
Jan 20 14:47:23 Laptop kernel: PM: Marking nosave pages: [mem 0x1fc000000-0x1ffffffff]
Jan 20 14:47:23 Laptop kernel: PM: Basic memory bitmaps created
Jan 20 14:47:23 Laptop kernel: PM: Preallocating image memory... done (allocated 270901 pages)
Jan 20 14:47:23 Laptop kernel: PM: Allocated 1083604 kbytes in 0.41 seconds (2642.93 MB/s)
Jan 20 14:47:23 Laptop kernel: Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Jan 20 14:47:23 Laptop kernel: Suspending console(s) (use no_console_suspend to debug)
Jan 20 14:47:23 Laptop kernel: serial 00:02: disabled
Jan 20 14:47:23 Laptop kernel: serial 00:02: System wakeup disabled by ACPI
Jan 20 14:47:23 Laptop kernel: nouveau  [     DRM] suspending console...
Jan 20 14:47:23 Laptop kernel: nouveau  [     DRM] suspending display...
Jan 20 14:47:23 Laptop kernel: nouveau  [     DRM] evicting buffers...
Jan 20 14:47:23 Laptop kernel: nouveau  [     DRM] waiting for kernel channels to go idle...
Jan 20 14:47:23 Laptop kernel: nouveau  [     DRM] suspending client object trees...
Jan 20 14:47:23 Laptop kernel: nouveau  [     DRM] suspending kernel object tree...
Jan 20 14:47:23 Laptop kernel: PM: freeze of devices complete after 2195.903 msecs
Jan 20 14:47:23 Laptop kernel: PM: late freeze of devices complete after 0.564 msecs
Jan 20 14:47:23 Laptop kernel: PM: noirq freeze of devices complete after 0.657 msecs
Jan 20 14:47:23 Laptop kernel: ACPI: Preparing to enter system sleep state S4
Jan 20 14:47:23 Laptop kernel: PM: Saving platform NVS memory
Jan 20 14:47:23 Laptop kernel: Disabling non-boot CPUs ...
Jan 20 14:47:23 Laptop kernel: kvm: disabling virtualization on CPU1
Jan 20 14:47:23 Laptop kernel: smpboot: CPU 1 is now offline
Jan 20 14:47:23 Laptop kernel: kvm: disabling virtualization on CPU2
Jan 20 14:47:23 Laptop kernel: smpboot: CPU 2 is now offline
Jan 20 14:47:23 Laptop kernel: kvm: disabling virtualization on CPU3
Jan 20 14:47:23 Laptop kernel: smpboot: CPU 3 is now offline
Jan 20 14:47:23 Laptop kernel: PM: Creating hibernation image:
Jan 20 14:47:23 Laptop kernel: PM: Need to copy 284234 pages
Jan 20 14:47:23 Laptop kernel: PM: Normal pages needed: 284234 + 1024, available pages: 1777209
Jan 20 14:47:23 Laptop kernel: PM: Hibernation image created (284234 pages copied)
Jan 20 14:47:23 Laptop kernel: PM: Restoring platform NVS memory
Jan 20 14:47:23 Laptop kernel: Enabling non-boot CPUs ...
Jan 20 14:47:23 Laptop kernel: x86: Booting SMP configuration:
Jan 20 14:47:23 Laptop kernel: smpboot: Booting Node 0 Processor 1 APIC 0x1
Jan 20 14:47:23 Laptop kernel: kvm: enabling virtualization on CPU1
Jan 20 14:47:23 Laptop kernel:  cache: parent cpu1 should not be sleeping
Jan 20 14:47:23 Laptop kernel: CPU1 is up
Jan 20 14:47:23 Laptop kernel: smpboot: Booting Node 0 Processor 2 APIC 0x4
Jan 20 14:47:23 Laptop kernel: kvm: enabling virtualization on CPU2
Jan 20 14:47:23 Laptop kernel:  cache: parent cpu2 should not be sleeping
Jan 20 14:47:23 Laptop kernel: CPU2 is up
Jan 20 14:47:23 Laptop kernel: smpboot: Booting Node 0 Processor 3 APIC 0x5
Jan 20 14:47:23 Laptop kernel: kvm: enabling virtualization on CPU3
Jan 20 14:47:23 Laptop kernel:  cache: parent cpu3 should not be sleeping
Jan 20 14:47:23 Laptop kernel: CPU3 is up
Jan 20 14:47:23 Laptop kernel: ACPI: Waking up from system sleep state S4
Jan 20 14:47:23 Laptop kernel: PM: noirq thaw of devices complete after 0.254 msecs
Jan 20 14:47:23 Laptop kernel: PM: early thaw of devices complete after 0.191 msecs
Jan 20 14:47:23 Laptop kernel: nouveau  [     DRM] re-enabling device...
Jan 20 14:47:23 Laptop kernel: nouveau  [     DRM] resuming kernel object tree...
Jan 20 14:47:23 Laptop kernel: nouveau  [   VBIOS][0000:01:00.0] running init tables
Jan 20 14:47:23 Laptop kernel: serial 00:02: activated
Jan 20 14:47:23 Laptop kernel: rtc_cmos 00:03: System wakeup disabled by ACPI
Jan 20 14:47:23 Laptop kernel: tpm_tis 00:05: TPM is disabled/deactivated (0x7)
Jan 20 14:47:23 Laptop kernel: e1000e: eno1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
Jan 20 14:47:23 Laptop kernel: nouveau  [    VOLT][0000:01:00.0] GPU voltage: 900000uv
Jan 20 14:47:23 Laptop kernel: nouveau  [  PTHERM][0000:01:00.0] fan management: automatic
Jan 20 14:47:23 Laptop kernel: nouveau  [     CLK][0000:01:00.0] --: core 405 MHz shader 810 MHz memory 405 MHz
Jan 20 14:47:23 Laptop kernel: nouveau  [     DRM] resuming client object trees...
Jan 20 14:47:23 Laptop kernel: nouveau  [     DRM] resuming display...
Jan 20 14:47:23 Laptop kernel: nouveau  [     DRM] resuming console...
Jan 20 14:47:23 Laptop kernel: PM: thaw of devices complete after 405.670 msecs
Jan 20 14:47:23 Laptop kernel: PM: writing image.
Jan 20 14:47:23 Laptop kernel: PM: Cannot find swap device, try swapon -a.
Jan 20 14:47:23 Laptop kernel: PM: Cannot get swap writer
Jan 20 14:47:23 Laptop kernel: PM: Basic memory bitmaps freed
Jan 20 14:47:23 Laptop kernel: Restarting tasks ... done.
Jan 20 14:47:23 Laptop systemd[1]: Time has been changed
Jan 20 14:47:23 Laptop dhcpcd[326]: eno1: carrier lost
Jan 20 14:47:23 Laptop systemd[327]: Time has been changed
Jan 20 14:47:24 Laptop kernel: ata2.01: failed to resume link (SControl 0)
Jan 20 14:47:24 Laptop kernel: ata1.01: failed to resume link (SControl 0)
Jan 20 14:47:24 Laptop kernel: ata2.00: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
Jan 20 14:47:24 Laptop kernel: ata2.01: SATA link down (SStatus 0 SControl 0)
Jan 20 14:47:24 Laptop kernel: ata2.01: link offline, clearing class 3 to NONE
Jan 20 14:47:24 Laptop kernel: ata1.00: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
Jan 20 14:47:24 Laptop kernel: ata1.01: SATA link down (SStatus 0 SControl 0)
Jan 20 14:47:24 Laptop kernel: ata2.00: ACPI cmd ef/03:45:00:00:00:a0 (SET FEATURES) filtered out
Jan 20 14:47:24 Laptop kernel: ata2.00: ACPI cmd ef/03:0c:00:00:00:a0 (SET FEATURES) filtered out
Jan 20 14:47:24 Laptop kernel: ata2.00: ACPI cmd f5/00:00:00:00:00:00 (SECURITY FREEZE LOCK) filtered out
Jan 20 14:47:24 Laptop kernel: ata1.00: ACPI cmd ef/03:45:00:00:00:a0 (SET FEATURES) filtered out
Jan 20 14:47:24 Laptop kernel: ata1.00: ACPI cmd ef/03:0c:00:00:00:a0 (SET FEATURES) filtered out
Jan 20 14:47:24 Laptop kernel: ata1.00: ACPI cmd c6/00:10:00:00:00:a0 (SET MULTIPLE MODE) succeeded
Jan 20 14:47:24 Laptop kernel: ata1.00: ACPI cmd f5/00:00:00:00:00:00 (SECURITY FREEZE LOCK) filtered out
Jan 20 14:47:24 Laptop kernel: ata2.00: configured for UDMA/100
Jan 20 14:47:24 Laptop kernel: ata1.00: configured for UDMA/133
Jan 20 14:47:23 Laptop systemd[1]: systemd-hibernate.service: Main process exited, code=exited, status=1/FAILURE
Jan 20 14:47:23 Laptop dhcpcd[326]: eno1: deleting default route via 138.38.103.254
Jan 20 14:47:23 Laptop systemd[1]: Failed to start Hibernate.
Jan 20 14:47:23 Laptop dhcpcd[326]: eno1: carrier acquired
Jan 20 14:47:23 Laptop systemd[1]: Dependency failed for Hibernate.
Jan 20 14:47:23 Laptop dhcpcd[326]: eno1: IAID 95:50:91:da
Jan 20 14:47:23 Laptop systemd[1]: hibernate.target: Job hibernate.target/start failed with result 'dependency'.
Jan 20 14:47:23 Laptop dhcpcd[326]: eno1: soliciting an IPv6 router
Jan 20 14:47:23 Laptop systemd-logind[269]: Operation 'sleep' finished.
Jan 20 14:47:24 Laptop dhcpcd[326]: eno1: rebinding lease of 138.38.103.166
Jan 20 14:47:23 Laptop systemd[1]: sleep.target: Unit not needed anymore. Stopping.
Jan 20 14:47:23 Laptop systemd[1]: systemd-hibernate.service: Unit entered failed state.
Jan 20 14:47:23 Laptop systemd[1]: systemd-hibernate.service: Failed with result 'exit-code'.
Jan 20 14:47:23 Laptop systemd[1]: Stopped target Sleep.
Jan 20 14:47:25 Laptop kernel: e1000e 0000:00:19.0 eno1: Detected Hardware Unit Hang:
                                 TDH                  <0>
                                 TDT                  <2>
                                 next_to_use          <2>
                                 next_to_clean        <0>
                               buffer_info[next_to_clean]:
                                 time_stamp           <10001f463>
                                 next_to_watch        <0>
                                 jiffies              <10001f530>
                                 next_to_watch.status <0>
                               MAC Status             <83>
                               PHY Status             <796d>
                               PHY 1000BASE-T Status  <3800>
                               PHY Extended Status    <2000>
                               PCI Status             <10>
Jan 20 14:47:27 Laptop kernel: e1000e 0000:00:19.0 eno1: Detected Hardware Unit Hang:
                                 TDH                  <0>
                                 TDT                  <2>
                                 next_to_use          <2>
                                 next_to_clean        <0>
                               buffer_info[next_to_clean]:
                                 time_stamp           <10001f463>
                                 next_to_watch        <0>
                                 jiffies              <10001f5f8>
                                 next_to_watch.status <0>
                               MAC Status             <83>
                               PHY Status             <796d>
                               PHY 1000BASE-T Status  <3800>
                               PHY Extended Status    <2000>
                               PCI Status             <10>

The relevant bit seems to be the message

PM: Cannot find swap device, try swapon -a.
PM: Cannot get swap writer.
Setup

Here's my setup.

swapon -v

gives

NAME      TYPE SIZE USED PRIO
/swapfile file   8G   0B   -1

However,

swapon -a

produces no output. 

My partition setup is as follows:

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 298.1G  0 disk 
├─sda1   8:1    0 249.3G  0 part 
├─sda2   8:2    0   512M  0 part /boot
├─sda3   8:3    0    20G  0 part /
└─sda4   8:4    0  28.1G  0 part /home
sr0     11:0    1  1024M  0 rom  
/dev/sda1

is the Windows partition.  The swap file is in the root

/

directory, so it should be mounted on

/dev/sda3

To get the swap file offset, I ran

# filefrag -v /swapfile 
Filesystem type is: ef53
File size of /swapfile is 8589934592 (2097152 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..       0:     434176..    434176:      1:            
   1:        1..    4095:     434177..    438271:   4095:             unwritten
   2:     4096..   34815:     899072..    929791:  30720:     438272: unwritten
   3:    34816..   43007:     929792..    937983:   8192:             unwritten
       ...

Using the value of 434176, I wrote my kernel parameters:

# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-linux-lts root=UUID=fd44262b-9d58-42a4-85d6-cb2be5656384 rw quiet resume=/dev/sda3 swap_file_offset=434176

I've added the

resume

hook in

mkinitcpio.conf

:

HOOKS="base udev resume autodetect modconf block filesystems keyboard fsck"

and I've got the swap file in the

fstab
# cat /etc/fstab 
# UUID=fd44262b-9d58-42a4-85d6-cb2be5656384
/dev/sda3               /               ext4            rw,relatime,data=ordered        0 1

# UUID=C6FA-1FDF
/dev/sda2               /boot           vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro  0 2

# UUID=32a3ee82-9542-4ec8-8b6f-441c6888ca5d
/dev/sda4               /home           ext4            rw,relatime,data=ordered        0 2

#The swapfile.
/swapfile none swap defaults 0 0

Any ideas why this isn't working?

Last edited by Oinkium (2016-01-21 13:36:06)

Offline

#2 2016-01-20 21:10:40

paulkerry
Member
From: Sheffield, UK
Registered: 2014-10-02
Posts: 246

Re: [SOLVED] systemctl hibernate can't find my swap file

Offline

#3 2016-01-20 21:34:58

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [SOLVED] systemctl hibernate can't find my swap file

The kernel parameter is "resume_offset=".

Offline

#4 2016-01-21 12:30:41

Oinkium
Member
Registered: 2016-01-20
Posts: 3

Re: [SOLVED] systemctl hibernate can't find my swap file

Ah, thanks - my mistake.  I must have got confused by the Wiki page saying

resume_offset=swap_file_offset

.

Last edited by Oinkium (2016-01-21 12:31:56)

Offline

#5 2016-01-21 13:09:35

paulkerry
Member
From: Sheffield, UK
Registered: 2014-10-02
Posts: 246

Re: [SOLVED] systemctl hibernate can't find my swap file

Don't forget to prepend "[Solved]" to your first post.

Offline

Board footer

Powered by FluxBB