Keyboard input lag in Ubuntu 18.04

I recently switched to Ubuntu 18.04 and since then I have a lot of keyboard input lag, sometimes multiple seconds. I can type the words but it takes some time until they show on the screen.

I previously used Ubuntu 16.04 without any issues.

This error occurs in Terminal but also in my web browser.

Any idea where I could start debugging this problem?

What I figured out is that this also may trigger by some keys more than others. For example when I'm typing cdcdcdcd it appears a lot.

Also it may be important to know that I use a different keyboard layout which I set with this command:

setxkbmap de neo  # (german neo layout) (so cd is rl on asdf)

Although this doesn't make a difference for the lag.

Apparently this issue is only happening on the GNOME/budgie desktop.


Solution 1:

This may be the slow keys feature.

It is toggled on and off by holding down the shift key for 8 seconds.

Press the Shift key for 8 seconds and see if the problem goes away.

Solution 2:

Maybe you could try your system log. I have noticed the following error on my system (multiple times):

xhci_hcd 0000:3a:00.0: xHCI host controller not responding, assume dead

This seems to be a USB3 problem. My keyboard and touch-pad on my laptop do not have this problem. My USB connected mouse also lags.

When I load Ubuntu 18.04 with the previous and still available kernel on my system as used in 17.10, kernel version 4.13.0-39-generic, I do not get the XHCI errors. Also, my keyboard and mouse do not lag anymore.

I am able to select this kernel via the GRUB menu in my setup.

Remark I have not figured it out completely yet. The older kernel appears to work better but the lag is there every now and again. I can make some remarks when using the default kernel: A continuous key press (just holding a letter or character) is doing fine. It just outputs the letter or character constantly without jitter. Also, just entering letters are fine. Where I think it is going wrong with my setup are special characters like (Commas, periods, colons, semicolons, etc.). As soon as those are introduced to the input it stars going wrong. Initially I thought this might be caused by dead keys but switching those off do not make a difference. Can you confirm this behavior? Also, slow keys do not solve it on my setup.

Update This morning I got an update which seems to solve the keyboard problem on my site. From my update log: Commandline:

$ aptdaemon role='role-commit-packages' sender=':1.147'
Upgrade: intel-microcode:amd64 (3.20180312.0~ubuntu18.04.13.20180425.1~ubuntu0.18.04.1)

This is the only update for 18.04 I got so far. This probably also solved the slow boot times on my Laptop. It's now seconds in stead of a minute. I will send a confirmation later this week.

Solution 3:

It isn't the keyboard. It isn't the window compositor. The problem with lagging is the sequence of events that occur within the gui controls of any given program. one thing they all have in common besides keyboard input and displayed text is accessibility options like orca screen reader that cause the gui to have to do more work between screen updates. it's just like with 3d video rendering where too many computations drop your frame rate down until it behaves like a series of stills with no continuity.

kill the calculations and you you kill the lag.

I stopped my lag problem by killing the orca process and then going to [start-up programs]. once there, I removed orca from the start-up list along with other programs that I didn't want at start-up. I also unchecked the box to stop remembering running programs at shut-down.

no more lag on keyboard input, even in Firefox

Solution 4:

I had the same issue with my favorite keyboard. All my other keyboards where working fine.

I solved the problem by switching to wayland.

You can do this with the gear button next to the sign in button at the login screen.

Solution 5:

I had this happen on my main laptop computer when playing Terraria, when playing on my "new desktop" with such amazing parts as ddr2 ram and a dual core e8600 and USB 2.0, I had no latency, I could not even see any input lag when comparing a low end wireless keyboard to a ps2 mechanical keyboard. A computer restart and plugging it in helped. For me I think it was because the system's battery was low and it wasn't plugged in.