# No resume from hibernate (s2disk + swap on lvm + genkernel)

## kingsly

I'm trying to get suspend to disk working on my box

And the machine seems to suspend properly when I run "s2disk" but when I power up the box after, it doesn't resume and does a regular boot instead.

The kernel is unable to find the resume swap (a dedicated lvm volume I  setup for hibernating alone.) If I add the "resumewait" kernel option the system just hangs....

Is this the right way to address the volume in the kernel cmdline ? 

```
resume=/dev/mapper/VG1-hibernate 

```

Update: I guess the addressing method is correct because /sys/power/resume contains "253:9", which is what udisks --show-info /dev/mapper/VG1-hiberate also shows.

The only thing that shows up in dmesg is 

```
[    4.087089] PM: Starting manual resume from disk
```

During the boot process I also see a message that it's invalidating/overwriting the suspend signature while mounting the swap space. ( This message doesn't seem to be logged anywhere, so I'm paraphrasing.)

I'm using genkernel to generate the initramfs ... 

but I find that it puts the lvm binary into /bin/lvm but there are dozens of broken symlinks in /sbin  (lv* / vg* / pv* etc)  which point to a non-existent /sbin/lvm

Is this normal? 

```
lrwxrwxrwx 1 kingsly users    3 Dec 12 16:27 sbin/lvchange -> lvm

lrwxrwxrwx 1 kingsly users    3 Dec 12 16:27 sbin/lvconvert -> lvm

lrwxrwxrwx 1 kingsly users    3 Dec 12 16:27 sbin/lvcreate -> lvm

lrwxrwxrwx 1 kingsly users    3 Dec 12 16:27 sbin/lvdisplay -> lvm

lrwxrwxrwx 1 kingsly users    3 Dec 12 16:27 sbin/lvextend -> lvm

lrwxrwxrwx 1 kingsly users    3 Dec 12 16:27 sbin/lvmchange -> lvm
```

Also genkernel seems to always use it's own version of lvm2 even if I have built lvm2 with the static option (And a /sbin/lvm.static is present on my system.)

(I found a similar old post which too hasn't been solved - https://forums.gentoo.org/viewtopic-t-711845-highlight-lvm+swap+resume.html )

Anyone have such a setup working? How do I fix this?

Edit: I'm running 3.12.4-gentoo and genkernel 3.4.47  (It was broken with 3.4.45.1, so I tried the unstable one) and sys-power/suspend-1.0

----------

## kingsly

I've managed to get my machine to hibernate...

What I have found is that genkernel is horribly broken  when it comes to initramfs related things.

(I've been using genkernel for nearly a decade with no problems whatsoever, but until the recent advisory about mounting /usr  I didn't have any need for an initramfs.)

The genkernel devs seem have some particular hatred for suspend/hibernate functionality.

There's a bug report dating back to Nov 2006 that is still "IN PROGRESS"  - https://bugs.gentoo.org/show_bug.cgi?id=156445

Despite multiple people having submitted patches in that bug report, the genkernel devs have stubbornly refused to incorporate them into genkernel.

They claim that they'll incorporate it in "genkernel 3.5",  a mythical next version that they have been talking about since August 2007.  (Hopefully no one was holding their breath)

Somewhere in the last 7 years they seem to have pushed some half broken functionality into genkernel for swsusp(supend/hibernate) and they even have a function called swsusp_resume() in the initrd scripts, but that too is broken and will never resume.

Other broken functionality  

genkernel will always include it's own version of lvm even if you have a statically built version available on your system.

For some weird reason, genkernel pulls the lvm binary from /sbin/lvm (from their own custom tarball in /var/cache/genkernel/) and move it into /bin and so all the symlinks in /sbin which point to the lvm binary are broken (vg* lv* commands) - There's a year old bug report about this and again nothing has been done to "fix" / remove the dangling symlinks.

If you have no option but to use genkernel to generate the initramfs for swsusp

In  /usr/share/genkernel/defaults/initrd.scripts

You need to change the line that reads (it's within swsusp_resume() ) 

```
 [ -f /sys/power/resume ] && echo "${device}" > /sys/power/resume 

```

to read 

```
 [ -f /sys/power/resume ] && echo "${device}" > /sys/power/resume && /sbin/resume

```

And you need to find a way to get  /sbin/resume (located at /usr/lib/suspend/resume on your gentoo install)   and /etc/suspend.conf into the initramfs.

I just included the commands to copy those files into a part of  gen_initramfs.sh that I know gets executed on my machine.(was too lazy to do it the "right way")

But I think it might be possible to use the --initramfs-overlay= option of genkernel to achieve the same results.

----------

