# screen autodetach problem



## kattenjanson (Mar 1, 2011)

Hi!

I have come across a rather annoying problem running screen under FreeBSD. It seems that whenever I forget detaching the session properly (I usually ssh from a windows machine using putty), it runs for a few hours after which session hangs. When running *screen -ls*, the session is listed as attached. Doing *screen -D* sometimes generates the output that screen has been power-detached, although when I run *screen -ls* once more - it lists the session as still attached. I have of course read the manual but no option seems to help (been trying a few different flags for resuming screen). My .screenrc is a rather simple one (i.e, the only thing I have changed from defaults is the status bar and button-bindings). 

I am usually able to solve these problems myself and I have been looking through forums and googled the issue but I am unsure how to proceed troubleshooting. Any advice or the like would be greatly appreciated!


----------



## gordon@ (Mar 1, 2011)

I don't bother detaching the other session, just use screen -x.


----------



## kattenjanson (Mar 2, 2011)

Yes, I have tried this as well, although to no avail. It seems that the same problem occurs under archlinux. I might have used the wrong topic, btw. The real issue is that when not detaching properly, the session runs for about 4 or 5 hours then dies. I noticed this when my irssi session pinged out after about the same time. What happens is, I cannot attach the session at all after this has happened.


----------



## mix_room (Mar 3, 2011)

What I do: 


```
log on using SSH (eg Putty)
if (screen_is_running) 
screen -x 
else
screen 
endif
logout (ie. close PuTTy session)
```

This works wonderfully under FreeBSD, my sessions have been inactive for weeks without problems. 

How are you closing the connection?


----------



## kattenjanson (Mar 4, 2011)

The sessions are mainly closed when the lid on my laptop is closed  it seems that screen -x works a bit better than screen -Dr or -dr btw. Not without problems, though, as the problem with irssi persists. When im able to resume the session, alot of the time irssi has simply stopped working and doesnt accept input. When i kill the "window" in which irssi is running, the other "windows" in screen seems to completely stop responding as well (even though they accepted input before killing the irssi-window). I realize that this is not a great problem since having a irc-session running 24/7 might not be the most important thing, but i am rather curious as to why this is happening.


----------



## wblock@ (Mar 4, 2011)

Some people mention sysutils/tmux as a new alternative to sysutils/screen.


----------



## bes (Mar 4, 2011)

I like tmux better than screen.There is a pretty good tutorial online that even has purty pictures.


----------



## kattenjanson (Mar 7, 2011)

Thank you very much for the help, all of you, greatly appreciated! Tmux works very well.


----------

