How do I restore the default repositories?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







127















There are now errors when updating and I cannot install most software due to a corrupted



/etc/apt/sources.list


file. Is there a copy I can download to replace it?



The file would be for Ubuntu 12.04 (Final Beta) in the United States.










share|improve this question

























  • Have you tried the "Software Sources" GUI app? I'm not running 12.04, but in the past, this is where you could choose the repository location, and edit which ones to use from that location.

    – Marty Fried
    Apr 21 '12 at 18:14











  • I did, and none of the errors listed were in that. I just want to find a copy of the sources.list file as it was when I had freshly installed Ubuntu.

    – Andy Castille
    Apr 21 '12 at 18:15











  • You should be able to go to the "Other Software" tab, and delete the duplicate entries. Or, if you're not sure, you can uncheck a few and see if that fixes the problem. Also, did you run "sudo apt-get update" like it suggested?

    – Marty Fried
    Apr 21 '12 at 18:34











  • Yes, I did. It gives me W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/source/Sources 404 Not Found W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/binary-i386/Packages 404 Not Found E: Some index files failed to download. They have been ignored, or old ones used instead.

    – Andy Castille
    Apr 21 '12 at 19:09











  • All of the ones with ppa.launchpad.net should be listed in the "Other Software" tab, and can be disabled or deleted. In fact, I believe all of the ones with http:// URLs could be disabled, and would be lost if you replace the file with the default. If you go to "ppa.launchpad.net, you will see a big list, which includes things like "pmcenery"; I followed it to ppa/ubuntu/dists and saw that the last version was natty, so there is no oneiric or precise to be had. That is why you are getting the 404 (not found) error.

    – Marty Fried
    Apr 21 '12 at 20:22


















127















There are now errors when updating and I cannot install most software due to a corrupted



/etc/apt/sources.list


file. Is there a copy I can download to replace it?



The file would be for Ubuntu 12.04 (Final Beta) in the United States.










share|improve this question

























  • Have you tried the "Software Sources" GUI app? I'm not running 12.04, but in the past, this is where you could choose the repository location, and edit which ones to use from that location.

    – Marty Fried
    Apr 21 '12 at 18:14











  • I did, and none of the errors listed were in that. I just want to find a copy of the sources.list file as it was when I had freshly installed Ubuntu.

    – Andy Castille
    Apr 21 '12 at 18:15











  • You should be able to go to the "Other Software" tab, and delete the duplicate entries. Or, if you're not sure, you can uncheck a few and see if that fixes the problem. Also, did you run "sudo apt-get update" like it suggested?

    – Marty Fried
    Apr 21 '12 at 18:34











  • Yes, I did. It gives me W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/source/Sources 404 Not Found W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/binary-i386/Packages 404 Not Found E: Some index files failed to download. They have been ignored, or old ones used instead.

    – Andy Castille
    Apr 21 '12 at 19:09











  • All of the ones with ppa.launchpad.net should be listed in the "Other Software" tab, and can be disabled or deleted. In fact, I believe all of the ones with http:// URLs could be disabled, and would be lost if you replace the file with the default. If you go to "ppa.launchpad.net, you will see a big list, which includes things like "pmcenery"; I followed it to ppa/ubuntu/dists and saw that the last version was natty, so there is no oneiric or precise to be had. That is why you are getting the 404 (not found) error.

    – Marty Fried
    Apr 21 '12 at 20:22














127












127








127


66






There are now errors when updating and I cannot install most software due to a corrupted



/etc/apt/sources.list


file. Is there a copy I can download to replace it?



The file would be for Ubuntu 12.04 (Final Beta) in the United States.










share|improve this question
















There are now errors when updating and I cannot install most software due to a corrupted



/etc/apt/sources.list


file. Is there a copy I can download to replace it?



The file would be for Ubuntu 12.04 (Final Beta) in the United States.







repository software-sources






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 14 '16 at 10:10









Anwar

57.4k22149255




57.4k22149255










asked Apr 21 '12 at 18:08









Andy CastilleAndy Castille

83931321




