Keys start repeating as if they were stuck - Ubuntu 20.04 (and others) on laptop(s)

us flag

I have seen this problem reported by others, including on this forum, but without answers which satisfactorily solve this problem, at least not for me (e.g. here and here). Also, I have had this problem on another laptop (an Asus) with Ubuntu 18.04, my current system is a Dell on Ubuntu 20.04. Aside from the applications I have installed, there is nothing fancy linux-wise on my laptop; as far as I can tell, it is pretty much "plain vanilla" (though I do have NVidia drivers that occasionally cause problems, my previous laptop did not have this and still had the problem).

The symptoms are as follows: a random key (i.e. this can happen on any key as far as I can tell: letters, numbers, arrows, delete, backspace...) acts as if it were stuck and the key "repeats" until another key is pressed. The repetition of a key that is actually pressed is a desired feature when voluntary, so solutions involving deactivating key repeats are not a proper solution for me (or others, I suspect). I could be wrong, but from what I am reading and noticing this does not seem to be linked to any keyboard defects but rather has the characteristics of a software issue.

This issue is similar to this one, except that it is not linked to the key being "fast-pressed" or the keyboard being "brushed". However, as indicated in the answer, and since the BIOS was involved, I have updated the BIOS, but the problem is still persistent. As far as I can tell, the system is all up to date (aside from the fact I am sticking with 20.04 for now).

Note that this happens randomly, often enough to be annoying, but not often enough that I cannot use the computer. I would say about once every 100 to 500 key presses...

Although I have seen comments (some of them a bit snide to be frank) related to potential problems with the actual keyboard and/or the user, I think this problem has been reported enough times by enough people with enough different systems / trying different keyboards to merit an answer which, hopefully, can provide enough insight for most users encountering this problem for them to be able to solve the issue. I am not saying it is easy to have a generic answer to this problem, but if by any chance someone has solved this and can indicate the steps for a diagnosis and a corresponding solution that would be greatly appreciated! Ideally, what I am looking for is 1. a list of common issues causing this problem, 2. a list of commands enabling us to know which of those cases corresponds to our situation, and 3. a potential resolution path or pointers. Of course, if this is not possible, then a specific answer for my situation would be nice...

[EDIT 1] in response to the two comments so far:

  • I agree that it could be hardware in the sense "hardware dependent"; what I meant by I believe this is software related is that I do not think my hardware is physically or electronically faulty.
  • When using LiveUbuntu via USB, the problem did not happen, whereas I had the keyboard issue in my first week of using the computer. This is not a 100% indication that this is not a hardware problem as the issue happens randomly from what I can tell. The problem has not been getting noticeably worse or better this last year of usage.
  • That said, I have been unable to reproduce the problem with an external keyboard. It is tempting to deduce from this that it is a hardware issue, and once again if by the hardware we include drivers, etc. then I agree, but (again) I wouldn't conclude that something is physically wrong with the laptop's keyboard (this happened on another laptop of mine, and what I read from other users with this problem is very similar to my situation).
  • I have dual OSes and have a partition with Windows, which I hardly ever use. But so far, I never had the issue on Windows.
  • the fact that the issue was on two different Ubuntu OSes but also on two different computers does not scream hardware to me, but I am no expert in terms of OS, drivers, or hardware for that matter. Couldn't there be a persistent issue in Ubuntu? I have seen posts about this sort of thing dating back to 2012 or so...
  • I realize the role we play in asking and answering questions on the stackoverflow family of websites, and I do play on the other side of the fence for the subjects I have some knowledge about. I am not taking answers for granted and am unsure what warranted that comment, but I will assume it is my phrasing and my use of the words "merit an answer". What I should have said perhaps is that this issue, I think, concerns enough of us that it should merit attention (rather than an answer)? What I am trying to convey is that this issue has been reported on different platforms and is dismissed as a non-issue. The merit of the question, IMHO, lies not in the fact that I am asking it but that several of us are. I hope this clarifies my intent. If this is still unacceptable then please close the question as meritless, I completely understand and hope to limit anyone's waste of time.

[EDIT 2] I have been using logkeys as a kelogger, and here is what I found:

  • first, it seems I need many more keystrokes than I guesstimated before triggering these repeats. I believe somewhere in the thousands.
  • second, here is what was in the log file after the phenomenon occurred:



I am not sure why the character mapping is incorrect, but when I typed the same characters and forced the last letter to repeat, here is what I got:


So what this shows is, first, that the keylogger does log those repetitions (which I guess won't surprise people in the know, but I wasn't sure it would), and second there seems to be a difference (aside from the number of repetitions), namely that the logger captured a [left] keystroke which did not happen just before capturing the repetition, however, the repeated key was the "c" in that sequence. (Note: 1. the actual characters typed were "nan", not "cȁc", and this is probably due to me using a Canadian keyboard mapping. 2. in the above, I have changed the "lower than" and "greater than" symbols by brackets [] to represent those characters as these otherwise do not show up in this edit.)

[EDIT 3 ] I caught another occurrence using the keylogger, and this is what was logged:

ȁcclw <BckSp><LCtrl><LShft><Left><#+7>

instead of:


Where the last letter ("w", which mapps to "e", was repeated 7 times). There were no spaces or other characters typed after the last "w", at which point is stayed "stuck", so I am not sure why the extra characters (the space and then the 3 special keys) got inserted before the logger logs the repetition of the "w", but perhaps this can clue someone as to what is going on here...

David avatar
cn flag
A number of OS have the issue screams it is hardware.
teppyogi avatar
us flag
thanks for the comments, I have edited the question with some more info.
teppyogi avatar
us flag
I am 99% sure the problem is unrelated to crumbs or such things moving around in the keyboard. The same way one knows oneself, I am pretty sure I could "feel" if that were the issue. Also, this diagnostic is incompatible with the problem not occuring in Live or in Windows (despite the randomness aspect, which does not make this easy to assert in full confidence). Do you think installing a keylogger could help determine if the origin is mechanical or not?

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.