1

I have Ubuntu 16.04.04 LTS server. I was doing some work in tty1 and then took a lunch break. In the meantime, my desktop monitor went asleep. When I came back, I pressed Esc and my screen awoke and I was at the tty1 prompt, exactly where I left off. However, when I began typing, I noticed that the characters I entered were not displaying at the prompt. It was as if the keyboard was not working, but I could see that the pre-existing text on the screen would flicker with each key press I made. So, I think (A) the physical keyboard connection is not the issue and (B) the key presses are registering somewhere because of the brief flicker.

Just to double-check, I pressed CtrlAltF2 to go to tty2 and I began typing (username & password) and the characters I was pressing on the keyboard were displaying as they should. So, my keyboard seemed to work fine in tty2 (and in tty3, tty4, and so on).

So, I went back to tty1 and, again, the key presses were not displaying. No key combination seemed to work in tty1 except the function keys to go to another terminal.

Because, I could not figure out how make my key presses show up in tty1, I tried shutdown, but I could not enter shutdown in tty1. So, I went to tty2 and entered shutdown. In tty2, the command registered and stated the time the computer would shutdown. When it was time to shutdown, a message displayed stating that (I don't remember the exact wording) there was another process taking place. I tried to CtrlC out of the shutdown, but it was stuck too. So, I went to tty3 and tried to shutdown there and got stuck again. So, I ultimately pushed the power button on my computer for a few seconds and shut down my computer the ugly way. When the computer started back up, the problem was gone and everything seemed to work normally.

What was going on with key presses not displaying (but making the screen flicker) in tty1? Eager to understand this.

1 Answer 1

2

The character-based console (tty1, tty2 etc.) is a terminal emulator: it mimics the operation of a serial-port connected terminal, with some Linux-specific extensions. This emulation includes support for XON/XOFF handshaking... and the characters used for this type of handshaking can be easily produced on a keyboard, even by accident.

If you press Control-S, it sends the XOFF control character, which stops output to the terminal until you press Control-Q (aka the XON character). Note that input is not actually stopped along with the output: if you type anything while XOFF is in effect, those characters will be output as soon as you press Control-Q.

This feature can be controlled using the stty command, specifically with the ixon and ixany flags. To disable the feature completely, use stty -ixon; to enable it again, use stty ixon. If you use stty ixany while the feature is enabled, any key will resume the output; if you use stty -ixany, only Control-Q can be used to resume.

The ixoff flag is for transmission in the opposite direction: if the server-side input buffer was in danger of getting overrun, the server would send a Control-S to the terminal to make it stop transmitting until the previous input was processed. On the Linux console, this is obviously not very useful, as both the "server" and the "terminal" are sharing the same physical processor. But the ixon flag is still useful, as you can use it to e.g. pause a scrolling text in order to read it.

The default state for the Linux console seems to be ixon -ixoff -ixany, i.e. Control-S can stop output to the console, and only Control-Q can resume it.

0

You must log in to answer this question.

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