83931321













  • Have you tried the "Software Sources" GUI app? I'm not running 12.04, but in the past, this is where you could choose the repository location, and edit which ones to use from that location.

    – Marty Fried
    Apr 21 '12 at 18:14











  • I did, and none of the errors listed were in that. I just want to find a copy of the sources.list file as it was when I had freshly installed Ubuntu.

    – Andy Castille
    Apr 21 '12 at 18:15











  • You should be able to go to the "Other Software" tab, and delete the duplicate entries. Or, if you're not sure, you can uncheck a few and see if that fixes the problem. Also, did you run "sudo apt-get update" like it suggested?

    – Marty Fried
    Apr 21 '12 at 18:34











  • Yes, I did. It gives me W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/source/Sources 404 Not Found W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/binary-i386/Packages 404 Not Found E: Some index files failed to download. They have been ignored, or old ones used instead.

    – Andy Castille
    Apr 21 '12 at 19:09











  • All of the ones with ppa.launchpad.net should be listed in the "Other Software" tab, and can be disabled or deleted. In fact, I believe all of the ones with http:// URLs could be disabled, and would be lost if you replace the file with the default. If you go to "ppa.launchpad.net, you will see a big list, which includes things like "pmcenery"; I followed it to ppa/ubuntu/dists and saw that the last version was natty, so there is no oneiric or precise to be had. That is why you are getting the 404 (not found) error.

    – Marty Fried
    Apr 21 '12 at 20:22



















  • Have you tried the "Software Sources" GUI app? I'm not running 12.04, but in the past, this is where you could choose the repository location, and edit which ones to use from that location.

    – Marty Fried
    Apr 21 '12 at 18:14











  • I did, and none of the errors listed were in that. I just want to find a copy of the sources.list file as it was when I had freshly installed Ubuntu.

    – Andy Castille
    Apr 21 '12 at 18:15











  • You should be able to go to the "Other Software" tab, and delete the duplicate entries. Or, if you're not sure, you can uncheck a few and see if that fixes the problem. Also, did you run "sudo apt-get update" like it suggested?

    – Marty Fried
    Apr 21 '12 at 18:34











  • Yes, I did. It gives me W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/source/Sources 404 Not Found W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/binary-i386/Packages 404 Not Found E: Some index files failed to download. They have been ignored, or old ones used instead.

    – Andy Castille
    Apr 21 '12 at 19:09











  • All of the ones with ppa.launchpad.net should be listed in the "Other Software" tab, and can be disabled or deleted. In fact, I believe all of the ones with http:// URLs could be disabled, and would be lost if you replace the file with the default. If you go to "ppa.launchpad.net, you will see a big list, which includes things like "pmcenery"; I followed it to ppa/ubuntu/dists and saw that the last version was natty, so there is no oneiric or precise to be had. That is why you are getting the 404 (not found) error.

    – Marty Fried
    Apr 21 '12 at 20:22

















Have you tried the "Software Sources" GUI app? I'm not running 12.04, but in the past, this is where you could choose the repository location, and edit which ones to use from that location.

– Marty Fried
Apr 21 '12 at 18:14





Have you tried the "Software Sources" GUI app? I'm not running 12.04, but in the past, this is where you could choose the repository location, and edit which ones to use from that location.

– Marty Fried
Apr 21 '12 at 18:14













I did, and none of the errors listed were in that. I just want to find a copy of the sources.list file as it was when I had freshly installed Ubuntu.

– Andy Castille
Apr 21 '12 at 18:15





I did, and none of the errors listed were in that. I just want to find a copy of the sources.list file as it was when I had freshly installed Ubuntu.

– Andy Castille
Apr 21 '12 at 18:15













You should be able to go to the "Other Software" tab, and delete the duplicate entries. Or, if you're not sure, you can uncheck a few and see if that fixes the problem. Also, did you run "sudo apt-get update" like it suggested?

– Marty Fried
Apr 21 '12 at 18:34





You should be able to go to the "Other Software" tab, and delete the duplicate entries. Or, if you're not sure, you can uncheck a few and see if that fixes the problem. Also, did you run "sudo apt-get update" like it suggested?

– Marty Fried
Apr 21 '12 at 18:34













Yes, I did. It gives me W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/source/Sources 404 Not Found W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/binary-i386/Packages 404 Not Found E: Some index files failed to download. They have been ignored, or old ones used instead.

– Andy Castille
Apr 21 '12 at 19:09





Yes, I did. It gives me W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/source/Sources 404 Not Found W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/binary-i386/Packages 404 Not Found E: Some index files failed to download. They have been ignored, or old ones used instead.

– Andy Castille
Apr 21 '12 at 19:09













All of the ones with ppa.launchpad.net should be listed in the "Other Software" tab, and can be disabled or deleted. In fact, I believe all of the ones with http:// URLs could be disabled, and would be lost if you replace the file with the default. If you go to "ppa.launchpad.net, you will see a big list, which includes things like "pmcenery"; I followed it to ppa/ubuntu/dists and saw that the last version was natty, so there is no oneiric or precise to be had. That is why you are getting the 404 (not found) error.

