[Solved] Cannot enable post suspend service on Fedora Kinoite

I have two Fedora installations on different SSD drives (I select which SSD to boot from my UEFI). One is Fedora KDE Spin, and the other is Fedora Kinoite.

I have a systemd post suspend service on Fedora KDE Spin that looks like this:

[Unit]
Description=User resume actions
After=suspend.target

[Service]
User=%I
Type=simple
ExecStart=/usr/bin/bash /usr/local/bin/postsuspend.sh

[Install]
WantedBy=suspend.target

It was enabled using “systemctl enable resume@.service”, and the service works fine. The command the script runs is a one liner that doesn’t even require root. When I resume from suspend the command is executed and works correctly.

On Kinoite however I cannot even enable the service. I placed the exact service file you see above in the exact same place (/etc/systemd/system/resume@.service). I also placed my postsuspend.sh script (which I made anew) in /etc/systemd/system as well (because anything /usr is read-only on Kinoite). When I attempt to enable the service file, I get the following error:

Failed to enable unit: Destination unit suspend.target is a non-template unit.

Incidentally I noted that /etc/systemd/system doesn’t have a suspend.target.wants directory! I tried just creating one but I still can’t enable the service.

Strangely Kinoite not only suspends just fine, but it even mentions suspend.target in journalctl:

systemd[1]: Reached target suspend.target - Suspend.

I am at a loss for what to do next. I can’t find the error message above anywhere in a web search, and I don’t understand how exactly Kinoite does this differently than the KDE Spin. Also, I am down in this case for literally any solution that allows me to run a command automagically after suspend.

EDIT Apparently I was inadvertently triggering something with systemd units that I wasn’t aware of- templates. I fixed the issue by changing the service name to “mycustom.service” and changing the “User=%I” to “User=jaymarty”. After this the service enabled and started correctly, and I have confirmed my command runs correctly after resuming from suspend.

I now know I need to learn more about service files :smiley: