# help to finish suspend support

## rogerdv

I have been trying to enable suspend support in my gentoo, but I found a problem in the guide: http://en.gentoo-wiki.com/wiki/Userspace_software_suspend#Init_script_example. According to the guide, that script needs modifications, but doesnt specify what should be modified. In my case, I have tried unmodified, which produces an error saying that sda2 is not a valid luks device, and chagint to sda3, which causes a kernel panic. My partition scheme is sda1 for windows, sda2 for boot, sda3 for root, without encryption or exotic features. How should I modify the script?

----------

## vr13

there are just couple of requirements if you are going to implement suspend-to-ram and your computer is ACPI-capable:

kernel is configured to support suspend-to-ram: CONFIG_SUSPEND=y

sys-power/pm-utils userspace tools is emerged to you system. this one is pretty good integrated with popular desktop environments (kde, Gnome, xfce) so the integration performs suspend/resume tasks automatically whilst providing you with fine-graining control over suspend and resume proceduresfor hibernation (suspend to disk), i think the tuxonice kernel is the best way to go

----------

## Hu

If you left out encryption, then you do not need the initscript to enable LUKS.  Are you sure you want to leave out encryption?  If you do, then everything in memory when you hibernate will be written to persistent storage.  Once written, it could persist almost indefinitely, even across additional hibernate/resume cycles.  Additionally, if you do not encrypt your swap device, anyone can resume the machine.

If you really want to proceed without encryption, then please post what you have (if different from the example) and the location of your swap device.

----------

## rogerdv

vr13, I have pm-utils, but it doesnt works. When I try to suspend from Xfce I got: Backend not supported.

Hu, I think I have followed the guide and I have nothing different. My swap partition is sda7. Im really not interested in encryption because it is my home PC, which is even disconnected from internet.

----------

## Hu

This should work, assuming you set PM_STD_PARTITION to /dev/sda7 and have that device node in your initramfs.

```
#!/bin/sh

resume

mount -r /dev/sda3 /newroot

if [[ -x /newroot/sbin/init ]]; then

   exec switch_root /newroot /sbin/init

fi
```

----------

## javeree

Is there also a way to call this 'resume' function without setting PM_STD_PARTITION in the kernel ?

e.g. 

resume -p /dev/sda7

Then it would be possible to pass the partition through the kernel command line.

With this initramfs, 'resume' is called also when the system was not hibernated but shut down.

I assume that the functionalityof resume is 'check if there is a hibernate image on the disk. If so, resume from it, otherwise just exit and let the rest of the script do its thing.

----------

## Hu

According to resume --help, yes, you can use resume --resume_device device.

Also, I think that I misspoke earlier.  I think resume uses the value from your /etc/suspend.conf in the initrd, not the kernel value.  The kernel value is for when you skip s2disk and use in-kernel suspend.

----------

## rogerdv

The script produces 2 errors. One saying that sda7 is unknown or something (excuse my imprecission, I dont have the pc here) and other related to /newroot.

----------

## Hu

That suggests that (1) you do not have the relevant device node available or the kernel does not know how to drive it and (2) that you may be missing /newroot.  In the context of the initramfs rescue shell, what is the output of find / -ls?

----------

## rogerdv

Are you sure the syntax is right? That just displays the find help. If I change / for \ then I get an error: -ls: commando or directory not found.

----------

## Hu

That syntax works for me with GNU find.  However, it seems that busybox find does not understand it.  If you cannot readily use GNU find, then please provide the output of /bin/busybox find / instead.  This is less informative, but may still be adequate.

----------

