Unable to edit /etc/apt/sources.list file

74,100

Solution 1

Use the default terminal text editor program nano instead of gedit to edit /etc/apt/sources.list. Open the terminal and type:

sudo nano /etc/apt/sources.list

Alternatively you can also replace sudo nano /etc/apt/sources.list with sudoedit /etc/apt/sources.list. Because nano is the default terminal editor in Ubuntu the two commands do exactly the same thing.

The instructions for using nano are always displayed at the bottom of the page. Use the keyboard combination Ctrl + O and after that press Enter to save the file to its current location. Use the keyboard combination Ctrl + X to exit nano.

Solution 2

gksu is probably set to use su instead of sudo as the authentication method. Therefore, it's asking you for the administrative (root) password.

To change this, run gksu-properties and choose sudo as the Authentication Method. This way, gksu will ask you for your password.

You'll notice that the dialog box that asks you for the password changes from:

which is asking for the administrative (root) password to:

which asks for your password to perform administrative tasks.

Solution 3

Solving the problem:

If your root password is correct and you are receiving error from using gksu gedit /etc/apt/sources.list then use gksudo gedit /etc/apt/sources.list and go about the changes.

Share:
74,100

Related videos on Youtube

IronMan007
Author by

IronMan007

GNU/Linux Ubuntu lover.

Updated on September 18, 2022

Comments

  • IronMan007
    IronMan007 over 1 year

    When I try to edit my sources.list file using the command:

    $ gksu gedit /etc/apt/sources.list
    

    It requests an administrative password and when I type the password, It says incorrect and try again.What to do? I am new to Linux and Ubuntu.

    • Geppettvs D'Constanzo
      Geppettvs D'Constanzo over 10 years
      Are you using your current password? If so, does your account have administrative privileges? Welcome to AskUbuntu.
    • IronMan007
      IronMan007 over 10 years
      Yes,Iam using my current password and account with administrative privileges. bty using nano editor has resolved my problem. Thank you.
  • IronMan007
    IronMan007 over 10 years
    Unnecessarily wasted 2 hours of time. Resolved.
  • Tulains Córdova
    Tulains Córdova over 10 years
    Why not use simple sudo gedit /etc/apt/sources.list ? When I do, it open gedit and let me edit the file.
  • all4naija
    all4naija over 10 years
    @ Karel. No, it is gksu that is deprecated in Ubuntu 13.04 not gksudo.
  • all4naija
    all4naija over 10 years
    I guess not. I have tried both out myself -- gksu doesn't work but gksudo works as against your launchpad link. It seems that gksu is deprecated in Ubuntu 13.04. It is clear that until you start using pkexec gksudo is the right one to use. There is no argument here though.
  • IronMan007
    IronMan007 over 10 years
    Yep, This is the reason. Got it.