my problem does not occurs when I use pm-utils (sudo pm-suspend) instead xfce4-session-logout, that use systemd (O.T. : systemd, the supposed bright future for linuxā¦ please come back the support for OpenRCā¦).
So, now I need to suspend my system, with xfce4-session-logout, and maybe lightdm, using pm-utils by default , replacing systemd for manage my pcās suspension.
Let me enlighten you here with respect to your current title:
Systemd is like the kernel, it has many many parts.
Power management is just one of itās functionalities.
The utility you mention is just one functionality so it can not replace systemd as a whole.
If you want to replace the functionality with something else you need to find the right spot in the systemd hierarchy of functionalities.
At moment iām unable to point you to the correct place, but i suggest you to reword your question and title to attract better help.
You have to replicate/override /usr/lib/systemd/system/systemd-suspend.service/etc/systemd/system/systemd-suspend.service (I have done the same and for me is working here.
The ExecStart= line of the original unit is ExecStart=/usr/lib/systemd/systemd-sleep suspend
Overriding such unit in /etc/systemd/system/systemd-suspend.service you can safely change the ExecStart with the pm-suspend command (you have to provide the full path, eg /usr/bin/pm-suspend; and since is running as root, you donāt need sudo.
You can simply do it by running systemctl edit --full systemd-suspend.service
Then run sudo systemctl daemon-reload
I already done that and works flawlessly.
Edit: also xfce4-session-logout is using systemd-suspend.service, so you can continue to suspend as usual.
Override configs are not placed there, they are placed under /etc/systemd/system/systemd-suspend.d/
When he wants to override some part of that service, like the ExecStart= line only, he should use: systemctl edit systemd-suspend
and this in the new file that will be created by that command:
[Service]
ExecStart=
ExecStart=(put full path of new command here)
This wil allow him to keep his modification from interfering with updates to the official service file.
The results wil be visible by using: systemctl cat systemd-suspend
Youāre right: I explained that in such way, because when systemd is updated, such unit only resides under /usr/lib/systemd/system/.
Your suggestion so could be future-proof
However only one ExecStart= line is needed for his/her needs, but is a āoneshotā unit and obviously more than one ExecStart= can be added if needed.
The first one in that override config i showed is to remove the previous one because he needs to replace it.
Else he will end-up with an extra ExecStart command which is not what is intended.
However, despite the fact that is the correct way to override an unit file, I tried (because I also have a similar needs like salome) to place it as /etc/systemd/system/systemd-suspend.d/systemd-suspend.service instead of /etc/systemd/system/systemd-suspend.service and in such way when i run sudo systemctl start systemd-suspend.service , /usr/lib/systemd/system/systemd-suspend.service is executed instead, yeah, because in my edited systemd-suspend.service I have a command which produce some files in the system (and also play a sound on resume ) and has not been executed; as I placed again in /etc/systemd/system/systemd-suspend.service has started to works again.
Maybe this is due the architecture of systemd, which doesnāt like to be replacedā¦ Who knows.
That is not the correct way, you should not place service files in the override directory of a service, only config āsnippetsā will be taken into account.
eg. files ending with .conf which is created with the command i gaveā¦
systemd units are config files
Only time you should ever replace the whole service unit is when it needs complete rewrite, in all other cases an override is the right way to goā¦
A configuration file can be in any language, form or encoding which the interpreter of that file understands.
So in the context of systemd, what you wrote there is a long version of what an override file (.conf) or unit file isā¦
So the term config file is the most general appropriate word for all files interpreted by systemd
Weāve talked about the same thing: I talked about unit files and you about config files
And I would avoid philosofical things
However:
Here have been established various things that has derailed from the OP; so I propose to wait for @salome feedback, to see if has been able to achieve his/her needs