Power Management: Difference between revisions

change lang=sh to shell session to fix syntax highlighting error
Sandro (talk | contribs)
 
(4 intermediate revisions by 2 users not shown)
Line 30: Line 30:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
  systemd.services.your-service-name = {  
systemd.services.your-service-name = {  
    description = "Service description here";
  description = "Service description here";
    wantedBy = [ "post-resume.target" ];
  wantedBy = [ "post-resume.target" ];
    after = [ "post-resume.target" ];
  after = [ "post-resume.target" ];
    script = ''
  script = ''
     echo "This should show up in the journal after resuming."
     echo "This should show up in the journal after resuming."
    '';
  '';
    serviceConfig.Type = "oneshot";
  serviceConfig.Type = "oneshot";
  };
};
</syntaxhighlight>
</syntaxhighlight>


Line 48: Line 48:


Therefore, an example configuration could look like this:<syntaxhighlight lang="nix">
Therefore, an example configuration could look like this:<syntaxhighlight lang="nix">
/*
// I'm hibernating into a logical volume that's also under LUKS. Pretty cool, right?
  I'm hibernating into a logical volume that's also under LUKS. Pretty cool, right?
*/


swapDevices = [
swapDevices = [
Line 59: Line 57:


boot.resumeDevice = "/dev/dm-7";
boot.resumeDevice = "/dev/dm-7";
</syntaxhighlight>Derived from a system with the following output from <code>swapon -s</code> :<syntaxhighlight>
</syntaxhighlight>Derived from a system with the following output from <code>swapon -s</code> :<syntaxhighlight lang="text">Filename                                Type            Size          Used            Priority
Filename                                Type            Size          Used            Priority
/dev/dm-7                              partition      67108860      00
/dev/dm-7                              partition      67108860      00
/dev/zram0                              partition      32881148      032767
/dev/zram0                              partition      32881148      032767</syntaxhighlight>
 
</syntaxhighlight>


Test and use hibernation with the following command:<syntaxhighlight lang="nix">
Test and use hibernation with the following command:<syntaxhighlight lang="nix">
Line 203: Line 198:
</syntaxhighlight>
</syntaxhighlight>


The <code>pre-sleep-start</code> script referenced by <code>ExecStart</code> contained directives installed by the [[Displaylink]] package, that contained a flush operation which hung the suspend action. Starting <code>dlm.service</code> or running <code>sudo DisplayLinkManager</code> unblocks the script and made suspend work normally.  
In this case, the <code>pre-sleep-start</code> script referenced by <code>ExecStart</code> contained directives installed by the [[Displaylink]] package, that contained a flush operation which hung the suspend action. Starting <code>dlm.service</code> or running <code>sudo DisplayLinkManager</code> unblocks the script and made suspend work normally.  


==== Cancelling an existing suspend action ====
An existing suspend operation that is hung may be interrupted using <code>'''systemctl cancel'''</code> in case reboots or internet access is needed.  
An existing suspend operation that is hung may be interrupted using <code>'''systemctl cancel'''</code> in case reboots or internet access is needed.