A bit about

Hello, everyone! All you can see below is just my bank of information. Some material I've found in the fathomless net, some I've learned myself. Don't think all of the information here is right or actual, but may be it could be of use for you :) All feedback is welcome, especially constructive ones :)

Friday, January 15, 2010

Segmentation fault has blocked terminal

Yesterday I worked with one of Linux servers and run an application which continually updated my terminal. So it was quite interactive one. Suddenly the application failed (because of internal bug, I'm sure) and blocked my terminal. I mean, I could see output of all programs and Bash prompt, I could type my commands, but I couldn't see "what I type".

I found on one of Russian sites detailed description of the reason of such behavior. In fact, interactive applications which process keyboard input themselves usually modify terminal settings and instruct system to pass keyboard events directly to the application. When they correctly exit, they restore all terminal settings. While in case of "segmentation fault" they do not have time to restore the settings.

Fortunately, there is a simple command that allows to restore terminal state manually:
$ stty sane
This command should be entered blindly, because we can't see our input at the moment. After execution of the command our terminal should return to normal functionality.

There could be another reason of broken terminal: output of binary file. There could be special binary commands which affect behavior of terminal. In this case, one of the following command should help:
$ reset
or
$ setterm -reset

0 comments:

Post a Comment