Updated: June 9, 2018
Testing unstable dev versions of Plasma has its perks - and dangers. You may end up with a desktop that no longer loads. As it happens, this happened to me. One day, my KDE neon tech guinea pig decided not to load anymore, probably tired of all my configuration changes and installations. No problem, reinstall ought to fix it then, right?
Well, not quite. Even a full reinstall (using the same home and user, of course) did not alleviate the problem. Come the first boot and the first hope of a login, I had the mouse cursor, and it would travel merrily across the wide 16:9 estate of the black screen, but the desktop simply refused to load. So what now?
Problem, more details
I have lamented about the lack of ability to reset Plasma to defaults in my 5.12 LTS review - important fixes and changes have been partially introduced since. In fact, it's not just being able to clean up your desktop after mauling the configuration, there should also be a failsafe desktop, loaded by a boot service, so that even users who have completely destroyed their home should still be able to get to a functional state. Something like a timeout service, upon which a rescue desktop is loaded. With systemd and all its wonders, this should not be too difficult to implement.
But such a service does not exist at the moment. I switched from a black screen GUI console to one of the virtual ones (Ctrl + Alt + F[1-6]), and logged in with my user. I then moved the KDE and Plasma configuration files away, rebooted, but this still did not help fix the issue.
I continued playing and fiddling with anything and everything that looked conceivably related to Plasma, but nothing helped. Now, there were two other users configured in the home directory, but I had no login screen, and so, seemingly, no option to use them.
The first step is to actually get to a login screen. To that end, we need to edit the login screen configuration so that it loads a correct user - in my case, a different user. I had holo, and there were also roger and neon available, so using them could help work around the issue. The login config is stored under /etc/sddm.conf.
Just change to a different user, and on next boot, it should be fine. Then you can perform administration and troubleshooting with a complete desktop at your disposal.
What if there are no other users available?
Then, let's create one. In fact, we will need to do several things - create a user with a new home directory, create a password for this user, and most importantly, make it an admin user so that we can actually do meaningful stuff in the logged in desktop (which should load for the new user). Technically, if you miss this step, it's still fine because the old user whose desktop we can't reach is still available, and it is still an admin user, so we can open a new shell (otherwise we would not have been able to login on the virtual console). Let's do this step by step. Create a new user (run these commands with sudo or as root):
useradd -m rescueuser
usermod -aG sudo rescueuser
By default, our new users will have /bin/sh as its default shell. You can change this in the /etc/passwd file by adding :/bin/bash to the entry line that denotes our new user. If you get confused, just look at the existing user (the one that is not loading the Plasma desktop). Now, edit the /etc/sddm.conf file as earlier. Reboot. Your new and pristine Plasma desktop should load fine.
If you've forgotten to change the password for your rescueuser, open Konsole:
su - olduser
Provide the password, then run sudo passwd rescueuser again. You can also open the /etc/shadow file and copy the password hash from your old user to your new user. I've shown you this tricks when we had to figure out how to log into the Amazon Linux 2 virtual machine. There are infinite possibilities around this issue.If you've forgotten to make the new user admin, we can still solve this logged into the new Plasma desktop of our rescue user account, Open a Konsole window, log in as the old user whose desktop we cannot reach, then launch /usr/bin/systemsettings5. Go to Personalization > Account Details > User Manager. In the UI, tick the box that makes rescueuser admin, save - you will be prompted for password, the old user one that is, and this should work, because the old user is admin. Now, log out, Bob's your uncle.
Now you should have a fully functional desktop. The question is, what next? You can try troubleshooting the bad user, knowing you always have an option to log into a different session. You can copy and backup your important data, or even selectively copy configurations, although this is probably not the wisest idea given the troubles we've faced earlier. Lastly, once you're happy with everything you can delete the old user, and the woes it had given you will have become distant memories.
Dead desktops are never a pretty sight. Irrecoverable desktops even more so. I really wonder what can go so horribly wrong that even if you fully reinstall and move away all the desktop-related settings, things are still awfully bad. No matter, in this tutorial, I've shown you how you can regain control over your Plasma desktop even if things are seemingly lost.
True, you can always boot into any which live CD session and copy your data or install a different desktop environment. But what if your home rests on the same partition and you cannot afford formats? Or if you actually want to continue using Plasma? Well, it comes down to managing the login session, and then creating a new user that will take over the fiasco. Technically, we cheated, but then, if you date twins, and you can't tell them apart, is it your fault for using the wrong name? Anyway, I just wanted to let you know that no matter how seemingly bad things are, it's never a lost cause. And remember, always have backups. Take care.