Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dcore:suspending [2015/07/07 12:49] – created sm8psdcore:suspending [2018/07/20 16:37] (current) – + [X-tweaks] sm8ps
Line 8: Line 8:
 <code>echo mem | sudo tee /sys/power/state</code> <code>echo mem | sudo tee /sys/power/state</code>
  
-If this command should fail then one may need to un-load some kernel modules beforehand. Check ''dmesg'' as well as the system log to find out more (cf. the [[http://forum.tinycorelinux.net/index.php/topic,16220.msg96173.html#msg96173|forum]] forum to get an idea). +If this command should fail then one may need to un-load some kernel modules beforehand. Check ''dmesg'' as well as the system log to find out more (cf. the [[http://forum.tinycorelinux.net/index.php/topic,16220.msg96173.html#msg96173|forum]] forum to get an idea). See also below for some quirks provided by the PM-tools.
 ===== PM-utils ===== ===== PM-utils =====
 [[http://manpages.ubuntu.com/manpages/trusty/man8/pm-action.8.html|PM-utils]] is a suite of commands that handle kernel modules in the context of suspending to RAM or disk. The following code prints out the supported methods. [[http://manpages.ubuntu.com/manpages/trusty/man8/pm-action.8.html|PM-utils]] is a suite of commands that handle kernel modules in the context of suspending to RAM or disk. The following code prints out the supported methods.
Line 18: Line 17:
 <code>sudo pm-suspend</code> <code>sudo pm-suspend</code>
  
 +=== Quirks ===
 +''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>''.)
  
-==== Adding menu entries to Openbox for suspending ==== +=== Selection of swap partition === 
-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]].+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'.
  
-First create '~/.config/openbox/pm-utils.xmlwith the following content+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''
-<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"> +==== X-tweaks ==== 
-<item label="Suspend"> <action name="Execute"><command>sudo pm-suspend</command> </action> </item+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: 
-<item label="Hibernate"> <action name="Execute"> <command>sudo pm-hibernate</command> </action> </item+<code
-</menu> </openbox_menu>+#!/bin/sh 
 +case "$1in                                                         
 +        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 itselfa more elaborate [[dcore:migrating_from_flwm_to_lxde?&#menu_entries_and_panel_buttons_for_suspending_to_ram_or_disk|outline]] is available.
  
-Finallymake the menu available by adding ''<menu id="pm-utils-menu"/>'' 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 contentadapting 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>
  
 After selecting "Reconfigure Openbox" from "System" in the Openbox menu (right-click on the desktop), the new sub-menu is available. After selecting "Reconfigure Openbox" from "System" in the Openbox menu (right-click on the desktop), the new sub-menu is available.
 +
 +**[[http://wiki.tinycorelinux.net/dcore:welcome|> Return to the dCore Wiki Welcome page]]**
Print/export
QR Code
QR Code dcore:suspending (generated for current page)