I need to replace systemd with pm-utils for suspension in XFCE (xfce4-session-logout )


referring to my previuous post

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.

How I can to do that?

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:

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 :slight_smile:

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. :wink:

1 Like

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 :smiley:) 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…

In facts I was talking about overriding the syemd unit, not a config file, and I reported my direct experience :slight_smile:

Furthermore the way which I used, is also reported in the Arch Wiki:

Replacement unit files

To replace the unit file /usr/lib/systemd/system/unit , create the file /etc/systemd/system/unit and reenable the unit to update the symlinks:

systemd units are config files :rofl:
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…

I have the habit to see config files with the *.conf extensions :slight_smile:

Habbit and reality are different things, keeping correct terms is what is best :wink:

Well, if we want to be precise and use correct terms, we can look at the official documentation:

So, we should call them "plain text ini-style file that encodes information about a service, a socket, a device and so on " :wink:

  • A conf file = a configuration file.
  • 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 :wink:

Anyhow lets not derail further from the topic :rofl:
:coffee::tea: :cup_with_straw::pizza:

1 Like

We’ve talked about the same thing: I talked about unit files and you about config files :slight_smile:
And I would avoid philosofical things :smiley:


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 :slight_smile:

:+1: to you