EDIT: The initial premise of this question was that screen
didn't work properly on stock Debian Jessie, and I was looking for workarounds. This turns out to be an artifact of a low sample size -- I have since verified that a fresh Debian Jessie install runs screen
correctly, so obviously Something Else is wrong.
The amended question is: I have somehow broken a Debian Jessie system, and the only apparent symptom is that screen
sessions terminate on logout, and there's some circumstantial evidence that dbus connectivity might be involved. Can someone suggest what I might have broken?
I realize this changes it to a broad and possibly un-answerable question, but that's where I'm at now.
Original question continues here:
I know there's been some prior discussion of this, but I can't seem to find all the relevant info in one place, and combining disparate sources is not working for me.
I have a stock Debian "jessie" system, and am unable to ssh into it, run background sessions with the "screen" tool, and have them persist after I exit the parent SSH session. I believe I am running into an issue with systemd sessions, and have taken a number of measures that are supposed to fix it, but it's still not working.
I've read the bug report here: Debian bug report 825394. As a consequence of that research, I ensured that user sessions run the "pam_systemd.so" library in /etc/pam.d/common-session, ran "loginctl enable-linger username" for the account in question, and checked that "KillUserProcesses" is set to "no" in /etc/systemd/login.defs.
I have also followed up on the screen "autodetach" setting, from a prior StackExchange post: StackExchange screen question
With these settings, it seems I should be able to do:
systemd-run --scope --user screen
The issue arising from this is that that systemd-run --user wants to connect to the user's dbus session to reach the user's service manager, and ssh connections do not launch dbus, nor, it seems to me, should they -- the whole point of this operation is to do something whose lifetime is longer than that of the enclosing SSH session, which presumably will (and should) tear down the dbus session when it exits.
I have the feeling that I've gone in a circle, and have come back to the problem of wanting a sub-process to persist after log-out.
Debian Jessie currently ships version 215 of systemd, and version 4.2.1 of screen, which does not, as-packaged, include PAM support.
I have a secondary goal of minimizing the level of intervention on the system -- with sufficient guidance, I could probably craft an /etc/pam.d/screen file, but I am hoping for a simpler solution.
Is there a known set of steps for Debian Jessie in particular that will convince systemd to honor my intentions in this case?
screen
in a systemd transient scope unit, instead of runningscreen
directly? (The latter works fine on Jessie with the default settings.)