4

I am attempting to automount my backup drive on Ubuntu studio 16.04.1.

I type gksu gedit /etc/fstab in terminal and enter my password, but I cannot see the editor.

Can anyone please help?

13
  • 1
    have you installed gksu? what DO you see, if not gedit?
    – Zanna
    Jan 1, 2017 at 9:23
  • 2
    Sometimes gedit opens minimized on the launcher. Look for an icon of a piece of paper with written lines and a pen sticking out from it. If you see it click on it. Jan 1, 2017 at 9:38
  • Thanks guys, I have checked that gksu is installed 'sudo apt-get install gksu'. I am still unable to launch. I type my password in (which is accepted) and nothing launches? (no new icons) I looked at another forum which mentioned that gksu is no longer recommended. How are people automounting an additional drive on boot?
    – user637049
    Jan 1, 2017 at 11:09
  • 4
    I'm voting to close this question as off-topic because gedit wasn't installed as per questioner's admission: askubuntu.com/questions/866704/…
    – DK Bose
    Jan 2, 2017 at 16:40
  • 2
    I see no reason for this to have been closed. The fundamental problem here is that the OP was unaware that gedit wasn't installed, because gksu failed silently instead of showing an error. I don't know if gksu never does that or only in some configurations, but it's rather common. This has happened to me many times over the years (well... at least ten times, I'd say), on several different machines with different Ubuntu releases and flavors. I've also seen it vex other users (not just the OP and me). I have posted an answer. I very much hope we reopen this. Jan 2, 2017 at 22:50

1 Answer 1

5

When you run gksu or gksudo and attempt to run a command that doesn't exist, you don't usually see an error message.

If the gksu and gksudo commands are not installed, you do see an error message when you try to run them, but if the program you're trying to run is not installed, you do not always see any error message.

I am able to confirm this by running a command that is not installed (gksu blahblah) on a Lubuntu 16.04 system where I know the gksu is installed and working.

The OP was able to solve the problem by checking if gedit was installed and, upon discovering it was not, installing it.


Besides running gedit as root with gksu or gksudo, another way to edit a system file with a graphical text editor is to use sudoedit (as waltinator has suggested) but set the VISUAL environment variable to the editor you want to use:

VISUAL=gedit sudoedit /etc/fstab
  • Setting EDITOR instead of VISUAL also works, provided that VISUAL is not also set; if VISUAL is set and not blank, its value takes precedence. VISUAL doesn't mean "GUI" here.

The filename your editor shows you for the file you are editing will be something like fstab.XXEZgT6C. This is because sudoedit makes a copy of the file, you edit the copy, and your changes (if any) are written to the file when you close the editor. The filename shown in the editor is the name of the temporary copy.

The editor itself runs as your user, not as root, and has your settings, which can be convenient. However, since the sudoedit command only completes and writes your changes once you have quit the editor (not just when you've quit the file in the editor but the editor is still open), you'll probably want to either

  • not have that graphical editor already running when you run it, or
  • use a graphical editor that is configured so that a new instance is created every time it is run (rather than a new tab or window in the original instance).

In some editors, you can change this in the settings.

Of course, your editor does still have to be installed for this to work. But (as with the gksu/gksudo way) the editor doesn't have to be Gedit; you can use any editor you like.

You must log in to answer this question.

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