I have screen session "main", started in /dev/ttySAC0 and sh, started in /dev/ttySAC0 (outside screen session) with input, output and error streams, redirected to pseudoterminal /dev/pts/1. When I attach to /dev/pts/1 terminal and try to run screen -r main, it fails with:

WriteMessage: Bad file descriptor

But creating new screen session with screen works fine. Furthermore, if I run screen -r main in this screen session, I got screen with my saved session in another screen session. It's not usefull, but it's works.

Even if I starts new session in /dev/pts/1, detatch from it and try to revive it, I got same error.

3 Answers 3


Run screen -d, find the screens and run screen -R [screen_name].


Try adding the line defnonblock on to your ~/.screenrc file.

When I began having the same problem I found a few posts mentioning that it fixed their issues. It fixed mine.

  • It didn't help.
    – Paboka
    Feb 13, 2017 at 5:29

It happens if I have a screen with the same name as another screen + more text after it, the screen name without the extra text breaks, ie

~$ screen -ls
        7385.foo-screen      (02/27/2020 12:03:41 AM)        (Detached)
        7296.foo-screen-2    (02/27/2020 12:00:48 AM)        (Detached)


~$ screen -r foo-screen-2 


~$ screen -r foo-screen 
WriteMessage: Bad file descriptor


~$ screen -r 7385.foo-screen 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .