6

This morning I saw this question

sudo is not known on line one and gksu is not installing because of the problem

It was obvious from the post that OP was trying to use the answer to a canonical post, which used gksu, until I edited it after seeing the new question.

In this case, I think the edit was justified and even somewhat important, since APT will not work if the sources list is unreadable, and if APT does not work, then installing gksu, which used to be installed by default but is not in later versions of Ubuntu, is not possible.

I wondered whether we should consider checking some of our other highly upvoted posts and possibly changing gksu if it's likely to cause problems like this. Any thoughts/ideas of what to look for?

8
  • But then (obviously) not if the command is not run from terminal :). Those ar usually the cases I mention using gksu, adding a warnig gksu will not mention errors. Mar 6, 2017 at 8:58
  • As far as I know , pkexec is now prefered instead of gksu, so it might be worth mentioning that for newer questions. As for older ones, comment should be sufficient Mar 6, 2017 at 9:18
  • 2
    @Serg pkexec requires configuring for use with graphical applications, and it seems to be quite complicated. I feel it's not really helpful for new users to be told to use pkexec for graphical applications (when they are trying to fix some critical issue especially)...
    – Zanna Mod
    Mar 6, 2017 at 9:20
  • @Zanna from personal experience, I've never had to configure pkexec. It brings up GUI pop up automatically. Been using it in all versions, 13.04 till 16.04. Other users whom I suggested to use pkexec also have never mentioned any issues with it. Mar 6, 2017 at 9:39
  • 1
    @Serg the GUI authorization pop-up comes up fine, but the graphical application that was supposed to be started would fail because DISPLAY, etc. was not configured. This post: askubuntu.com/a/332847/158442
    – muru
    Mar 6, 2017 at 9:46
  • @muru Interesting. I've never had to add DISPLAY to launch any GUI app with pkexec. Will need to test it in VM at some point. Mar 6, 2017 at 9:53
  • 1
    @Serg pkexec has never worked for me just like that on GUI applications. Mar 6, 2017 at 12:14
  • 1
    @JacobVlijm well, my laptop must be special, then :) Mar 6, 2017 at 12:15

1 Answer 1

3

Yes, we should be looking for gksu and fixing them, at least on canonical questions. However, this fix needs to be a multi-faceted approach.

First off, it's important to know why gksu and gksudo doesn't come with Ubuntu anymore. You're more than welcome to read this whole post, but I'll just trim the fat:

gksu is not recommended any more and it may be removed entirely from future issues of Ubuntu. In general the development team would prefer us not to use GUI applications as root but to use sudo and the command line instead.

Now, it's important to take this with a grain of salt, because these are developers after all, and developers aren't always the best at knowing what's good for noob users.

Therefore, we can begin to design a multi-phase solution:

  1. Antiquate gksu
    Anywhere that gksu is used or exists, we can add a little note saying effectively the following:

    Since Ubuntu 13.04, gksu has been deprecated and is no longer installed by default with Ubuntu. It is recommended that you use alternate ways of doing . If you absolutely need this package, run sudo apt install gksu.

    However, this doesn't exactly solve the problem, as there's a very clear reason as to why gksu is no longer really recommended. Just throwing this on won't help people, and might in fact cause weirder problems down the line (plus the fact that gksu might stop existing any moment).

  2. Encourage Use of Specific Tools
    Source management can be taken care of using the GUI "Software and Updates" tool, which is far less risky to users if something goes wrong. Similar tools exist for other Ubuntu components. If nothing of the sort exists, it's probably something your average run-of-the-mill user should be doing, bringing me to the next point.

  3. Just Learn The [CENSORED] Terminal!
    If a user is trying to do something pretty advanced, there's no need to take root actions from the GUI. If this is the case, we can just get rid of gksu gedit and replace it with sudo nano or whatever preferred text editor.

    This option also encourages some UX friction for root actions, which is a very good thing. Root powers are dangerous, and should be isolated. By letting any user get access to root through a GUI, it might open up a huge window to allow even more problems to sneak in (e.g. "I accidentally deleted /etc from my file manager because I had a root Nautilus open and I didn't know that it was a root one. Halp!").

    As for why, see that the Ubuntu dev team says, and what this answer says. In short, root access from the GUI is bad, and sudo in the GUI is also bad.

In short, yes, we need to get rid of gksu and replace it with either the proper GUI solution to the problem, or a command that can run fully in the terminal. Using sudo to bring up graphical things is just a bad idea and can lead to so much trouble that it's just not even a good idea to try.

3
  • Sure, I think we all (the AU regulars who would be doing the editing) know about not using plain sudo and wouldn't make that mistake. But I think respecting the post author is a consideration here, more than any other factor in the decision of what exactly to replace gksu with. I put sudo -H gedit in the post in question aiming for lowest impact. My question isn't about what we should put in gksu's place, but whether we should replace it at all, and if so, where?
    – Zanna Mod
    Mar 6, 2017 at 18:07
  • 2
    @Zanna We can't just directly replace gksu because there's no replacement for gksu. The entire concept of root access in the GUI has been completely changed and (rightfully) doesn't really exist anymore. We obviously have to replace it because it's something that is a problem to new users.
    – Kaz Wolfe
    Mar 6, 2017 at 18:09
  • Hmm well, +1 for the relevant info. And you say that we should update the posts, which is my opinion too.
    – Zanna Mod
    Mar 6, 2017 at 18:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .