I have installed ubuntu 18.04 on my Lenovo laptop. Since the laptop was almost 4 years old, one of my volume mute/unmute button got damaged and the relevant key press/release event got triggered automatically.
Since this action happens frequently, it causes terminal stuck until it gets stopped by its own. So I can't type any commands on the terminal during that specific time. This problem is killing me a lot.
I have tried some solutions like disabling the relevant keycode through xmodmap,
xmodmap -e 'keycode 113='
xmodmap -e 'keycode 113=NoSymbol'
Still it's not working for me.. Later the same issue happens automatically.

