When i insert this: gksudo nano /etc/default/grub

it replies with this:

(gksudo:(4 digit number, always different)): Gtk-Warning **:cannot onpen display:

But if i type sudo nano /etc/default/grub it opens the requested file in nano editor. I've tried to use synaptic package manager to reinstall some stuff, but even after reboot it didn't solve the problem.

Purged the package gksu and reinstalled, problem still exists.

Searched some stuff but nothing appears about a desktop. I'm using a very very old one, with Lubuntu 14.04.03 32bit LTS. This happened after i changed nomodeset in GRUB, but i've already removed that and the problem still affects me.

  • Why are you using gksudo instead of plain sudo, since nano is going to need a terminal to run in anyway? – steeldriver Feb 9 '16 at 23:09
  • yes, i know sudo works well, but i still want to solve this. – macacomen98 Feb 10 '16 at 12:16
  • So are you running this inside your Lubuntu desktop (using lxterminal?) Is DISPLAY unset (echo $DISPLAY)? FWIW, regardless of the error message, I don't think gksudo is going to work for a terminal-based editor like nano. – steeldriver Feb 10 '16 at 13:01

If you are just trying to run nano in the terminal gksudo is the wrong command.

If you want to call up another terminal emulator in which to run nano the first thing you need to do is make a launcher

Using your example:

gksudo "lxterminal --command "nano /etc/default/grub""

The graphical frontend of sudo launches a terminal emulator, and then executes the command within that terminal.

  • Oh ok, got it. I was using gksudo because i was following the instructions from a website, i didn't even looked properly to what i was writting. Thanks! – macacomen98 Feb 11 '16 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.