Page 1 of 1

Terminal cannot start GUI apps

Posted: Fri Feb 23, 2018 2:25 am
by markku2812
I've been using Linux Mint XFCE for years, current version is 17.3 "Rosa".
Yesterday I faced a weird problem. I cannot start any GUI apps from terminal as ROOT:
- I open terminal
- sudo su giving the password which is accepted
- type in eg. leafpad & enter

The indicator of hard disk starts to flash but the app won't open. But a task (in Task manager) takes 25% of CPU-time using hard disk and I even can't kill the task.
Apps starts fine as a normal user.

Same thing if I try to open a folder as root, in File Manager, Thunar 1.6.10. The folder won't open but Thunar starts to use the disk taking 25% of CPU-time. And this never ends, well, I waited half an hour...
Same thing with Update Manager. Click Install Updates, type in the password, all package items will be grayed (disabled) and then nothing happens. In Task Manager "synaptic" is taking 25% of CPU-time.

In every case the hard disk indicator is blinking heavily, no matter how long I wait. And tasks cannot be killed, just gives an error saying something about missing previledges.

So guys, what to do?

Re: Terminal cannot start GUI apps

Posted: Fri Feb 23, 2018 2:48 am
by catweazel
gksu ... instead of sudo su ...

Re: Terminal cannot start GUI apps

Posted: Fri Feb 23, 2018 3:02 am
by markku2812
catweazel wrote:
Fri Feb 23, 2018 2:48 am
gksu ... instead of sudo su ...
This doesn't help, same result. And I forgot to say, I run the File Manager & Update Manager without the terminal.

Re: Terminal cannot start GUI apps

Posted: Fri Feb 23, 2018 3:06 am
by Moem
If you're in the habit of opening GUI applications with sudo and/or su, then you have most likely created permissions problems which are now giving you trouble. Graphical applications should always be started from a terminal with gksudo or gksu. Otherwise, any file they write to becomes owned by root and not by the user. The message you saw about missing privileges confirms that this is the case here.

I'm sure someone will be able to show you how to restore ownership of your files.

Re: Terminal cannot start GUI apps

Posted: Fri Feb 23, 2018 3:29 am
by markku2812
Moem wrote:
Fri Feb 23, 2018 3:06 am
If you're in the habit of opening GUI applications with sudo and/or su, then you have most likely created permissions problems which are now giving you trouble. Graphical applications should always be started from a terminal with gksudo or gksu. Otherwise, any file they write to becomes owned by root and not by the user. The message you saw about missing privileges confirms that this is the case here.

I'm sure someone will be able to show you how to restore ownership of your files.
I don't have that habit but sometimes when I want to edit some conf-file needing root, I might do that, using leafpad. This "habit" has been working fine for years.
But using directly File or Update Manager won't work either.
Actually, first time I faced this problem was in File Manager when I tried to open a folder as root. And also this has been working fine before.

Re: Terminal cannot start GUI apps

Posted: Fri Feb 23, 2018 4:05 am
by Moem
markku2812 wrote:
Fri Feb 23, 2018 3:29 am
But using directly File or Update Manager won't work either.
That makes sense, because the ownership of certain files in your home directory is now messed up no matter which application you try to use. I can't tell you how to check for ownership issues but I know other people will be along who can.
As for the word 'habit', once is enough. It doesn't matter how often. Just don't use 'sudo' or 'su' with graphical applications, ever. That is what 'gksudo' is for.

Re: Terminal cannot start GUI apps

Posted: Fri Feb 23, 2018 4:51 am
by rene
To find all files in your home directory not owned by your regular user, execute as said regular user,

Code: Select all

find ~/ -xdev ! -user $(whoami)
If satisfied that the displayed files should indeed be reowned, you can do so with

Code: Select all

find ~/ -xdev ! -user $(whoami) -print0 | xargs -0 sudo chown $(whoami):