I run 16.04 and systemd
now kills tmux
when the user disconnects (summary of the change).
Is there a way to run tmux
or screen
(or any similar program) with systemd
230? I read all the heated disussion about pros and cons of the behavious but no solution was suggested.
(I see the behaviour in 229 as well)
The proper solution is to disable the offending systemd behavior system-wide.
Edit
/etc/systemd/logind.conf
(you must sudo, of course) and setYou can also put this setting in a separate file, e.g.
/etc/systemd/logind.conf.d/99-dont-kill-user-processes.conf
.Then restart
systemd-logind.service
.Based on @Rinzwind's answer and inspired by a unit description the best I could find is to use TaaS (Tmux as a Service) - a generic detached instance of
tmux
one reattaches to.RemainAfterExit=
According to https://unix.stackexchange.com/a/287282/117599 invoking
tmux
usingshould also do the trick.
You need to set the
Type
of the service toforking
, as explained here.Let's assume the service you want to run in
screen
is calledminecraft
. Then you would openminecraft.service
in a text editor and add or edit the entryType=forking
under the section[Service]
.Using Ubuntu 18.04 with systemd version 237, none of the suggested solutions worked for me.
The solution that worked for me was to
/etc/systemd/logind.conf
KillExlcudeUsers
KillExlcudeUsers=root user1 user2
)