Root shell drops keystrokes

I’m running Manjaro on two different machines. Whenever I attempt to open a root shell using sudo -i, the resulting shell drops most keystrokes – I have to hit the same key two to four times for the character to show up. This occurs using xfce4-terminal, console, and TTY terminals when using xterm.

I’ve never had this issue before on any other distro, whether on these machines or otherwise. I’m not sure how to troubleshoot this – does anyone else have this issue?

Currently running sudo v1.9.13p3 but this has been an ongoing issue.

Hi,
All I can say is I havent experienced, or witnessed, the same.
Maybe a good start is general system info:

Assuming your system is fully synced using a current mirror - I suggest you check your locale settings - perhaps the configuration files in your /root home.

I cannot reproduce this using neither xterm nor xfce-terminal - I am fairly confident it is a caused by a local configuration.

Interesting problem. While we are waiting for additional information. I have a couple of items to clarify and possible actions.

  • The mouse and cable are connected properly and in working order.
  • It’s only root, and never a regular user.
    • Is it only sudo -i. Does it occur if you logon to a tty as root.
  • Is it all keys or specific ones.
    • A single keystroke (vs multiple) always appears after typing it 2 or 4 times. In other words, you don’t get the same character repeated 3 - 5.

I would do the following, one at a time:

  • Open another terminal and follow the journal (journalctl -f), now do your sudo -i
    Always check the journal (journalctl -b). See man journalctl.
  • Check /var/log/Xorg.0.log for messages. Can also be followed tail -f /var/log/Xorg.0.log
  • Check .xsession-errors
  • Is something going on that is consuming resources. View top or htop.
  • Either stty sane or reset the terminal, after your sudo -i
  • If there is a .inputrc (root & normal user), if possible, termporarily rename them.

If the layers of software are okay, I’m wondering about keybindings and/or shortcuts.

As mentioned in my initial post, there are two separate machines (both laptops, of different make and model) that are having this issue.

As far as I can tell, the issue only arises when I sudo into root using a terminal emulator in XFCE. The specific terminal emulator doesn’t seem to matter – I’ve tested xfce4-terminal, gnome-terminal, and terminator. (And tmux.)

When I use a tty to sudo into root or ssh into the machine and sudo into root, the issue goes away. Interestingly, this is the case even if I ssh into localhost.

If I su to another user and then sudo -i, the issue goes away.

I don’t see anything weird in the journal. That was the first thing I checked.

.xsession-errors and Xorg.0.log do not produce any new errors when I sudo into a root shell.

Resource usage is nominal.

There is no .inputrc that I can find.

stty sane and reset have no effect on the issue.

The issue applies to all keys, and appears to be essentially random – for any given keypress there’s a roughly 40% chance the press is recognized. You don’t get the same character repeated 3-5 times once the keypress is finally recognized.

I suggest you boot the recent ISO - you don’t need to burn an USB - you can add it to your grub - then verify if you reproduce the issue.

This will confirm if it is a configuration local to your system.

1 Like

Did it always work this way, or was it after an update, after install of a unique package, or after user customizations?

Assuming:

  • all machines are current on upgrades
  • stable branch (pacman-mirrors --get-branch)
  • there are no outstanding .pacnew files (DIFFPROG=meld pacdiff)
  • the shell is bash

Does this work:

  • sudo -i exo-open --launch TerminalEmulator

Could try:

  • clear ~/.cache directory, logoff/on

Last thoughts,

These two machines, I assume have the same customizations. Usually the way to narrow a problem is to create a new user and add customizations incremently, testing with each change… that may mean logging off/on multiple times. Or going the other direction, slowly remove (via comments) customizations from the current user. This is where a VM comes in handy to do a clean install and test things. Do you have a unique PS1 for root? Perhaps something sent to the terminal, is messing it up.

The only other thing, is there a process that is capturing keystrokes.

That’s all I got.