How to fix this keyboard bug in Minecraft?

After a while of not playing Minecraft I reinstalled it on my Ubuntu machine. I created my creative world and everything seemed to be fine. However, when the world loaded in, I couldn’t move at all. I tried to change between different keyboard layouts, but that didn’t help. I decided to go into the controls menu to change my walking keys manually to WASD. That did something, because when I pressed “W” I did walk forward. However, when I released the key I didn’t seem to stop. Only when spamming the WASD did I stop, but that would render the keys unusable again and I would have to set the keys again manually to WASD to move a little bit. I suspect that this is an Ubuntu or Java issue.