Both sides previous revisionPrevious revisionNext revision | Previous revision |
dcore:suspending [2018/07/14 14:43] – [Suspending] sm8ps | dcore:suspending [2018/07/20 16:37] (current) – + [X-tweaks] sm8ps |
---|
| |
=== Quirks === | === Quirks === |
pm-suspend comes with some quirks available through ''--quirk-*'' options. See the [[http://manpages.ubuntu.com/manpages/bionic/en/man8/pm-suspend.8.html|man-page]] for details. | ''pm-suspend'' as well as ''pm-suspend-hybrid'' come with some quirks available through ''--quirk-*'' options. See the [[http://manpages.ubuntu.com/manpages/bionic/en/man8/pm-suspend.8.html|man-page]] for details. |
==== Hibernation ==== | ==== Hibernation ==== |
PM-utils does hibernation, i.e. suspending to disk, as well and should put the computer safely to sleep. | PM-utils does hibernation, i.e. suspending to disk, as well and should put the computer safely to sleep. |
A swap partition must exist, of course, and dCore will detect and use it on its own (unless the NOSWAP boot-code was set). | A swap partition must exist, of course, and dCore will detect and use it on its own (unless the NOSWAP boot-code was set). |
| |
In order for the system to know at boot where it should look for hibernation data, the [[https://www.kernel.org/doc/Documentation/kernel-parameters.txt|kernel parameter]] ''resume='' must be included in the boot stanza. It takes a device file name as paramater. (Contrary to what the above linked docs say, I have been unable to successfully use ''PARTUUID=<uuid>'' or ''UUID=<uuid>''.) | === Boot-Code === |
| In order for the system to know at boot where it should look for hibernation data, the [[https://www.kernel.org/doc/Documentation/kernel-parameters.txt|kernel parameter]] ''resume='' must be included in the boot stanza. It takes a device file name as parameter. (Contrary to what the above linked docs say, I have been unable to successfully use ''PARTUUID=<uuid>'' or ''UUID=<uuid>''.) |
| |
=== Selection of swap partition === | === Selection of swap partition === |
When several different installations are present on a machine, one single swap partition will not suffice for holding the various hibernation images. Usually, Linux installations use a static '/etc/fstab' where the swap partitions are specified. dCore, however, dynamically generates that file upon system boot and lists any detected swap partition. Upon hibernating, it risks to over-write the hibernation image of a different installation. | When several different installations are present on a machine, one single swap partition will not suffice for holding the various hibernation images. Usually, Linux installations use a static '/etc/fstab' where the swap partitions are specified. dCore, however, dynamically generates that file upon system boot and lists any detected swap partition. The list of swap spaces can been read from '/proc/swaps'. |
| |
To overcome this issue, one can create a separate swap partition for dCore and selectively disable the other swap partitions by adding ''sudo swapoff <PARTITION>'' to '/opt/bootsync.sh'. Options for specifying the partition are listed by ''swapoff -h''. | Upon hibernating, dCore risks to over-write the hibernation image of a different installation. To overcome this issue, one can create a separate swap partition for dCore and selectively disable the other swap partitions by adding ''sudo swapoff <PARTITION>'' to '/opt/bootsync.sh'. Options for specifying the partition are listed by ''swapoff -h''. |
==== Adding menu entries to Openbox for suspending ==== | |
Making the commands for suspending available through the Openbox menu is similar the menu tweaks applied to [[dcore:migrating_from_flwm_to_lxde?&#openbox-menu|LXDE]]. For LXDE itself, a more elaborate [[dcore:migrating_from_flwm_to_lxde?&#menu_entries_and_panel_buttons_for_suspending_to_ram_or_disk|outline]] is available. | |
| |
First create '~/.config/openbox/pm-utils.xml' with the following content. | ==== X-tweaks ==== |
<code><?xml version="1.0" encoding="UTF-8"?> <openbox_menu xmlns="http://openbox.org/3.5/menu"> | Start-up scripts under '~/.X.d.' risk not being executed upon wake-up or resume. To have them triggered anew, they need to be executed by pm-utils via a hook. For this purpose, create an executable file '/usr/lib/pm-utils/sleep.d/10XdC' with the following content adapted to your needs: |
<menu id="pm-utils-menu" label="PM-Utils"> | <code> |
<item label="Suspend"> <action name="Execute"><command>sudo pm-suspend</command> </action> </item> | #!/bin/sh |
<item label="Hibernate"> <action name="Execute"> <command>sudo pm-hibernate</command> </action> </item> | case "$1" in |
</menu> </openbox_menu> | hibernate|suspend) |
| ;; |
| thaw|resume) |
| ~/.X.d/<SCRIPT> |
| ;; |
| *) |
| ;; |
| esac |
| exit $? |
</code> | </code> |
| |
Then add a reference to this file in '~/.config/openbox/rc.xml' (or '~/.config/openbox/lxde-rc.xml' when using LXDE). That is, add ''<file>pm-utils.xml</file>'' to the ''<menu>''-section (around line 601 in 'rc.xml', line 541 in 'lxde-rc.xml'). | ===== Adding menu entries to Openbox for suspending ===== |
| The commands for suspending and hibernating can be made available through the Openbox menu in a similar fashion to the menu tweaks applied to [[dcore:migrating_from_flwm_to_lxde?&#openbox-menu|LXDE]]. For LXDE itself, a more elaborate [[dcore:migrating_from_flwm_to_lxde?&#menu_entries_and_panel_buttons_for_suspending_to_ram_or_disk|outline]] is available. |
| |
Finally, make the menu available by adding the following to the section ''<menu id="root-menu" label="Openbox 3">'' of '~/.config/openbox/menu.xml'. | First create '~/.config/openbox/pm-utils.xml' with the following content, adapting the commands as suitable. |
| <code> |
| <?xml version="1.0" encoding="UTF-8"?> |
| <openbox_menu xmlns="http://openbox.org/3.5/menu"> |
| <menu id="pm-utils-menu" label="PM-Utils"> |
| <item label="Suspend"> |
| <action name="Execute"> |
| <command>sudo pm-suspend</command> |
| </action> |
| </item> |
| <item label="Hibernate"> |
| <action name="Execute"> |
| <command>sudo pm-hibernate</command> |
| </action> |
| </item> |
| </menu> |
| </openbox_menu> |
| |
| </code> |
| |
| Then add a reference to this file in '~/.config/openbox/rc.xml' (or '~/.config/openbox/lxde-rc.xml' when using LXDE). That is, add ''<file>pm-utils.xml</file>'' somewhere to the ''<menu>''-section (around line 601 in 'rc.xml', line 541 in 'lxde-rc.xml') //before// the closing ''<file>menu.xml</file>''. |
| |
| Finally, make the menu available by adding the following to the section ''<menu id="root-menu" label="Openbox 3">'' of '~/.config/openbox/menu.xml' at the desired location. |
| |
<code><menu id="pm-utils-menu"/></code> | <code><menu id="pm-utils-menu"/></code> |