Quick Fix GNOME Shell Locked-Up After SU or GKSU

If you’re GNOME shell crashes often times after / while you run an application using SU privileges, then you came into to right place, see how to fix this terribly annoying bug. Updated on 26 Jun 2014!   When you open up Nautilus, Gedit or any other GUI application using su, sudo or gksu you

Updated Sep 18, 2016Quick Fix
Lock-Up Gnome

Updated on 26 Jun 2014!

 

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.

/run/user/1000/dconf/user

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:

export XDG_RUNTIME_DIR=/run/user/0

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.

Important! although this solution might work quite well for you, you should also be aware that running GUI apps as root is generally not a good practice and if possible – should be avoided.

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:

rm /run/user/1000/dconf/user
systemctl restart gdm

 

That’s it! Cheers :)