Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
175
rated 0 times [  175] [ 0]  / answers: 1 / hits: 681495  / 2 Years ago, sat, august 6, 2022, 8:41:51

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.


More From » repository

 Answers
1

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 a 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 updates. To do so, switch to Updates tab and select one or more updates channel. I recommend selecting the security and updates channels 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.



###### 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


If you're using another release, you need to replace the precise word with your Ubuntu release name. You can see which name you should use with this command:



lsb_release -c -s


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


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



Note 2: Using # at the start of the line makes that line a comment. apt will ignore it, so any 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


[#39175] Monday, August 8, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
imonove

Total Points: 82
Total Questions: 113
Total Answers: 106

Location: Saint Vincent and the Grenadines
Member since Wed, Nov 3, 2021
3 Years ago
;