– Marty Fried
Apr 21 '12 at 20:22





All of the ones with ppa.launchpad.net should be listed in the "Other Software" tab, and can be disabled or deleted. In fact, I believe all of the ones with http:// URLs could be disabled, and would be lost if you replace the file with the default. If you go to "ppa.launchpad.net, you will see a big list, which includes things like "pmcenery"; I followed it to ppa/ubuntu/dists and saw that the last version was natty, so there is no oneiric or precise to be had. That is why you are getting the 404 (not found) error.

– Marty Fried
Apr 21 '12 at 20:22










3 Answers
3






active

oldest

votes


















112














You can use this trick. Open a terminal ( Pressing Ctrl+Alt+T ) and do these





  • Move the corrupted one to the safe place



    sudo mv /etc/apt/sources.list ~/


    and recreate it



    sudo touch /etc/apt/sources.list



  • Open Software & Updates



    software-properties-gtk


    This will open software-properties-gtk with no repository selected.




Then change the server to Main server or to any other server of your choice. You must enable some repositories from the new window in order to create new sources.list file in /etc/apt/.



ubuntu-software tab of software-properties-gtk





  • After enabling some sources from Ubuntu software tab, you can enable the updates. To do so, switch to Updates tab and select one or more updates channel. I recommend selecting security and updates channel at least. (This image is later added from Ubuntu xenial, so there can be some differences)



    updates tab of software-properties-gtk






Updated with inline content



This is the sources.list file for 12.04 Precise Pangolin. If you're using other release, you need to replace the precise word with your ubuntu release name. You can see the which name you should use with this command



lsb_release -c -s


