When you open up Nautilus, Gedit or any other GUI application using su, sudo or gksu you may often times run into a very annoying bug that causes GNOME shell to crash.
As it turns out, there’s an ongoing bug hunt for that specific GNOME (actually systemd) bug which been roaming around ever since GNOME Shell version 3.6.
Lucky for us Linux users, every time a developer releases his / her work under an open source license, there will always be someone knowledgeable enough to find a workaround to problems even the developer himself didn’t caught yet.
This bug is no exception! However, before we dive straight into the fix, first you should learn how to diagnose whether you suffer from this bug or not.
When you encounter the bug in question, the first thing you’ll note is a GNOME Shell is locked-up, i.e. your mouse and keyboard will still be usable though nothing on-screen will be click-able.
When this happens what you should to is switch to a different runlevel, on most distros your GUI session is on the 7th runlevel, thus you’ll want to switch into a different one.
To do so, simply hold Alt + Ctrl + F1 (or F2, F3, F4 …) together for a second, then you should see your screen change into console mode, prompting you to type a user name.
Enter your user name and password then type journalctl -rb to see the latest logs from your user, if your log is full with lines as the above heading, then that’s the bug we’re talking about. Tap the letter Q on your keyboard to exit the logs.
Note: if you don’t see these lines or getting a permission denied upon “journalctl -rb” then try that again using SU privileges.
[you can type reboot as SU to restart your machine]
Fixing the Locked-Up GNOME
Now that we’ve identified that you’re suffering from the bug alright, here’s what you can do to go around it, at least until a proper fix would be issued. (though I personally wouldn’t wait for that to happen)
Anyways this is how to currently deal with the problem:
Before you run a GUI app by using su privileges, simply, open up Terminal and copy paste the following command into it as root user:
Note that you’ll have to do this on every session (every reboot) you wish to use GUI apps as root, because in order to avoid other permission issues – this will only be set temporarily per session.
What to do in case You Got Locked Up?
Whenever your Shell gets locked-up, simply switch runlevel to console mode (as described above) then login and use su or sudo to run the commands:
systemctl restart gdm
That’s it! Cheers :)