Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 482292 - app-misc/screen and systemd do not work together
Summary: app-misc/screen and systemd do not work together
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo systemd Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-24 06:00 UTC by Justin Lecher (RETIRED)
Modified: 2013-09-22 10:37 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Lecher (RETIRED) gentoo-dev 2013-08-24 06:00:31 UTC
When starting a screen session on a systemd system and leaving the system, the screen session gets closed.

You find several stuff on the net, but I didn't find any solution. Please fix the package or at the necessary explanaitions and workarouds to the wiki.
Comment 1 Pacho Ramos gentoo-dev 2013-08-24 07:33:05 UTC
Justin, could you look at:
http://pkgs.fedoraproject.org/cgit/screen.git/tree/screen.spec#n105

?
Comment 2 Justin Lecher (RETIRED) gentoo-dev 2013-08-24 07:43:16 UTC
I doubt that would make a difference. I allready have this dir. But will test it anyways.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-24 08:22:33 UTC
It's most likely 'KillUserProcesses=yes' in default logind config. You can either disable that (uncomment the thing in /etc/systemd/logind.conf), or make screen leave the user's cgroup. Not sure if the latter if possible without root privileges :).
Comment 4 Justin Lecher (RETIRED) gentoo-dev 2013-08-24 08:26:06 UTC
(In reply to Michał Górny from comment #3)
> It's most likely 'KillUserProcesses=yes' in default logind config. You can
> either disable that (uncomment the thing in /etc/systemd/logind.conf), or
> make screen leave the user's cgroup. Not sure if the latter if possible
> without root privileges :).

I tested it with

[Login]
KillUserProcesses=no
KillExcludeUsers=root justin


but it didn't work.

And manually hacking the cgroups cannot be the solution.
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-24 08:34:50 UTC
But does the session get closed on your logout or after some random time, or...?
Comment 6 Pacho Ramos gentoo-dev 2013-08-24 08:38:56 UTC
Lennart looks to suggest the usage of pam_systemd:
http://comments.gmane.org/gmane.comp.sysutils.systemd.devel/2379

This also have showed me that this can be configured (for the case of leaving commands running via ssh, that is not your case but can affect others) in unit file:
http://patches.openembedded.org/patch/49233/
Comment 7 Justin Lecher (RETIRED) gentoo-dev 2013-08-24 08:42:49 UTC
(In reply to Michał Górny from comment #5)
> But does the session get closed on your logout or after some random time,
> or...?

When I close the ssh session it is gone.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-08-24 08:46:21 UTC
Yes, do you have pam_systemd in /etc/pam.d/system-login?
Comment 9 Justin Lecher (RETIRED) gentoo-dev 2013-08-24 08:48:21 UTC
(In reply to Michał Górny from comment #8)
> Yes, do you have pam_systemd in /etc/pam.d/system-login?

$ grep systemd /etc/pam.d/system-login
-session	optional	pam_systemd.so
Comment 10 Justin Lecher (RETIRED) gentoo-dev 2013-08-24 08:48:40 UTC
(In reply to Pacho Ramos from comment #6)
> http://patches.openembedded.org/patch/49233/

this patch doesn't help here.
Comment 11 Pacho Ramos gentoo-dev 2013-09-21 14:04:19 UTC
Were you able to solve this? :/
Comment 12 Justin Lecher (RETIRED) gentoo-dev 2013-09-21 14:27:24 UTC
(In reply to Pacho Ramos from comment #11)
> Were you able to solve this? :/

no. Perhaps we should check with fedora and opensuse, how they do the trick.
Comment 13 Pacho Ramos gentoo-dev 2013-09-21 14:47:06 UTC
I already searched but only found the links I already posted :(
Comment 14 Alexander Tsoy 2013-09-21 18:36:59 UTC
I can't reproduce this. How fast screen session gets closed?
Comment 15 Alexander Tsoy 2013-09-21 19:22:48 UTC
(In reply to Justin Lecher from comment #9)
> (In reply to Michał Górny from comment #8)
> > Yes, do you have pam_systemd in /etc/pam.d/system-login?
> 
> $ grep systemd /etc/pam.d/system-login
> -session	optional	pam_systemd.so

Check the full chain please:

$ grep session /etc/pam.d/sshd
session	   include	system-remote-login
$ grep session /etc/pam.d/system-remote-login 
session		include		system-login
$ grep 'session.*systemd' /etc/pam.d/system-login  
-session	optional	pam_systemd.so
Comment 16 Justin Lecher (RETIRED) gentoo-dev 2013-09-22 10:37:50 UTC
I tried it again and now it works here.