Troubleshooting
Symptom first, cause second, in the order the lab and the documentation suggest you check them.
"No Sockets found" — but my session was there
You left a session running; -ls
swears there is nothing.
- You are a different user now.
Sockets live per user, under
/run/screen/S-$USER. If you started the session as yourself and are checking undersudo(or the other way round), you are looking in another user's empty directory. Check as the user who started it. - You are on a different machine.
Sessions live on one host (chapter
13). The classic shape: two similar
hostnames, one session.
hostnamesettles it. - The machine rebooted. Sessions
do not survive that (chapter 13), and
/runis wiped at boot. The listing is telling the truth. - A different SCREENDIR. Screen
honours a
SCREENDIRenvironment variable; a session started from an environment that set one (some service managers do) keeps its socket there, invisible to a plain-lsfrom your shell.
A session shows as (Dead ???)
-ls lists it, but it is not alive.
The server died — killed, crashed, or taken by the machine's troubles — while its socket file remained. Nothing is recoverable from it: a dead session's programs ended with the server. Clear the listing with:
screen -wipe
which checks every socket and removes
the ones with nobody home. -wipe also
runs itself, quietly, the next time you
start a session, which is why a dead
listing sometimes vanishes on its own
between one look and the next.
"There is no screen to be reattached"
-r refuses, or reports the session
is already attached.
- It is attached somewhere. A
forgotten terminal at the office, a
second login of your own. This is
the everyday case, and the answer is
chapter 5's combination:
screen -d -r name, or justscreen -dR nameand make it a habit. - It is attached in this
terminal. You are already inside a
session (yours or, via chapter 10, an
outer one somewhere else).
echo $STYnames the session you are sitting in, if any.
Ctrl-A does nothing (or the wrong thing)
The prefix seems dead, or detach needs two attempts.
- Nested sessions. You are in a Screen session, SSHed from inside it into another machine's Screen (chapter 10). The outer session takes the first Ctrl-A. Double it: Ctrl-A a sends a prefix to the inner session, so the inner detach is Ctrl-A a d.
- The prefix was moved. A
.screenrc— yours, or one you copied — setescapeto something else (chapter 8). Try Ctrl-T; check the file. - The terminal is eating it. Rare,
but some terminal settings and
remote-desktop layers intercept
control keys.
Ctrl-A ?(the help listing) is the test: inside Screen it always answers if the prefix is getting through.
Ctrl-A is in my way
The shell and Emacs want it for "start of line", and Screen got there first.
That is the default bargain, not a
fault. Ctrl-A a passes one literal
Ctrl-A through to the program. If the
collision is constant rather than
occasional, move Screen's prefix with
the escape setting (chapter 8), and
accept that tutorials will then speak
a slightly different dialect.
My .screenrc change does nothing
You edited the file; new sessions ignore the edit.
- The session is older than the edit. The file is read at startup only (chapters 2 and 8). Quit the session and start a fresh one; check with transcript t05's trick — ask the newborn session for its window list or scrollback from outside.
- You edited a different file.
~undersudois root's home. The file Screen read is the starting user's~/.screenrc. - The line is wrong. Screen reports configuration errors at session start, on a screen that waits for a keypress, then continues without the bad line. Start a session in the foreground and read what it says before it clears.
The display is garbled after reattaching
Wrong sizes, doubled lines, a screen that looks shifted — worst when the new terminal is a different size than the old one.
Screen usually adapts on attach. When
it has not: Ctrl-A F (fit) forces
the window to the current terminal's
size, and starting the attach with
screen -A -dR name asks for size
adaptation up front. A full redraw
(Ctrl-L in most shells) clears what
remains. The scrollback's contents are
never harmed by any of this — only
their arrangement on glass.
A command sent with -X stuff arrives changed
Scripting a session (chapter 11), a
line with $VARIABLES in it reached
the window with the variables already
expanded — or vanished.
That is Screen, not your shell: a
command handed to -X is expanded by
Screen as it processes the argument,
before anything is typed. The lab met
this while building its first clock
loop. The fix is the recipe's: stuff a
script file's name, or keep $ out of
the typed line.
Locked out of my own session
Ctrl-A x locked the display, and the password is not accepted — or not remembered.
The lock asks for the account
password of the session's owner.
There is no back door from inside.
From a second terminal, as the same
user, you have the owner's full rights
over the session: attach a second
client with screen -x name to keep
working alongside the lock, or end the
session with screen -S name -X quit
— knowing that ends the programs too
(chapter 5). The lock protects against
the passer-by, not against the owner;
that asymmetry is what it is for.