uswsusp

µswsusp (userspace software suspend) is a set of user space tools used for hibernation (suspend-to-disk) and suspend (suspend-to-RAM or standby) on Linux systems. It consists of:

s2ram - a wrapper around the kernel's suspend-to-RAM mechanism allowing the user to perform some graphics adapter manipulations from the user land before suspending and after resuming that may help to bring the graphics (and the entire system) back to life after the resume. Incorporates the functionality of vbetool and radeontool as well as some tricks of its own. Includes a list of working hardware configurations along with the appropriate sets of operations to be performed to resume them successfully. This is accomplished by a hardware whitelist maintained by HAL - s2ram translates the HAL database options into s2ram parameters.

Note: Since HAL is deprecated and KMS drivers can save the state of the graphics card directly without userspace quirks, s2ram development is discontinued and no further whitelist entries are accepted. If a KMS driver is in use, s2ram will directly suspend the machine.

s2disk - the reference implementation of the userspace software suspend (µswsusp); it coordinates the steps necessary to suspend the system (such as freezing the processes, preparing the swap space, etc.) and handles image writing and reading. s2disk already supports compression and encryption of the image and other features (e.g. a nice progress bar, saving the image on a remote disk, playing tetris while resuming, etc.) can be easily added.

s2both - combines the functionalities of s2ram and s2disk and it is very useful when the battery is almost depleted. s2both writes the system snapshot to the swap (just like s2disk) but then puts the machine into STR (just like s2ram). If the battery has enough power left you can quickly resume from STR, otherwise you can still resume from disk without losing your work.

Installation

Install uswsusp-gitAUR.

Configuration

You must edit before attempting to suspend to disk.

  • If using a swap partition: where must be replaced with the correct block device containing the swap partition.
  • If using a swap file: where and N are the device letter and partition number, respectively, and is the offset from the beginning of the resume device where the swap file's header is located. The resume offset can be obtained by running
  • The parameter (optional) can be used to limit the size of the system snapshot image created by s2disk. If it is not possible to create an image of the desired size, s2disk will suspend anyway, using a bigger image. If image size is set to 0, the image will be as small as possible.
  • The shutdown method parameter (optional) specifies the operation that will be carried out when the machine is ready to be powered off. If set to the machine will be rebooted immediately. If set to the machine will be shut down using special power management operations available from the kernel that may be necessary for the hardware to be properly reinitialized after the resume, and may cause the system to resume faster. If set to the machine will simply be powered down, which may cause trouble for some hardware.
  • If the parameter is set to , the s2disk and resume tools will use the MD5 algorithm to verify the image integrity.
  • If the parameter is set to , the s2disk and resume tools will use the LZF compression algorithm to compress/decompress the image.
  • If splash is set to , s2disk and/or resume will use a splash system. Currently splashy and fbsplash are supported, but they are not available in Arch Linux.
  • The option will introduce a delay after successfully resuming from hibernation, in order to allow the user to read the stats (read and write speed, image size, etc.)
  • If is enabled, s2disk will use several threads for compressing, encrypting and writing the image. This is supposed to speed things up. For details, read the comments in suspend.c

Support for encryption

  • generate a key with the suspend-keygen utility included in the package;
  • write the name of the key in ;
encrypt = y
RSA key file = path_to_keyfile

Recreate initramfs

Edit your file and add "uresume" to the HOOKS entry.

HOOKS="base udev autodetect block uresume filesystems"

and rebuild the ramdisk.

Usage

Standalone

To suspend to disk, run:

# s2disk

To suspend to ram, first run:

# s2ram --test

to see if your machine is in the database of machines known to work. If it returns something like then go ahead and run:

# s2ram

Otherwise, the parameter will be necessary, possibly combined with other parameters (see s2ram --help). It may fail.

Now you could try to suspend directly calling s2disk from the command line:

# s2disk

It is probably necessary to resort to a userspace tool which calls internally s2disk.

With systemd

To put your system into hibernation a.k.a Suspend to Disk with , edit , adding:

After that, execute to put your system into hibernation. Make similar changes to (replace s2disk with s2both) to enable µswsusp-based hybrid sleep.

Troubleshooting

My machine is not whitelisted

If s2ram does not match your machine to an entry in its whitelist, it will output some general purpose identification strings for your machine (the same as those provided ). In this case, you may try to force s2ram to suspend your machine by using .

does not work

If s2ram -f does not work, try the different workarounds offered by s2ram. Run to get a list of the possible options:

Try the following variations:

  s2ram -f -a 1
  s2ram -f -a 2
  s2ram -f -a 3
  s2ram -f -p -m
  s2ram -f -p -s
  s2ram -f -m
  s2ram -f -s
  s2ram -f -p
  s2ram -f -a 1 -m
  s2ram -f -a 1 -s

If none of those combinations work, start again but add the -v switch.

Note that mixing the options and vbetool's options (, , ) is normally only a measure of last resort, it usually does not make much sense.

If you find several combinations that work (e.g. and both work on your machine), the in-kernel method () should be preferred over the userspace methods (, , ).

Verify all combinations in both cases when reporting success to the s2ram developers:

  • when issuing s2ram from console
  • when issuing s2ram from X

s2ram does not work with any combination of options

There is a trick which does not correspond to a command-line option, because it requires additional operations from you. It is marked with NOFB in the whitelist and used for those laptops which suspend and resume properly only if no framebuffer is used. If you verify that no command line option of s2ram works, you can try disabling the framebuffer. To do this, you need to edit your bootloader configuration, remove any possible vga=<foo> values from the kernel line and reboot. This at least if you use the VESAFB framebuffer (as in the Arch default kernel). If you use a different framebuffer driver, refer to the documentation of the driver to see how to disable it.

gollark: Two or more counting user and talk pages
gollark: 93% of extant deities are artificially created and managed by GTech™.
gollark: Your death just creates selection effects in favour of heavserver however. Also we can add you post mortem.
gollark: It leaves the option of you joining later however. Unless you die.
gollark: Even if (when) Discord fails, heavserver will be ported to the next trendy platform.

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.