No matter how hard you try, at some point in time KDE will become damaged, or completely unusable. 99% of the time this is caused by corrupted or damaged user configurations. And this isn't just a KDE phenomenon. It happens with EVERY Window Manager and Desktop Environment, so KDE is not alone in this little problem. While the chances of experiencing a corrupted user configuration is rare these days, it does happen. This guide is a very quick and dirty way to restore your KDE configurations to a previous state that is not corrupted, thus restoring KDE to a pristine, usable condition. Here are two of the best ways to do it, and one supplemental way for the more adventurous.
Note: This tutorial will work with any of the KDE 2.x and 3.x line, but may not work with the 4.x line, as I have yet to test this on 4.x yet. It should also work with Gnome, XFCE, and any other window manager that houses its configuration files in a folder in the user directory.
Total ResetA total reset is exactly that, a method by which you restore KDE to a first run, default, vanilla configuration. This is good for those wanting to go back to basics, or start over completely from the beginning. It's also useful for helping you in troubleshooting much bigger issues with KDE and potentially Xorg should they occur. Again, the physical corruption of KDE is extremely rare to the point of being nearly impossible. But since there's that ever so minor chance due to bad hardware or other external influences, it's a good idea to understand that this can happen, even if it is a statistical near impossibility.
To do a total reset, you will first need to log out of KDE. Next, if you're using a login manager such as KDM (a very commonly used login manager in use on most distros that employ KDE), you will first need to end task on KDM as well before proceeding. To do that, type "killall kdm" and hit enter. It should kill all active KDM sessions. Now, do "ps -ax" again to ensure that no Xorg, KDE, or KDM sessions are running. If any are, ensure that they're all killed off. To do that, find the process id (it's the number listed in the first column of the output created by "ps". aka a "pid".) for each Xorg, KDE, or KDM process that still remains, then type "kill -9 ###" where ### is the process ID.
Now, in your home directory, do "rm -rf .kde" and hit enter. Next, restart KDE by typing "startx". KDE should now load and immediately ask you a few first run questions such as language, window theme and more. Once that's done, you're all set.
Restore Previous StateThe second method for repairing a broken KDE configuration is to restore a previous configuration state from backup. Since KDE itself has no backup function, you'll need to first be employing some kind of backup solution that takes a snapshot of your home directory, including your ".kde" directory. (we have a
backup tutorial here you can use if you're not already employing one of your own.) As before, to get started, kill all Xorg, KDM and/or KDE sessions and ensure that no orphan processes remain.
Now, do "rm -rf .kde" and hit enter. That will remove the corrupted KDE configuration folder for you to get it out of the way. If you want to preserve it for the time being to potentially inspect or potentially restore it at a later date (in case it's not what's causing your issues), simply rename the folder to "kde.old". Next, extract a backup copy of your ".kde" folder and place it in the root of your home directory. Once that's done, simply type "startx" to see if KDE loads properly. If it does, you should find your desktop and KDE session back to normal.
If you've made changes since you last backed up your kde configuration folder, none of those new changes will appear. So you will have to make those updates again to bring your configurations up to date.
Manual RepairThis is a somewhat off the wall method of repairing a broken KDE configuration directory, and is really for experts only. But if you're an experienced user and are up for a challenge, you can open and edit each of your KDE configuration files within the ".kde" directory and manually inspect and repair each of them. I don't have an exact method for this as it's more art than science, and it's too complicated to get into just one tutorial, but I still wanted to mention it since there are some users who like to do things the hard way, or go the long way around a problem, only because there's an adventure to be had along the way and things to be learned. If you're that kind of person, then manually hacking and repairing the contents of your KDE configuration folder may be your thing.