And to replace the word you can use this sed command (assuming you copied the sources content in /etc/apt/sources.list



sudo sed -i "s/precise/$(lsb_release -c -s)/" /etc/apt/sources.list


Now, content of sources.list with main ubuntu mirror



###### Ubuntu Main Repos
deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse

###### Ubuntu Update Repos
deb http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse

###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu precise partner
deb-src http://archive.canonical.com/ubuntu precise partner

###### Ubuntu Extras Repo
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main


Note 1: the word deb and deb-src refers to the repository format. deb is for binary package anddeb-src` is for source package.



Note 2: Using # at the start of the line make that line a comment. Apt will ignore it so all repositories mentioned on that line will be disabled.



Note 3: There are repository lines which includes all four components main, universe, restricted, multiverse. You can disable one or more of them by removing the word.



Note 4: You can find some explanation of the repositories in this my other answer






share|improve this answer





















  • 11





    And if i was in Ubuntu server?!

    – Dr.jacky
    Jul 6 '15 at 9:58






  • 2





    This did not work for me -new sources.list was not generated.

    – hydroxide
    Aug 10 '15 at 20:26






  • 1





    I have tested this again now, it generates a new one. You have to enable some repository, like main, universe etc

    – Anwar
    Aug 11 '15 at 2:37











  • Thanks, the other places I looked didn't mention the update section. It was required for me to get things installed with apt

    – Darrel Holt
    Jan 14 '18 at 22:36











  • Thnaks, you save my operation system, rs

    – Diogo Henrique Fragoso de Oliv
    Apr 13 '18 at 2:17



















99














Go to https://repogen.simplylinux.ch.



Select your Country and Ubuntu Release.



For the default set of repositories, you need to enable these repositories.




  • All of the Ubuntu Branches repositories.

  • Security - Important Security Updates.

  • Security Sources Repository

  • Updates - Recommended Updates

  • Updates Sources Repository


If you want to install software from Canonical Partner Repositories (closed source software), enable the Ubuntu Partner Repositories (both of them).



Enable any 3rd party repository you wish to enable.



Now, click the Generate List button at the bottom of that page and you'll see your generated sources.list.



Replace the old sources.list with the new one



Run the following commands in a Terminal.



sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
gksudo gedit /etc/apt/sources.list


Copy/paste all the text from the newly generated sources.list to this file. Save it and close Gedit.



Now, update apt.



sudo apt-get update


This will update your repository index with the current sources.list and then you can install any software using Software Center, Synaptic or apt-get.






share|improve this answer


























  • Somewhere in the past, you added ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/source/… to your list. Did you last have the natty version before the beta? I suspect the upgrader changed natty to precise, but there is no precise version available for this package. I would delete it from "Other Software". The error isn't hurting anything, by the way.

    – Marty Fried
    Apr 21 '12 at 20:27



















17














By default there will be a backup for your sources.list file on the same directory itself.



sudo cp /etc/apt/sources.list.save /etc/apt/sources.list


Answer from similar question here: https://askubuntu.com/a/465210/150936






share|improve this answer





















  • 7





    cp: cannot stat `/etc/apt/sources.list.save': No such file or directory

    – Dr.jacky
    Jul 6 '15 at 9:58











  • I'm on 18.04.1. I didn't have /etc/apt/sources.list.save but I did have /etc/apt/sources.list.curtin.old. Is that the equivalent?

    – jbobbins
    Oct 30 '18 at 16:48











  • worth to note if you just upgraded the distro and kept having errors with apt-get install, then instead of sources.list.save do copy sources.list.distUpgrade

    – MaKiPL
    yesterday










protected by Community Apr 17 '15 at 21:30



Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



Would you like to answer one of these unanswered questions instead?














3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









112














You can use this trick. Open a terminal ( Pressing Ctrl+Alt+T ) and do these





  • Move the corrupted one to the safe place



    sudo mv /etc/apt/sources.list ~/


    and recreate it



    sudo touch /etc/apt/sources.list



  • Open Software & Updates



    software-properties-gtk


    This will open software-properties-gtk with no repository selected.




Then change the server to Main server or to any other server of your choice. You must enable some repositories from the new window in order to create new sources.list file in /etc/apt/.



ubuntu-software tab of software-properties-gtk





  • After enabling some sources from Ubuntu software tab, you can enable the updates. To do so, switch to Updates tab and select one or more updates channel. I recommend selecting security and updates channel at least. (This image is later added from Ubuntu xenial, so there can be some differences)



    updates tab of software-properties-gtk






Updated with inline content



This is the sources.list file for 12.04 Precise Pangolin. If you're using other release, you need to replace the precise word with your ubuntu release name. You can see the which name you should use with this command



lsb_release -c -s


And to replace the word you can use this sed command (assuming you copied the sources content in /etc/apt/sources.list



sudo sed -i "s/precise/$(lsb_release -c -s)/" /etc/apt/sources.list


Now, content of sources.list with main ubuntu mirror



###### Ubuntu Main Repos
deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse

###### Ubuntu Update Repos
deb http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse

###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu precise partner
deb-src http://archive.canonical.com/ubuntu precise partner

###### Ubuntu Extras Repo
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main


Note 1: the word deb and deb-src refers to the repository format. deb is for binary package anddeb-src` is for source package.



Note 2: Using # at the start of the line make that line a comment. Apt will ignore it so all repositories mentioned on that line will be disabled.



Note 3: There are repository lines which includes all four components main, universe, restricted, multiverse. You can disable one or more of them by removing the word.



Note 4: You can find some explanation of the repositories in this my other answer






share|improve this answer





















  • 11





    And if i was in Ubuntu server?!

    – Dr.jacky
    Jul 6 '15 at 9:58






  • 2





    This did not work for me -new sources.list was not generated.

    – hydroxide
    Aug 10 '15 at 20:26






  • 1





    I have tested this again now, it generates a new one. You have to enable some repository, like main, universe etc

    – Anwar
    Aug 11 '15 at 2:37











  • Thanks, the other places I looked didn't mention the update section. It was required for me to get things installed with apt

    – Darrel Holt
    Jan 14 '18 at 22:36











  • Thnaks, you save my operation system, rs

    – Diogo Henrique Fragoso de Oliv
    Apr 13 '18 at 2:17
















112














You can use this trick. Open a terminal ( Pressing Ctrl+Alt+T ) and do these





  • Move the corrupted one to the safe place



    sudo mv /etc/apt/sources.list ~/


    and recreate it



    sudo touch /etc/apt/sources.list



  • Open Software & Updates



    software-properties-gtk


    This will open software-properties-gtk with no repository selected.




Then change the server to Main server or to any other server of your choice. You must enable some repositories from the new window in order to create new sources.list file in /etc/apt/.



ubuntu-software tab of software-properties-gtk





  • After enabling some sources from Ubuntu software tab, you can enable the updates. To do so, switch to Updates tab and select one or more updates channel. I recommend selecting security and updates channel at least. (This image is later added from Ubuntu xenial, so there can be some differences)



    updates tab of software-properties-gtk






Updated with inline content



This is the sources.list file for 12.04 Precise Pangolin. If you're using other release, you need to replace the precise word with your ubuntu release name. You can see the which name you should use with this command



lsb_release -c -s


And to replace the word you can use this sed command (assuming you copied the sources content in /etc/apt/sources.list



sudo sed -i "s/precise/$(lsb_release -c -s)/" /etc/apt/sources.list


Now, content of sources.list with main ubuntu mirror



###### Ubuntu Main Repos
deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse

###### Ubuntu Update Repos
deb http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse

###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu precise partner
deb-src http://archive.canonical.com/ubuntu precise partner

###### Ubuntu Extras Repo
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main


Note 1: the word deb and deb-src refers to the repository format. deb is for binary package anddeb-src` is for source package.



Note 2: Using # at the start of the line make that line a comment. Apt will ignore it so all repositories mentioned on that line will be disabled.



Note 3: There are repository lines which includes all four components main, universe, restricted, multiverse. You can disable one or more of them by removing the word.



Note 4: You can find some explanation of the repositories in this my other answer






share|improve this answer





















  • 11





    And if i was in Ubuntu server?!

    – Dr.jacky
    Jul 6 '15 at 9:58






  • 2





    This did not work for me -new sources.list was not generated.

    – hydroxide
    Aug 10 '15 at 20:26






  • 1





    I have tested this again now, it generates a new one. You have to enable some repository, like main, universe etc

    – Anwar
    Aug 11 '15 at 2:37











  • Thanks, the other places I looked didn't mention the update section. It was required for me to get things installed with apt

    – Darrel Holt
    Jan 14 '18 at 22:36











  • Thnaks, you save my operation system, rs

    – Diogo Henrique Fragoso de Oliv
    Apr 13 '18 at 2:17














112












112








112







You can use this trick. Open a terminal ( Pressing Ctrl+Alt+T ) and do these





  • Move the corrupted one to the safe place



    sudo mv /etc/apt/sources.list ~/


    and recreate it



    sudo touch /etc/apt/sources.list



  • Open Software & Updates



    software-properties-gtk


    This will open software-properties-gtk with no repository selected.




Then change the server to Main server or to any other server of your choice. You must enable some repositories from the new window in order to create new sources.list file in /etc/apt/.



ubuntu-software tab of software-properties-gtk





  • After enabling some sources from Ubuntu software tab, you can enable the updates. To do so, switch to Updates tab and select one or more updates channel. I recommend selecting security and updates channel at least. (This image is later added from Ubuntu xenial, so there can be some differences)



    updates tab of software-properties-gtk






Updated with inline content



This is the sources.list file for 12.04 Precise Pangolin. If you're using other release, you need to replace the precise word with your ubuntu release name. You can see the which name you should use with this command



lsb_release -c -s


And to replace the word you can use this sed command (assuming you copied the sources content in /etc/apt/sources.list



sudo sed -i "s/precise/$(lsb_release -c -s)/" /etc/apt/sources.list


Now, content of sources.list with main ubuntu mirror



###### Ubuntu Main Repos
deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse

###### Ubuntu Update Repos
deb http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse

###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu precise partner
deb-src http://archive.canonical.com/ubuntu precise partner

###### Ubuntu Extras Repo
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main


Note 1: the word deb and deb-src refers to the repository format. deb is for binary package anddeb-src` is for source package.



Note 2: Using # at the start of the line make that line a comment. Apt will ignore it so all repositories mentioned on that line will be disabled.



Note 3: There are repository lines which includes all four components main, universe, restricted, multiverse. You can disable one or more of them by removing the word.



Note 4: You can find some explanation of the repositories in this my other answer






share|improve this answer















You can use this trick. Open a terminal ( Pressing Ctrl+Alt+T ) and do these





  • Move the corrupted one to the safe place



    sudo mv /etc/apt/sources.list ~/


    and recreate it



    sudo touch /etc/apt/sources.list



  • Open Software & Updates



    software-properties-gtk


    This will open software-properties-gtk with no repository selected.




Then change the server to Main server or to any other server of your choice. You must enable some repositories from the new window in order to create new sources.list file in /etc/apt/.



ubuntu-software tab of software-properties-gtk





  • After enabling some sources from Ubuntu software tab, you can enable the updates. To do so, switch to Updates tab and select one or more updates channel. I recommend selecting security and updates channel at least. (This image is later added from Ubuntu xenial, so there can be some differences)



    updates tab of software-properties-gtk






Updated with inline content



This is the sources.list file for 12.04 Precise Pangolin. If you're using other release, you need to replace the precise word with your ubuntu release name. You can see the which name you should use with this command



lsb_release -c -s


And to replace the word you can use this sed command (assuming you copied the sources content in /etc/apt/sources.list



sudo sed -i "s/precise/$(lsb_release -c -s)/" /etc/apt/sources.list


Now, content of sources.list with main ubuntu mirror



###### Ubuntu Main Repos
deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse

###### Ubuntu Update Repos
deb http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse

###### Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu precise partner
deb-src http://archive.canonical.com/ubuntu precise partner

###### Ubuntu Extras Repo
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main


Note 1: the word deb and deb-src refers to the repository format. deb is for binary package anddeb-src` is for source package.



Note 2: Using # at the start of the line make that line a comment. Apt will ignore it so all repositories mentioned on that line will be disabled.



Note 3: There are repository lines which includes all four components main, universe, restricted, multiverse. You can disable one or more of them by removing the word.



Note 4: You can find some explanation of the repositories in this my other answer







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 4 at 11:48









N0rbert

25k853118




25k853118










answered Sep 24 '12 at 9:47









AnwarAnwar

57.4k22149255




57.4k22149255








  • 11





    And if i was in Ubuntu server?!

    – Dr.jacky
    Jul 6 '15 at 9:58






  • 2





    This did not work for me -new sources.list was not generated.

    – hydroxide
    Aug 10 '15 at 20:26






  • 1





    I have tested this again now, it generates a new one. You have to enable some repository, like main, universe etc

    – Anwar
    Aug 11 '15 at 2:37











  • Thanks, the other places I looked didn't mention the update section. It was required for me to get things installed with apt

    – Darrel Holt
    Jan 14 '18 at 22:36











  • Thnaks, you save my operation system, rs

    – Diogo Henrique Fragoso de Oliv
    Apr 13 '18 at 2:17














  • 11





    And if i was in Ubuntu server?!

    – Dr.jacky
    Jul 6 '15 at 9:58






  • 2





    This did not work for me -new sources.list was not generated.

    – hydroxide
    Aug 10 '15 at 20:26






  • 1





    I have tested this again now, it generates a new one. You have to enable some repository, like main, universe etc

    – Anwar
    Aug 11 '15 at 2:37











  • Thanks, the other places I looked didn't mention the update section. It was required for me to get things installed with apt

    – Darrel Holt
    Jan 14 '18 at 22:36











  • Thnaks, you save my operation system, rs

    – Diogo Henrique Fragoso de Oliv
    Apr 13 '18 at 2:17








11




11





And if i was in Ubuntu server?!

– Dr.jacky
Jul 6 '15 at 9:58





And if i was in Ubuntu server?!

– Dr.jacky
Jul 6 '15 at 9:58




2




2





This did not work for me -new sources.list was not generated.

– hydroxide
Aug 10 '15 at 20:26





This did not work for me -new sources.list was not generated.

– hydroxide
Aug 10 '15 at 20:26




1




1





I have tested this again now, it generates a new one. You have to enable some repository, like main, universe etc

– Anwar
Aug 11 '15 at 2:37





I have tested this again now, it generates a new one. You have to enable some repository, like main, universe etc

– Anwar
Aug 11 '15 at 2:37













Thanks, the other places I looked didn't mention the update section. It was required for me to get things installed with apt

– Darrel Holt
Jan 14 '18 at 22:36





Thanks, the other places I looked didn't mention the update section. It was required for me to get things installed with apt

– Darrel Holt
Jan 14 '18 at 22:36













Thnaks, you save my operation system, rs

– Diogo Henrique Fragoso de Oliv
Apr 13 '18 at 2:17





Thnaks, you save my operation system, rs

– Diogo Henrique Fragoso de Oliv
Apr 13 '18 at 2:17













99














Go to https://repogen.simplylinux.ch.



Select your Country and Ubuntu Release.



For the default set of repositories, you need to enable these repositories.




  • All of the Ubuntu Branches repositories.

  • Security - Important Security Updates.

  • Security Sources Repository

  • Updates - Recommended Updates

  • Updates Sources Repository


If you want to install software from Canonical Partner Repositories (closed source software), enable the Ubuntu Partner Repositories (both of them).



Enable any 3rd party repository you wish to enable.



Now, click the Generate List button at the bottom of that page and you'll see your generated sources.list.



Replace the old sources.list with the new one



Run the following commands in a Terminal.



sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
gksudo gedit /etc/apt/sources.list


Copy/paste all the text from the newly generated sources.list to this file. Save it and close Gedit.



Now, update apt.



sudo apt-get update


This will update your repository index with the current sources.list and then you can install any software using Software Center, Synaptic or apt-get.






share|improve this answer


























  • Somewhere in the past, you added ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/source/… to your list. Did you last have the natty version before the beta? I suspect the upgrader changed natty to precise, but there is no precise version available for this package. I would delete it from "Other Software". The error isn't hurting anything, by the way.

    – Marty Fried
    Apr 21 '12 at 20:27
















99














Go to https://repogen.simplylinux.ch.



Select your Country and Ubuntu Release.



For the default set of repositories, you need to enable these repositories.




  • All of the Ubuntu Branches repositories.

  • Security - Important Security Updates.

  • Security Sources Repository

  • Updates - Recommended Updates

  • Updates Sources Repository


If you want to install software from Canonical Partner Repositories (closed source software), enable the Ubuntu Partner Repositories (both of them).



Enable any 3rd party repository you wish to enable.



Now, click the Generate List button at the bottom of that page and you'll see your generated sources.list.



Replace the old sources.list with the new one



Run the following commands in a Terminal.



sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
gksudo gedit /etc/apt/sources.list


Copy/paste all the text from the newly generated sources.list to this file. Save it and close Gedit.



Now, update apt.



sudo apt-get update


This will update your repository index with the current sources.list and then you can install any software using Software Center, Synaptic or apt-get.






share|improve this answer


























  • Somewhere in the past, you added ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/source/… to your list. Did you last have the natty version before the beta? I suspect the upgrader changed natty to precise, but there is no precise version available for this package. I would delete it from "Other Software". The error isn't hurting anything, by the way.

    – Marty Fried
    Apr 21 '12 at 20:27














99












99








99







Go to https://repogen.simplylinux.ch.



Select your Country and Ubuntu Release.



For the default set of repositories, you need to enable these repositories.




  • All of the Ubuntu Branches repositories.

  • Security - Important Security Updates.

  • Security Sources Repository

  • Updates - Recommended Updates

  • Updates Sources Repository


If you want to install software from Canonical Partner Repositories (closed source software), enable the Ubuntu Partner Repositories (both of them).



Enable any 3rd party repository you wish to enable.



Now, click the Generate List button at the bottom of that page and you'll see your generated sources.list.



Replace the old sources.list with the new one



Run the following commands in a Terminal.



sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
gksudo gedit /etc/apt/sources.list


Copy/paste all the text from the newly generated sources.list to this file. Save it and close Gedit.



Now, update apt.



sudo apt-get update


This will update your repository index with the current sources.list and then you can install any software using Software Center, Synaptic or apt-get.






share|improve this answer















Go to https://repogen.simplylinux.ch.



Select your Country and Ubuntu Release.



For the default set of repositories, you need to enable these repositories.




  • All of the Ubuntu Branches repositories.

  • Security - Important Security Updates.

  • Security Sources Repository

  • Updates - Recommended Updates

  • Updates Sources Repository


If you want to install software from Canonical Partner Repositories (closed source software), enable the Ubuntu Partner Repositories (both of them).



Enable any 3rd party repository you wish to enable.



Now, click the Generate List button at the bottom of that page and you'll see your generated sources.list.



Replace the old sources.list with the new one



Run the following commands in a Terminal.



sudo mv /etc/apt/sources.list /etc/apt/sources.list.old
gksudo gedit /etc/apt/sources.list


Copy/paste all the text from the newly generated sources.list to this file. Save it and close Gedit.



Now, update apt.



sudo apt-get update


This will update your repository index with the current sources.list and then you can install any software using Software Center, Synaptic or apt-get.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jul 3 '16 at 14:46









muru

1




1










answered Apr 21 '12 at 18:24









SirCharloSirCharlo

30.4k75976




30.4k75976













  • Somewhere in the past, you added ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/source/… to your list. Did you last have the natty version before the beta? I suspect the upgrader changed natty to precise, but there is no precise version available for this package. I would delete it from "Other Software". The error isn't hurting anything, by the way.

    – Marty Fried
    Apr 21 '12 at 20:27



















  • Somewhere in the past, you added ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/source/… to your list. Did you last have the natty version before the beta? I suspect the upgrader changed natty to precise, but there is no precise version available for this package. I would delete it from "Other Software". The error isn't hurting anything, by the way.

    – Marty Fried
    Apr 21 '12 at 20:27

















Somewhere in the past, you added ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/source/… to your list. Did you last have the natty version before the beta? I suspect the upgrader changed natty to precise, but there is no precise version available for this package. I would delete it from "Other Software". The error isn't hurting anything, by the way.

– Marty Fried
Apr 21 '12 at 20:27





Somewhere in the past, you added ppa.launchpad.net/pmcenery/ppa/ubuntu/dists/precise/main/source/… to your list. Did you last have the natty version before the beta? I suspect the upgrader changed natty to precise, but there is no precise version available for this package. I would delete it from "Other Software". The error isn't hurting anything, by the way.

– Marty Fried
Apr 21 '12 at 20:27











17














By default there will be a backup for your sources.list file on the same directory itself.



sudo cp /etc/apt/sources.list.save /etc/apt/sources.list


Answer from similar question here: https://askubuntu.com/a/465210/150936






share|improve this answer





















  • 7





    cp: cannot stat `/etc/apt/sources.list.save': No such file or directory

    – Dr.jacky
    Jul 6 '15 at 9:58











  • I'm on 18.04.1. I didn't have /etc/apt/sources.list.save but I did have /etc/apt/sources.list.curtin.old. Is that the equivalent?

    – jbobbins
    Oct 30 '18 at 16:48











  • worth to note if you just upgraded the distro and kept having errors with apt-get install, then instead of sources.list.save do copy sources.list.distUpgrade

    – MaKiPL
    yesterday
















17














By default there will be a backup for your sources.list file on the same directory itself.



sudo cp /etc/apt/sources.list.save /etc/apt/sources.list


Answer from similar question here: https://askubuntu.com/a/465210/150936






share|improve this answer





















  • 7





    cp: cannot stat `/etc/apt/sources.list.save': No such file or directory

    – Dr.jacky
    Jul 6 '15 at 9:58











  • I'm on 18.04.1. I didn't have /etc/apt/sources.list.save but I did have /etc/apt/sources.list.curtin.old. Is that the equivalent?

    – jbobbins
    Oct 30 '18 at 16:48











  • worth to note if you just upgraded the distro and kept having errors with apt-get install, then instead of sources.list.save do copy sources.list.distUpgrade

    – MaKiPL
    yesterday














17












17








17







By default there will be a backup for your sources.list file on the same directory itself.



sudo cp /etc/apt/sources.list.save /etc/apt/sources.list


Answer from similar question here: https://askubuntu.com/a/465210/150936






share|improve this answer















By default there will be a backup for your sources.list file on the same directory itself.



sudo cp /etc/apt/sources.list.save /etc/apt/sources.list


Answer from similar question here: https://askubuntu.com/a/465210/150936







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 13 '17 at 12:24









Community

1




1










answered Apr 26 '15 at 16:06









David KennedyDavid Kennedy

4111515




4111515








  • 7





    cp: cannot stat `/etc/apt/sources.list.save': No such file or directory

    – Dr.jacky
    Jul 6 '15 at 9:58











  • I'm on 18.04.1. I didn't have /etc/apt/sources.list.save but I did have /etc/apt/sources.list.curtin.old. Is that the equivalent?

    – jbobbins
    Oct 30 '18 at 16:48











  • worth to note if you just upgraded the distro and kept having errors with apt-get install, then instead of sources.list.save do copy sources.list.distUpgrade

    – MaKiPL
    yesterday














  • 7





    cp: cannot stat `/etc/apt/sources.list.save': No such file or directory

    – Dr.jacky
    Jul 6 '15 at 9:58











  • I'm on 18.04.1. I didn't have /etc/apt/sources.list.save but I did have /etc/apt/sources.list.curtin.old. Is that the equivalent?

    – jbobbins
    Oct 30 '18 at 16:48











  • worth to note if you just upgraded the distro and kept having errors with apt-get install, then instead of sources.list.save do copy sources.list.distUpgrade

    – MaKiPL
    yesterday








7




7





cp: cannot stat `/etc/apt/sources.list.save': No such file or directory

– Dr.jacky
Jul 6 '15 at 9:58





cp: cannot stat `/etc/apt/sources.list.save': No such file or directory

– Dr.jacky
Jul 6 '15 at 9:58













I'm on 18.04.1. I didn't have /etc/apt/sources.list.save but I did have /etc/apt/sources.list.curtin.old. Is that the equivalent?

– jbobbins
Oct 30 '18 at 16:48





I'm on 18.04.1. I didn't have /etc/apt/sources.list.save but I did have /etc/apt/sources.list.curtin.old. Is that the equivalent?

– jbobbins
Oct 30 '18 at 16:48













worth to note if you just upgraded the distro and kept having errors with apt-get install, then instead of sources.list.save do copy sources.list.distUpgrade

– MaKiPL
yesterday





worth to note if you just upgraded the distro and kept having errors with apt-get install, then instead of sources.list.save do copy sources.list.distUpgrade

– MaKiPL
yesterday





protected by Community Apr 17 '15 at 21:30



Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



Would you like to answer one of these unanswered questions instead?



Popular posts from this blog

日野市

GameSpot

Tu-95轟炸機