0

I was following this tutorial and it says to gksudo gedit /etc/default/grub but I get this message:

root@ubuntuBirdCage:/home/bird47# gksudo gedit /etc/default/grub  
(gksudo:8029): Gtk-WARNING **: cannot open display:  

Did they change something for Ubuntu 14.04? I want to boot straight into my Ubuntu Server, and not have to select it from this list.

1
  • 1
    Why do you need a GUI editor? Use vim :P May 16, 2014 at 22:04

3 Answers 3

1

I assume you're using Ubuntu Server.

Ubuntu Server is usually installed on a headless computer and therefore doesn't have a GUI in order to save resources.

Because of this you can't run graphical programs (like gedit) on Ubuntu Server, unless you install a desktop manager (GUI). gksudo is used to run graphical applications with superuser priveleges. To run a terminal command as superuser you would just use sudo.

So, as mentioned in the comments, you should use a CLI text editor.

  • vim (advanced)

    vim /path/to/the/file/to/edit.txt
    
  • nano (easy)

    nano /path/to/the/file/to/edit.txt
    
2
  • Good to know! What is the difference between vim & nano?
    – Bird47
    May 17, 2014 at 1:32
  • nano is easy to use. Just simple text editing, searching and saving. vim is less easier to use but can do more, like regex search (and replace), hex editor and custom shortcuts (macros). Try them both and choose the one you prefer. May 17, 2014 at 6:10
0

There are a couple of issues here, presented in descending order of importance

  1. You're already logged in as root, so you don't need to use sudo (or its equivalents). You're already root! All you need to do is run gedit /etc/default/grub.

  2. However, if this is a server, you probably don't have a GUI running at all. That means that graphical applications like gedit won't be able to run and you need a command line editor instead. The simplest of those is nano:

    nano /etc/default/grub
    

    The best of them is emacs although some poor misguided people1 insist on using a thing called vim.

If you are running a GUI on your server, this could be happening for a variety of reasons, depending on how you're connecting to it. Please have a look at my answer here, I go through most of them.


1 This should not be taken seriously. That's a long running gag in the *nix community, vim is an excellent piece of software, I just happen to be in the emacs camp. We get pretty worked up about which is best but, in all honesty, they're both great.

0

  1. You need use nano, vi or vim instead of gedit command. Run it as root to edit /etc/default/grub.
  2. Change the value GRUB_DEFAULT=0 in /etc/default/grub. The value depend on your grub bootup menu. GRUB_DEFAULT=0 means the first item in bootup menu will be boot up as default; GRUB_DEFAULT=1 means the second item in bootup menu will be boot up as default. Change this value to what you want.
  3. Run command update-grub as root. It will be take effect on next boot.

good luck!

You must log in to answer this question.

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