Endless Keyboard Layout Problems / Tried countless solutions

Greetings people,

I use Zorin OS 16 with X11 windowing system and my Gnome Shell version is 3.38.4, and everything is properly updated.

The background to my problem is the following: I was trying to solve a crash that was presented when I changed my screen brightness, when a guide ended up leading me to two possible solutions: the first involved uninstalling some Nvidia drivers, and the second, change my system language. After uninstalling the Nvidia drivers, I made the grotesque mistake of not checking to see if the problem was resolved before moving on to the second solution (change the language), so I don’t know what exactly generated my current problem, which is:

Some keys on my keyboard (I’ll focus here on the bracket keys to make it easier to understand) are switched. In short, my keyboard doesn’t work like it used to and it`s impossible to type properly.

I looked for numerous solutions focused on Ubuntu, because I didn’t find many specific resolutions for Zorin (although I think this isnt a problem `cause I was able to reproduce the solutions quite well), but I’ll try to list them here to facilitate a possible help, because this has caused me a lot of stress already:

  • I use and have always used my system in English, but my keyboard is brazilian portuguese.

  • In Settings > Region & Language > Input Sources, I am informed that my keyboard is in Portuguese (Brazil), however when I click to view the layout of that language, the displayed keys do not correspond to my pressed physical keys; for example, the left and right bracket keys appear next to each other in all possible layouts, but in my notebook they are on top of each other, next to Enter.

My keyboard.

Default Layout showed on my computer (Portuguese Brazil)

  • I have another notebook with the same version of Zorin, the same version of Gnome Shell, also from Acer, and with the identical keyboard, AND ITS ALSO configured in Input Sources as Portuguese (Brazil), BUT its layout corresponds perfectly to it`s physical keyboard.

In view of this information, I tried several solutions, including:

  • I did a clean boot (with Recovery Mode) in various ways (repairing broken packages etc) and even uninstalled all Nvidia drivers to make sure they weren’t interfering with my keyboard recognition, which is the case with some people I’ve seen.

  • Currently my graphics are in Noveau, as Nvidia graphics are completely uninstalled and disabled. Therefore, I disregarded the influence of Nvidia drivers.

  • I tried to use all the other variants of the keyboard in Portuguese (even English International, dead keys etc etc), selecting them in that same default interface of the keyboard settings and they all display the wrong layout, and every time my computer was restarted when necessary to apply changes; always unsuccessfully.

  • I tried this code in terminal,

    setxkbmap -model abnt2 -layout br -variant abnt2

and variants of it, which I found on the internet, hoping to force the system to recognize my keyboard as ABNT2, but the following error is displayed in the terminal after pressing enter:

Error loading new keyboard description

  • I tried everything to fix this error, without success.

  • Also, one of the first solutions I tried was to change files in folders related to keyboard functioning on startup (/etc/default/keyboard, for example); I don’t remember any other files that I tried to change but was always unsuccessful.

  • I also tried to reconfigure the keyboard by dpkg via terminal:

    sudo dpkg-reconfigure keyboard-configuration

The command worked normally and I can follow the wizard’s instructions, but regardless of my selections, the application does not have any immediate effect, nor after restart, and there is no indication that there is a problem saving this reconfiguration.

I may have done something wrong, but I’m trying to isolate the problem cause I’ve tried everything I could. All this text was written on another computer and passed here, otherwise it would be impossible to read the topic. I ask for your help and I hope it will be useful to more people if solved. I`ll make myself available to respond. Thanks in advance!