The left ALT key works fine, but the right Alt key does nothing. I used xev to check the button and it works. I use it for for shortcuts like Ctrl+Alt+T to open terminal so I want to fix this problem. thanks.
I had the same problem, and after a lot of googling around in vain I finally managed to discover a solution.
The following solution works both when the English keyboard is selected, and when the Greek keyboard is selected. (Or any other keyboard for that matter, I suppose.)
Open "Tweaks" (aka "Gnome Tweaks") go to Keyboard & Mouse > Additional Layout Options > Key to choose the 3rd level and put a check mark on Right Alt never chooses 3rd level.
If you want to be able to achieve the same thing via the command line:
The corresponding dconf setting is
/org/gnome/desktop/input-sources/xkb-options, the value
'lv3:ralt_alt' must be included in the array of values for that key.
After setting the value of this key, the tweak tool then causes the
setxkbmap command to be invoked, with some parameters that actually do the trick on the fly, but I have not been able to figure out what those parameters are, so my guess is that if you only do
dconf then you will need to restart your login session for the changes to take effect.
I suppose the problem here is that Ubuntu is a) trying to offer an impossibly oversimplified interface which yields an unusable computer out of the box, so you absolutely have to resort to things like the "Gnome Tweaks" tool, and b) this tool is offering so many incredibly arcane and entirely useless options, that the one little option that actually matters is hidden in the noise.
Try checking response in terminal
run the command: $ xev in your terminal and check whether its a hardware issue or a software
In my case the Right Alt Key was returning some additional value showing as:
XkeysymToKeycode returns keycode: 92 <----[issue]
XFilterEvent returns : False <---- [this is fine]
That is my keyboard was working perfectly fine.
Surprisingly I found that my text-entry language has changed to English(UK). So when I changed it to English(US) everything started working perfectly fine.