You are not logged in.
I'm trying to set up an imwheel user service to run as part of my systemd startup. To do so, I followed the steps on the Arch wiki and created the following ~/.config/systemd/user/imwheel.service file:
[Unit]
Description=IMWheel
Wants=display-manager.service
After=display-manager.service
[Service]
Type=simple
#Next line is only required for Xorg, should be removed for Wayland
Environment=XAUTHORITY=%h/.Xauthority
ExecStart=/usr/bin/imwheel -d
ExecStop=/usr/bin/pkill imwheel
RemainAfterExit=yes
[Install]
WantedBy=graphical-session.targetThis file is a copy of the example file that is provided on the Arch wiki at Run IMWheel on startup using a service.
I then executed the following commands to reload the systemd manager configuration, enable the user unit, and start it:
kingsparrow% systemctl --user daemon-reload
kingsparrow% systemctl --user start imwheel.service
kingsparrow% systemctl --user enable imwheel.serviceThis allows imwheel to start without issue:
kingsparrow% systemctl --user status imwheel.service
● imwheel.service - IMWheel
Loaded: loaded (/home/nost/.config/systemd/user/imwheel.service; enabled; preset: enabled)
Active: active (running) since Sat 2023-10-07 10:22:11 CEST; 28s ago
Main PID: 1670 (imwheel)
Tasks: 1 (limit: 38398)
Memory: 1.0M
CPU: 2ms
CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/imwheel.service
└─1670 /usr/bin/imwheel -d
Oct 07 10:22:11 kingsparrow systemd[674]: Started IMWheel.
Oct 07 10:22:11 kingsparrow imwheel[1670]: INFO: imwheel is not running as a daemon.
Oct 07 10:22:11 kingsparrow imwheel[1670]: INFO: imwheel started (pid=1670)However, after rebooting the system, the user unit does not run. This is the status of the user unit after booting and logging in:
kingsparrow% systemctl --user status imwheel.service
○ imwheel.service - IMWheel
Loaded: loaded (/home/nost/.config/systemd/user/imwheel.service; enabled; preset: enabled)
Active: inactive (dead)What would be the steps do figure out why the service does not run automatically after boot, and ensure it does?
Last edited by n0stalghia (2023-10-08 08:46:40)
Offline
i think this is your problem:
Wants=display-manager.service
After=display-manager.serviceyou either need to change this to your display manager service (if you use one) or change it to 'graphical.target'
Offline
Thanks for the suggestions! Unfortunately, didn't solve my issue. I disabed the service, reloaded daemon (not sure if needed) and then enabled the user unit again, and it was still Active: inactive (dead) after reboot. Those were the commands I used:
systemctl --user disable imwheel.service
systemctl --user daemon-reload
systemctl --user enable imwheel.serviceAnd the two imwheel.service configurations:
Wants=graphical.target
After=graphical.targetand with LightDM:
Wants=lightdm.service
After=lightdm.serviceI use lightDM and i3wm, in case that helps narrow down the issue.
In case someone else with a similar issue is reading this: I could circumvent it by just executing the imwheel command in my i3 config, but I'd like to understand what the problem is with systemd to better understand it.
Offline
ok so i did a bit of playing around and it looks like your much better off just launching it from i3.
-systemd-user runs seperately from systemd-system so systemd-user cannot use systemd-system for "wants" and "after"
-i3 does not trigger systemd-user graphical-session.target: https://github.com/i3/i3/issues/5186
-so as a workaround you can change
WantedBy=graphical-session.targetto
WantedBy=default.targetBUT that will not wait for a graphical session, you can work around it... see that same link above, but at that point your just making life hard for yourself and may as well just use i3 to launch it.
Offline
ok so i did a bit of playing around and it looks like your much better off just launching it from i3.
-systemd-user runs seperately from systemd-system so systemd-user cannot use systemd-system for "wants" and "after"
-i3 does not trigger systemd-user graphical-session.target: https://github.com/i3/i3/issues/5186
-so as a workaround you can changeWantedBy=graphical-session.targetto
WantedBy=default.targetBUT that will not wait for a graphical session, you can work around it... see that same link above, but at that point your just making life hard for yourself and may as well just use i3 to launch it.
Ok, wow, thanks for spending this much time on the issue! I assumed it was some error on my part, didn't expect there to be so many underlying hindrances.
So, for anyone reading, this is my solution: I added this to my i3 config file (for example, ~/.config/i3/config)
exec --no-startup-id imwheelOffline