Ubuntu Studio 22.04 uses the KDE desktop. Generally when KDE doesn't let you log in, it's because of a problem with your user's configuration. There are multiple solutions here, but one of the easiest is to simply make a new user account.
Firstly, you'll need some way to actually get into the system. You can do this by switching to a virtual terminal with Ctrl+Alt+F3. This will give you a text-only interface to the system. You can log in using your normal username and password here.
Once you're in, the next step is to make a new user account. To do that, run sudo adduser
and follow the on-screen instructions. Once that's done, you can run reboot
to restart the machine. (You don't technically have to reboot here, you might also be able to use sudo systemctl restart sddm
, but I'd reboot just to be sure that everything's working right.)
At that point you can try to log in as the new user you just created. If it works, then congratulations! But we're not quite done just yet.
At this point you have a working desktop. What you don't have are all of your files in the other user. And what you'll find out pretty quickly if you try to use sudo
anywhere is that your new user account doesn't have admin privileges. So we need to grant the new user admin privileges, and we need to get your data into the new user account.
Firstly, press Ctrl+Alt+F3 to switch to a virtual terminal again. Log in as your old user. Then run sudo adduser <new username> sudo
, replacing <new username>
with the username of the user you created earlier. Then reboot the computer (you can switch back to your desktop with Ctrl+Alt+F1, close any open work, and then do a reboot from there). Then log in with the new user. At this point sudo
should work in the new user account.
Lastly, to get full access to your old files, open a Konsole terminal, and run sudo chown -R newuser:newuser /home/olduser
to give your new user ownership of all your old user's files. Obviously, replace newuser
with the name of your new user account, and olduser
with the name of your old user account. WARNING: Be very careful not to make a typo here, as you can break your whole computer if you accidentally chown -R the wrong directory, especially if you do it to your root directory.
With this done, you should be able to open your old user's home directory in Dolphin, select the files you want to move over, press Ctrl+X to cut them, then paste them into your new user's home directory. Do not move all your hidden files from the old user, or else you could break the new user account in the same way the old one got broken. If you must transfer any hidden files, only transfer the ones you know you need.
Once that's done, you should be done!
I got the info about how to give a user admin privileges from this other answer: How can I add a user as a new sudoer using the command line?