Open aiguofer opened 5 years ago
uh, this is weird... have you checked if there's anything in the logs of someone removing that symlink? systemd should not do anything like that...
yeah I tried grepping journalctl for anything related to tmux and can't seem to find anything in there.
I'm currently working around the issue by changing the script that starts started.target
to:
# hack to work around https://github.com/systemd/systemd/issues/12981
systemctl --user enable tmux
dbus-update-activation-environment --systemd PATH XDG_CURRENT_DESKTOP XDG_DATA_DIRS XDG_MENU_PREFIX XDG_RUNTIME_DIR XDG_SEAT XDG_SESSION_DESKTOP XDG_SESSION_ID XDG_SESSION_TYPE XDG_VTNR SSH_AUTH_SOCK DBUS_SESSION_BUS_ADDRESS QT_QPA_PLATFORMTHEME
systemctl --user start started.timer
I'm on a single user system so it'd have to be "something" rather than "someone".
do you have any of those XDG path env vars set?
@poettering yeah, XDG_CURRENT_DESKTOP
, XDG_DATA_DIRS
, XDG_RUNTIME_DIR
, XDG_SEAT
, XDG_SESSION_DESKTOP
, XDG_SESSION_ID
, XDG_SESSION_TYPE
, XDG_VTNR
are all set.
I start most of my session processes using systemd and I kept running into issues where some programs weren't getting the ENV vars they needed. I started just copying my entire environment and my problems went away. At some point, I started having problems copying the entire environment (I believe due to malformed variables) so I took a list of everything that seemed important and dumped it there. I'm not sure I need all of those, but I never felt like 'optimizing'.
That being said, I wouldn't imagine that would cause that 1 service to auto-deactivate.
Something I did notice after adding my hack to enable the service before starting. It seems like it gets disabled right after starting. Now, every time I reboot:
$ systemctl --user status tmux.service
● tmux.service - Start my tmux session
Loaded: loaded (/home/aiguofer/.local/share/systemd/user/tmux.service; disabled; vendor preset: enabled)
Active: active (exited) since Thu 2019-07-11 17:56:33 MDT; 27min ago
Process: 5155 ExecStart=/usr/bin/tmux start-server (code=exited, status=0/SUCCESS)
Main PID: 5155 (code=exited, status=0/SUCCESS)
CGroup: /user.slice/user-1000.slice/user@1000.service/tmux.service
So it does indeed get enabled by my hack, it does get started when started.target
starts, but then it shows that the service is disabled.
I can confirm the same behaviour, also with Ubuntu 19.04 and systemd v240.
Enabling or disabling linger also has no effect.
My XDG variables are set as follows:
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SESSION_CLASS=user
XDG_SESSION_ID=1
XDG_SESSION_TYPE=tty
XDG_VTNR=1
systemd version the issue has been seen with
Used distribution
Unexpected behaviour you saw
Steps to reproduce the problem
~/.local/share/systemd/user/tmux.service
:[Service] RemainAfterExit=yes ExecStart=/usr/bin/tmux start-server ExecStop=/usr/bin/tmux kill-server
[Install] WantedBy=started.target
tmux.service
is disabled (although sometimes it does start):Jul 07 22:58:32 X1-Carbon-Diego systemd[2385]: Started Start my tmux session.