0

I am on Mac OS X 10.5.8. I am not sure exactly when this started happening, but I find that when I re-attach to a screen session that was started from an ssh session, anything relying on dscl (directory services), or the underlying getent stuff, fails.

If I start the session on that machine in Terminal, everything works. Only remotely started screen sessions have problems when re-attached.

$ dscl . -list /Users
>> works

$ screen
$ dscl . -list /Users
>> works

[detached]

$ dscl . -list /Users
>> works

$ screen -x
$ dscl . -list /Users
Operation failed with error: eServerNotRunning

Also failing:

$ whoami
504

I have rebooted, debugged, and googled for about 6 hours now with no luck.

It is really painful since it affects lots of applications (ssh, git, rake, etc).

I am curious if this is affecting anyone else, or if anyone has any idea how to fix it.

Drew Stephens
  • 17,207
  • 15
  • 66
  • 82
apinstein
  • 5,105
  • 1
  • 23
  • 22
  • I ran into the same problem of dscl not working and with the same error and not re-attaching from screen made it dscl work again. Thanks! – momeara Aug 05 '10 at 15:01
  • I have investigated this a bit further. It seems if I start screen from a remote login (ie ssh) then screen is set up quite differently somehow. Just sharing a data point. If screen is started from Terminal, it behaves much better. – apinstein Nov 13 '10 at 16:21

1 Answers1

2

Here's a sample within two accounts on the same machine (OS 10.5.8). Could not test it while on ssh, sorry. Consider:

1st account = one
2nd account = two

Assume being logged to "one":

one$ screen
one$ dscl . -list /Users >> works

Now while logged to "two":

two$ su - one
Password:

one$ script /dev/null

Script started, output file is /dev/null

bash-3.2$ screen -x
bash-3.2$ dscl . -list /Users >> works

That's it ;)

If curious: Stackoverflow: Why does redirecting 'script' to /dev/null/ allow 'screen' to work while su'ed as another user?

Community
  • 1
  • 1
  • Your test isn't really relevant; I stipulated in my question that it works in the situation you just tested. – apinstein Jun 04 '11 at 16:30