Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix up this problem with screen bash command?

I accidently deleted /var/run/screen/S-root/25771.pts-0 and when I try to run screen again

screen bash ...

it reports:

/var/run/screen/S-root/25771.pts-0: No such file or directory

How can I recover it?

like image 832
httpinterpret Avatar asked Dec 04 '22 12:12

httpinterpret


1 Answers

Check to see if you have the environment variable STY set:

[user@machine ~] echo $STY
25771.pts-0

If the variable is set, then you are telling screen to reattach to an existing session. If that session doesn't exist, then you will see the error you are getting.

To solve this, just clear the environment variable by running:

export STY=

and try starting screen again.

This scenario may have occurred because you previously had a screen session running (which setup the STY environment variable for you) which has now closed. For example:

xterm
screen
# The following xterm will inherit the existing STY environment variable.
xterm &
# close the initial xterm, and in the new xterm run the following:
screen

The final call to screen will give you your error, because it still has the environment variable STY from the original (now-gone) screen session.

like image 155
davidg Avatar answered Jan 10 '23 21:01

davidg