You are not logged in.
Hi all,
I have my root partition set up as a dm-crypt encrypted volume, and I followed the instructions here to set up a swap file.
I also followed these instructions to add the resume hook to my mkinitcpio.conf between encrypt and filesystems.
I modified the /etc/default/grub file like so:
GRUB_CMDLINE_LINUX_DEFAULT="cryptdevice=/dev/disk/by-uuid/0cb6b266-ce81-4b2f-9958-722c788c46ef:cryptroot cryptkey=/dev/disk/by-uuid/18868ab9-e0dd-4634-9f9e-69f3d3686d3f:ext2:/laptopkey root=/dev/mapper/cryptroot resume=/dev/mapper/cryptroot resume_offset=4952064"I determined the offset using the swap-offset tool provided by the uswsusp package.
And I ran
mkinitcpio -p linux and
grub-mkconfigWhen I type "systemctl hibernate" the system begins to hibernate, then comes back up immediately. Journalctl -xn gives this:
Jan 08 23:38:57 lefty-laptop systemd[1]: systemd-hibernate.service: main process exited, code=exited, status=1/FAILURE
Jan 08 23:38:57 lefty-laptop systemd[1]: Failed to start Hibernate.
-- Subject: Unit systemd-hibernate.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/be02cf6855d2428ba40df7e9d022f03d
--
-- Unit systemd-hibernate.service has failed.
--
-- The result is failed.
Jan 08 23:38:57 lefty-laptop systemd[1]: Dependency failed for Hibernate.
-- Subject: Unit hibernate.target has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/be02cf6855d2428ba40df7e9d022f03d
--
-- Unit hibernate.target has failed.
--
-- The result is dependency.
Jan 08 23:38:57 lefty-laptop systemd[1]: Service sleep.target is not needed anymore. Stopping.
Jan 08 23:38:57 lefty-laptop systemd[1]: Unit systemd-hibernate.service entered failed state.
Jan 08 23:38:57 lefty-laptop systemd[1]: Stopping Sleep.
-- Subject: Unit sleep.target has begun shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit sleep.target has begun shutting down.
Jan 08 23:38:57 lefty-laptop systemd[1]: Stopped target Sleep.
-- Subject: Unit sleep.target has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/catalog/9d1aaa27d60140bd96365438aad20286
--
-- Unit sleep.target has finished shutting down.
Jan 08 23:38:58 lefty-laptop kernel: Freezing user space processes ... (elapsed 0.001 seconds) done.
Jan 08 23:38:57 lefty-laptop wpa_actiond[1017]: Interface 'wlan0' lost connection to network 'braains'
Jan 08 23:38:58 lefty-laptop kernel: PM: Marking nosave pages: [mem 0x0009d000-0x000fffff]
Jan 08 23:38:58 lefty-laptop kernel: PM: Basic memory bitmaps created
Jan 08 23:38:58 lefty-laptop kernel: PM: Preallocating image memory... done (allocated 294215 pages)
Jan 08 23:38:58 lefty-laptop kernel: PM: Allocated 1176860 kbytes in 0.22 seconds (5349.36 MB/s)
Jan 08 23:38:58 lefty-laptop kernel: Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
Jan 08 23:38:58 lefty-laptop kernel: e1000e 0000:00:19.0: setting latency timer to 64Then a bunch more stuff, then this:
Jan 08 23:38:58 lefty-laptop kernel: PM: thaw of devices complete after 955.701 msecs
Jan 08 23:38:58 lefty-laptop kernel: PM: writing image.
Jan 08 23:38:58 lefty-laptop kernel: PM: Using 1 thread(s) for compression.
PM: Compressing and saving image data (197765 pages)...
Jan 08 23:38:58 lefty-laptop kernel: PM: Image saving progress: 0%
Jan 08 23:38:58 lefty-laptop kernel: PM: Image saving progress: 10%
Jan 08 23:38:58 lefty-laptop kernel: PM: Image saving progress: 20%
Jan 08 23:38:58 lefty-laptop kernel: PM: Image saving progress: 30%
Jan 08 23:38:58 lefty-laptop kernel: PM: Image saving progress: 40%
Jan 08 23:38:58 lefty-laptop kernel: PM: Image saving progress: 50%
Jan 08 23:38:58 lefty-laptop kernel: PM: Image saving progress: 60%
Jan 08 23:38:58 lefty-laptop kernel: PM: Image saving progress: 70%
Jan 08 23:38:58 lefty-laptop kernel: PM: Image saving progress: 80%
Jan 08 23:38:58 lefty-laptop kernel: PM: Image saving progress: 90%
Jan 08 23:38:58 lefty-laptop kernel: PM: Image saving progress: 100%
Jan 08 23:38:58 lefty-laptop kernel: PM: Image saving done.
Jan 08 23:38:58 lefty-laptop kernel: PM: Wrote 791060 kbytes in 4.67 seconds (169.39 MB/s)
Jan 08 23:38:58 lefty-laptop kernel: PM: S
Jan 08 23:38:58 lefty-laptop kernel: PM: Swap header not found!
Jan 08 23:38:58 lefty-laptop kernel: |
Jan 08 23:38:58 lefty-laptop kernel: PM: Basic memory bitmaps freed
Jan 08 23:38:58 lefty-laptop kernel: Restarting tasks ... done.
Jan 08 23:38:58 lefty-laptop kernel: video LNXVIDEO:00: Restoring backlight state
Jan 08 23:38:58 lefty-laptop laptop-mode[28617]: Laptop mode
Jan 08 23:38:58 lefty-laptop laptop-mode[28618]: enabled, not active [unchanged]
Jan 08 23:38:58 lefty-laptop laptop-mode[28622]: Laptop mode
Jan 08 23:38:58 lefty-laptop laptop-mode[28623]: enabled, not active [unchanged]Perhaps the "PM: swap header not found" is not the primary error?
Last edited by LeftyAce (2014-01-12 06:08:55)
Offline
What you did sounds perfectly right to me; should work in theory. Unfortunately, your laptob disagrees.
I can think of two things you might try:
check if the swapfile offset is correct - you mentioned you did not determine it using filefrag as described in the wiki ... see if filefrag yields the same result
check if building the initrd image was successful ... check if the cmdline contains the resume statement; do
cat /proc/cmdlineWe are exactly the people our parents always warned us about.
Offline
I wouldn't use 'resume=/dev/mapper/cryptroot', at least for me it seems to lead to a kernel panic on resume.
If I use 'resume=UUID=xxxxxxxxx' where xxxxxxxxx is the uuid of my swap partition then it works fine. I use LVM on LUKS so my setup end up being quite similar to yours, except that you use a swap file and I use a swap partition.
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
gay, I'll double check the filefrag output. If I remember correctly it showed a TON of fragments, which maybe was part of the problem?
ROOKIE: which UUID do you use? If I list /dev/disk/by-uuid I get two results:
total 0
lrwxrwxrwx 1 root root 10 Jan 11 18:06 06f4c97e-fe09-45a8-a937-dedb6b18339b -> ../../dm-0
lrwxrwxrwx 1 root root 10 Jan 11 18:06 a0eb0a15-6d5d-4df2-a0d3-6f7fb00885c6 -> ../../sda1I think one of them is the actual device, the other is the dm-crypt container? I guess I could try both...I'll report back.
Offline
Ok, I'm a bit of an idiot. I noticed that when I attempted to set up the swapfile again, all of a sudden I couldn't even boot normally. It seems the UUID for my primary disk in my /etc/default/grub was wrong. Fixed that and everything seems to work.
For the record I am using resume=/dev/mapper/cryptroot. I think since the swapfile is a file not a block device in my case that's important. Since the encrypt hook runs first, that mapper volume is present and unlocked by the time resume comes around.
Also, the output given by swap-offset is correct. The awk command in the wiki to use filefrag directly doesn't work for me (it looks like it's supposed to find and print the first line but returns nothing for me).
One piece of strange behavior remains, although maybe this is normal?
When I run systemctl hibernate, the laptop goes to suspend (screen goes blank, little moon LED comes on), then it wakes back up, then goes into hibernate.
Otherwise it seems to work great!
Last edited by LeftyAce (2014-01-12 05:25:42)
Offline
ROOKIE: which UUID do you use? If I list /dev/disk/by-uuid I get two results:
total 0 lrwxrwxrwx 1 root root 10 Jan 11 18:06 06f4c97e-fe09-45a8-a937-dedb6b18339b -> ../../dm-0 lrwxrwxrwx 1 root root 10 Jan 11 18:06 a0eb0a15-6d5d-4df2-a0d3-6f7fb00885c6 -> ../../sda1I think one of them is the actual device, the other is the dm-crypt container? I guess I could try both...I'll report back.
Usually I use the output of blkid to find out the correct uuid. The uuid to use for / or swap is the one pointing to one of /dev/dm*.
For the record I am using resume=/dev/mapper/cryptroot. I think since the swapfile is a file not a block device in my case that's important. Since the encrypt hook runs first, that mapper volume is present and unlocked by the time resume comes around.
In my case the same happens but for some reason it doesn't seem to work, and I've been procrastinating submitting a bug (I use hibernation very rarely and I know of a way that works).
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
The awk command in the wiki to use filefrag directly doesn't work for me (it looks like it's supposed to find and print the first line but returns nothing for me).
You're right. Neither does it for me. Should probably be more like
filefrag -v /swapfile | awk '{if($1=="0:"){print substr($3, 0, length($3)-1)}}'Anyway, I can unfortunately not help you with your first suspend then wake up then hibernate problem.
Last edited by gay (2014-01-13 15:49:24)
We are exactly the people our parents always warned us about.
Offline