Change suspend to suspend-then-hibernate on Ubuntu 22.04

Edit the full unit file as shown below:

sudo systemctl edit --full systemd-suspend.service

This will load the current unit file into the editor.

Insert in the file the contents of /usr/lib/systemd/system/systemd-suspend-then-hibernate.service

When the file is saved, systemctl will create a file at ‘/etc/systemd/system/systemd-suspend.service’.

To apply changes made to the unit, execute:

sudo systemctl daemon-reload

Restart the systemd-suspend service to loads the new service configuration (Unit file must be restated if you modify the running unit file).

sudo systemctl restart systemd-suspend

Any unit file in ‘/etc/systemd/system’ will override the corresponding file in ‘/lib/systemd/system’.

To revert the changes or return to the default configuration of the unit, delete the following custom configuration files:

To remove a full modified unit file, run:

sudo rm /etc/systemd/system/systemd-suspend.service

To apply changes to unit files without rebooting the system, execute:

sudo systemctl daemon-reload

The ‘daemon-reload’ option reloads all unit files and recreates the entire dependency tree.

To check overridden or modified unit files, run:

systemd-delta

Posted

in

by

Tags:

WordPress Appliance - Powered by TurnKey Linux