To get your MIDI keyboard working in Linux, you should do something like the following steps:
1) install Rosegarden, which automatically install jack and the related software in particular Qjackqtl (jack GUI). Maybe you could install directly Qjackqtl…
2) add your user to the audio group
sudo usermod -a -G audio <your_user_name>
3) install Qsynth,
4) do the following terminal command
sudo apt update; sudo apt full-upgrade -y; sudo apt install -y pipewire-audio-client-libraries libspa-0.2-bluetooth libspa-0.2-jack wireplumber pipewire-media-session-; sudo cp /usr/share/doc/pipewire/examples/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d/; sudo cp /usr/share/doc/pipewire/examples/ld.so.conf.d/pipewire-jack-*.conf /etc/ld.so.conf.d/; sudo ldconfig; sudo apt remove -y pulseaudio-module-bluetooth; systemctl --user --now enable wireplumber.service
Musescore and a MIDI keyboard
To get Musescore able to record from a MIDI keyboard I had to use the 4 release, so far with an appimage from their website.