You are not logged in.
Pages: 1
I have created a service that saves a kde session
Now I want it to start it before poweroff.target so that when I issue systemctl poweroff it saves my kde session and then my system shuts down
I added kde-save-session.service dependencies to poweroff.target
[Unit]
Description=Power-Off
Documentation=man:systemd.special(7)
DefaultDependencies=no
Requires=systemd-poweroff.service kde-save-session.service
After=systemd-poweroff.service
Before=kde-save-session.service
AllowIsolate=yes
JobTimeoutSec=30min
JobTimeoutAction=poweroff-force
But now when I issue systemctl poweroff I get this.
Failed to start poweroff.target: Transaction order is cyclic. See system logs for details.
journal:
Found ordering cycle on kde-save-session.service/start
Found dependency on poweroff.target/stop
Found dependency on systemd-poweroff.service/stop
Found dependency on shutdown.target/stop
Found dependency on kde-save-session.service/start
Unable to break cycle
Requested transaction contains an unfixable cyclic ordering dependency: Transaction order is cyclic. See system logs for details.
Any ideas what is going on here?
https://ugjka.net
paru > yay | webcord > discord
pacman -S spotify-launcher
mount /dev/disk/by-...
Offline
It may be a stupid question, but why? Isn't the easiest way to do this by using the KDE session manager? (And for startup, set up autologin and start x automatically)
Offline
At this point I don't even know why, but I just want to know if it is possible.
I'm curious what I'm doing wrong, I want to understand this black magic called systemd
Last edited by ugjka (2015-03-03 17:25:07)
https://ugjka.net
paru > yay | webcord > discord
pacman -S spotify-launcher
mount /dev/disk/by-...
Offline
Is your kde-save-session.service exactly the same as in the post you linked to, or were any changes made? If it's the latter, please post that here as well.
"We may say most aptly, that the Analytical Engine weaves algebraical patterns just as the Jacquard-loom weaves flowers and leaves." - Ada Lovelace
Offline
At this point I don't even know why, but I just want to know if it is possible.
I'm curious what I'm doing wrong, I want to understand this black magic called systemd
Ah ok. Well, read the documentation
I think your problem is that poweroff.target both requires and is before kde-save-session.service. This would mean that if you go to poweroff, you want kde-save-session.service to be done, but you also want the target to be before kde-save-session.service. That is a cyclic dependency, don't you think?
(If I failed to understand the requires directive, please tell me so )
Last edited by runical (2015-03-03 18:46:37)
Offline
ugjka wrote:At this point I don't even know why, but I just want to know if it is possible.
I'm curious what I'm doing wrong, I want to understand this black magic called systemdAh ok. Well, read the documentation
I think your problem is that poweroff.target both requires and is before kde-save-session.service. This would mean that if you go to poweroff, you want kde-save-session.service to be done, but you also want the target to be before kde-save-session.service. That is a cyclic dependency, don't you think?
(If I failed to understand the requires directive, please tell me so )
The documentation for Requires= seems to say otherwise.
Note that requirement dependencies do not influence the order in which services are started or stopped.
So it should be okay that poweroff.target requires kde-save-session.service and is also loaded before it.
If that is true though, then I don't see why there is a cyclic dependency...
Edit: and from Before=, After=:
Note that this setting is independent of and orthogonal to the requirement dependencies as configured by Requires=.
Last edited by nullified (2015-03-03 18:58:23)
"We may say most aptly, that the Analytical Engine weaves algebraical patterns just as the Jacquard-loom weaves flowers and leaves." - Ada Lovelace
Offline
Hmm. Ok, thanks for the explanation. Seems I have some reading to do.
It is strange though. This would mean that the only way there can be a cyclic dependency is if kde-save-session.service requires poweroff.target.
Offline
I asked the nice people in #systemd.
man systemd.service
and notice the bit about
DefaultDependencies
By default, this is set to true. You need to set it to false.
Unless DefaultDependencies is set to false, service units will implicitly have dependencies of type Requires= and After= on basic.target as well as dependencies of type Conflicts= and Before= on shutdown.target. These ensure that normal service units pull in basic system initialization, and are terminated cleanly prior to system shutdown. Only services involved with early boot or late system shutdown should disable this option.
This was a good learning experience, whether or not you actually use the service file!
The cycle was this:
poweroff.target requires systemd-poweroff.service and kde-save-session.service
systemd-poweroff.service requires shutdown.target
kde-save-session.service CONFLICTS with shutdown.target
Hence, poweroff.target both requires and conflicts with shutdown.target
Last edited by nullified (2015-03-03 20:13:01)
"We may say most aptly, that the Analytical Engine weaves algebraical patterns just as the Jacquard-loom weaves flowers and leaves." - Ada Lovelace
Offline
Maybe this helps: https://bbs.archlinux.org/viewtopic.php?id=188858
Offline
Pages: 1