OK - there may be some general hate leveled at systemd, and distros devoted just to its absence…
It’s here, to stay, aint no getting away from it. The writing was on the wall when Sun still owned Solaris, and they were heavily pushing “SMF” (system management framework, to replace SystemV init).
Anyway - I’ve always found the “systemd --user OPERATOR SERVCE” functionality - VERY useful - works FLAWLESSLY on every Debian and Ubuntu I’ve tried it on…
Red Hat world? NEIN! IST VERBOTEN IST DER BLINKENBUMSEN
Here’s my problem :
I want Resilio Sync (RSL or resiliosync) to run for my user, when a computer boots up.
I do this via:
sudo loginctl enable-linger $USERNAME
… sweet - so far, so good…
I enable it to run for my username with “systemd --user enable $SERVICE” and I can start it via “systemd --user start $SERVICE” (note sudo is not needed, in fact sudo will probably break this) - and that works a treat on Debian and Ubuntu…
But Red Hat and Fedora? NO!
This works:
systemctl --user start resilio-sync.service
- but this doesn’t :
╭─x@fenriz ~/ResilioSync/bigguns/binaries/LinuxSOE
╰─➤ systemctl --user enable resilio-sync.service
Unit /usr/lib/systemd/user/resilio-sync.service is added as a dependency to a non-existent unit multi-user.target.
“non-existent unit multi-user.target”
I don’t even know WTF that means! But the nutshell is that it DOESN’T WORK like on Debian and Ubuntu. EXACT same result on RHEL 8 (x2) and Fedora 35.
I"m google-fu’ing the f–k out of the intert00bs to find an answer, and haven’t hit anything yet…
So here’s the FIX - but - it shouldn’t have to BE LIKE THIS! Why is it so??? (I exclaim in anguish and rage) :
sudo vi ~/.config/systemd/user/multi-user.target.wants/resilio-sync.service
Find “[Install]” stanza :
[Install]
WantedBy=multi-user.target
Do this :
[Install]
# WantedBy=multi-user.target
WantedBy=default.target
then
╭─x@rhel8000 ~
╰─➤ systemctl --user enable resilio-sync.service
Reboot (to verify it works over reboots) :
╭─x@rhel8000 ~
╰─➤ systemctl --user status resilio-sync.service
● resilio-sync.service - Resilio Sync service
Loaded: loaded (/usr/lib/systemd/user/resilio-sync.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2022-03-31 11:44:08 AWST; 7min ago
Docs: https://help.getsync.com/
Process: 1120 ExecStartPost=/bin/sleep 1 (code=exited, status=0/SUCCESS)
Process: 1108 ExecStart=/usr/bin/rslsync --config /home/x/.config/resilio-sync/config.json (code=exited, status=0/SUCCESS)
Process: 1101 ExecStartPre=/etc/resilio-sync/init_user_config.sh (code=exited, status=0/SUCCESS)
Main PID: 1119 (rslsync)
CGroup: /user.slice/user-1000.slice/user@1000.service/resilio-sync.service
└─1119 /usr/bin/rslsync --config /home/x/.config/resilio-sync/config.json
Mar 31 11:44:06 rhel8000 systemd[1057]: Starting Resilio Sync service...
Mar 31 11:44:08 rhel8000 systemd[1057]: Started Resilio Sync service.
DIRTY STEENKING “ENTERPRISE” LINUX
That’s how I fixed it anyway - but it’s a PITA to have to do it on multiple computers… I’m also not convinced that’s the “right answer” to this problem either…
I fully expect this issue will probably also exist on OEL 8 (Orrible Enterprise Linux) and whatever it is that’s replacing CentOS (Rocky?).