Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
systemd, X, and tmux (or screen) sessions: cgroups?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6780

PostPosted: Sun Sep 07, 2014 7:19 am    Post subject: systemd, X, and tmux (or screen) sessions: cgroups? Reply with quote

When playing with systemd, I observed an extremely annoying behaviour:

All detached tmux/screen sessions are killed (together with all tasks they are running) when the Xsession is killed (e.g. with Ctrl-Alt-Backspace).
This does not appear with openrc.

I conjecture the reason is that systemd starts the X session in a separate cgroup and killls the whole cgroup.

Is it possible to avoid this nonsense of systemd for the X session, e.g. by modifying the displaymanager.service correspondingly?

If it plays a role: I am using slim.service as displaymanager.service which has besides the ExecStart= value only Restart=on-failure.
Back to top
View user's profile Send private message
franzf
Advocate
Advocate


Joined: 29 Mar 2005
Posts: 4565

PostPosted: Sun Sep 07, 2014 9:54 am    Post subject: Reply with quote

Ggl for "systemd cgroups tmux" gave me this:
http://sourceforge.net/p/tmux/mailman/message/27584499/
It's from 2011, hope that still applies for systemd. But as libcgroup is still around I think it does.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6780

PostPosted: Sun Sep 07, 2014 10:14 am    Post subject: Reply with quote

Thanks; I got only different results with these keywords.
So it seems the systemd concept is indeed as broken as I conjectured.
Unfortunately, the hack around the systemd limitations is only a linked tarball in that thread which is not available anymore... Moreover, I am afraid that this works only for tmux sessions which you create as root, or can one exit a cgroup also as a user without special permission?
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6780

PostPosted: Mon Sep 15, 2014 3:09 pm    Post subject: Reply with quote

The problem is still unsolved: I was not able to produce a libcgroup file which worked for me.
Moreover, I would like to avoid installation of libcgroup (e.g. gentoo's init.d-files are non-POSIX and thus do not work properly on openrc).

Actually, the problem even has sharpened: Even when logging in through ssh, it is not possible to keep a task running through tmux when systemd was booted.

It seems that this problem is yet another show-stopper for systemd...
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6780

PostPosted: Wed Sep 17, 2014 8:36 am    Post subject: Reply with quote

As expected, the systemd maintainers reacted to the valid request (by somebody else) only with their usual mixture of arrogance and cluelessness:
clueless guy wrote:
And if you have a nohuped process that can lose the data if someone SIGKILLs it then you certainly deserve it

So, in the first place you deserve a broken log if you use systemd as this is apparently still not able to produce atomc comits.

For me, this nonsense is probably the end of my systemd experiments: Systemd boycotts working software intentionally, so my init-system related software will in future boycott systemd. Perhaps I will not remove the currently existing systemd units, but I will certainly not do anything if they break, and nobody will receive corresponding support from me: Switch to a sane init-system written by people who are right in their mind if you want support from me.

Here is a "workaround" for the systemd insanity which I found despite the cooperation of systemd upstream.
As expected, it only works if you start screen/tmux/nohup as root, or you need to hack around with SUID/sudo - I found no secure solution for the latter which guarantees that only screen/tmux/nohup get these privileges without a password.

/usr/bin/tmux-persistent wrote:
#!/bin/sh
printf '%s' "${$}" >|/sys/fs/cgroup/systemd/user.slice/tasks
exec tmux "${@}"


As expected, all these things are not properly documented in systemd, so it is possible that this script has rather unexpected side effects and might turn out to be a security hole.
If you use systemd, you should not consider your system safe anyway: This would require maintaining by sensible people who have a proper concept and not working from one hack to another and declaring the working solutions as broken.

Edit: Fix typos.


Last edited by mv on Wed Sep 17, 2014 10:16 am; edited 1 time in total
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6065
Location: Removed by Neddy

PostPosted: Wed Sep 17, 2014 9:58 am    Post subject: Reply with quote

that is quiet bad but unfortunately not surprising...
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum