Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So I've noticed this happen more than once.

If I remember correctly, this usually happens right before OOM, and/or kernel panic that if you type into a tty and then try to backspace it, the same characters are printed back in reverse.

This has been merely an interesting oddity to me in the past, but it happened again recently, and I've gotten more curious about what's actually causing that. (Is it sending the characters back to STD_OUT or something?)

Does anyone have any idea? I have a feeling the answer will be interesting.

Just so I'm clear, if you typed hello world, then tried to backspace it:

hello world..dlrow olleh
share|improve this question
1  
Can you tell us about the software you're running? What Linux distribution, which kernel version, etc. –  Flimzy Jun 23 '11 at 7:27
    
When I've seen this happen, it's on a machine I don't maintain/didn't install, and I haven't dug into the kernel. I know it runs a custom kernel Debian Lenny. It's a web server running Apache with several hosts that do a ton of traffic. I wish I could give you more info on it, but I can't access it right now. Thanks for your interest. The next time it happens, I'll gather info. –  Kevin Quinn Jun 23 '11 at 23:37
    
I concur that the answer to this will be interesting. One thing that would be interesting is to see what happens on a serial console connected to that machine during the problem. It'd probably make it clear if it is an issue with termcap/info and being out of memory causing it to not have the control codes to delete characters from the screen (and instead sending codes that cause the screen to print characters it was trying to overwrite). –  polynomial Aug 16 '11 at 21:41
add comment

1 Answer

This is due to the terminal having messed-up terminal settings - you can see this by doing stty -a and looking for the echoprt option which controls this. From the stty(1) man page, this option "echoes erased characters backward, between '\' and '/'`".

To fix this quickly, type stty sane, then something like stty erase '^H' for backspace, or `stty erase '^?' for delete (that's two characters at the end within quotes). See the backspace/delete part of the Linux keyboard HOWTO for more.

It would be interesting to see if this happens on all Linux consoles (Alt-F1, Alt-F2, etc) and/or the pseudo-tty's used in X based terminal windows. Can't work out how OOM condition would cause this as it's managed by the kernel.

Historical note: the echoprt option was originally designed for teleprinter terminals that had a printer instead of a screen, as it was the only way to show a backspace/delete operation - these were the standard terminal when Unix was created. This article has a good explanation of the Linux terminal (TTY) subsystem.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.