You are not logged in.

#1 2013-04-26 20:15:22

ibes
Member
From: Austria
Registered: 2013-04-26
Posts: 10

[SOLVED] PM: Cannot find swap device

Hello,

I've been trying to get hibernation mode to work which requires a swap partition or file. I chose the latter option. At the moment I am stuck with the error message in this thread's subject. I've been following the instructions given in Suspend and Hibernate - ArchWiki diligently several times, so I don't think the problem is due to misconfiguration.

Relevant lines of the relevant configuration files (according to the instructions in ArchWiki):

/etc/default/grub:
GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=/dev/sda2 resume_offset=2514944"

/etc/mkinitcpio.conf:
HOOKS="base udev autodetect modconf block keymap encrypt lvm2 resume filesystems keyboard fsck"

Some information that might be relevant:

$ sudo filefrag -v /swapfile
Filesystem type is: ef53
File size of /swapfile is 3884032000 (948250 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..       0:    2514944..   2514944:      1:            
   1:        1..   30719:    2514945..   2545663:  30719:             unwritten
...

$ sudo cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-linux root=/dev/mapper/arch-root ro cryptdevice=/dev/sda2:arch quiet resume=/dev/sda2 resume_offset=2514944

The swap file is slightly larger than my physical memory, so there shouldn't be a problem in regards to storage requirements of the hibernation mode.

$ sudo swapon -s
Filename				Type		Size	Used	Priority
/swapfile                              	file	3792996	0	-1

Whenever I try to hibernate via systemctl hibernate, I get the following messages:

$ dmesg | grep 'swap'
[  141.670279] PM: Cannot find swap device, try swapon -a.
[  141.670389] PM: Cannot get swap writer

Any attempt of help will be much appreciated :-)
Thanks!

Last edited by ibes (2013-05-06 07:49:12)

Offline

#2 2013-05-04 20:25:55

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,277

Re: [SOLVED] PM: Cannot find swap device

Welcome to the forum, ibes.
For an encrypted swapfile, you have to provide the resume parameter with the /dev/mapper blockdevice of your sda2. Add the swapfile to fstab too. Your offset looks good. An example you find here: https://wiki.archlinux.org/index.php/LU … sk_support

Offline

#3 2013-05-04 21:27:59

ibes
Member
From: Austria
Registered: 2013-04-26
Posts: 10

Re: [SOLVED] PM: Cannot find swap device

Juhu, es funktioniert! Dankeschön! Jetzt aber wieder in Englisch ;-)

As Strike0 has already pointed out, the problem was that the resume parameter in /etc/default/grub pointed to a partition when it should have pointed to the /dev/mapper device containing the root directory. In my case, the right configuration looks like this:

/etc/default/grub:
GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=/dev/mapper/arch-root resume_offset=2514944"

Thank you very much again and good night!

Last edited by ibes (2013-05-04 21:28:41)

Offline

#4 2013-05-05 22:30:14

Strike0
Member
From: Germany
Registered: 2011-09-05
Posts: 1,277

Re: [SOLVED] PM: Cannot find swap device

Good it works & you are welcome.  When you come online again, maybe you take a few seconds and edit the thread title of your first post to add [solved ] to it. It is done here on the forums that manual way to indicate the problem is solved (and helping others searching for working solutions).

At first I was wondering why you separate the "resume=" parameters from the "cryptdevice=" into the "GRUB_CMDLINE_LINUX_DEFAULT" variable. That way your automatically generated boot entry for the recovery mode entry does not include it. It makes sense really as trying to resume into recovery mode surely is a bad idea; I have adopted that split.

Offline

Board footer

Powered by FluxBB