2

I was trying to modify that file, and then somehow all the contents got deleted... does anyone know where I can get a new one? I'm using Ubuntu 11.04

Edit: Moreover, what had happened was I had changed all the occurrences of 'archive.ubuntu.com' in that file to 'old-releases.ubuntu.com', but then this caused the command sudo apt-get install [package-name] to always return with "Cannot locate package...", no matter what package name I typed. So I tried to switch all occurrences back to what they originally were, using sed, and that's when everything in that file disappeared...

1

2 Answers 2

2

There is a copy of this file in /usr/share/doc/apt/examples/sources.list

You can make a new copy by doing:

sudo cp /usr/share/doc/apt/examples/sources.list /etc/apt/sources.list
2
  • hmm, thank you.. But from what I see, this new copy is only 11 lines long, whereas I remember the original file (even before I made any edits to it in the first place), being much longer, and I had to scroll for a bit to get to the bottom. Do you know what the difference is? Mar 22, 2014 at 19:08
  • The template doesn't include all the comments in the original. Mar 23, 2014 at 17:53
0

Support for 11.04 is discontinued and you may have a difficult time completely restoring the sources.list file to your prior contents. Are you able to upgrade to a newer edition, perhaps with long term support? 12.04 LTS might be your best option, and 14.04 LTS comes out next month.

Try updating via the FromUSBStick instructions. I use this for system recovery, its a good tool to carry around in your backpack anyway. If your hardware is out of date and your worried about demand on your system, you can always do away with the 'fancier' Unity features and Compiz and such.

This blog post may be helpful

If upgrading isnt an option, you may be able to restore your sources.list as follows:

 sudo sed -i 's,http://.*ubuntu.com,http://old-releases.ubuntu.com,g' /etc/apt/sources.list

sudo apt-get -y update

If you intend on rebundling the image, you will need to run the following commands to ensure that bundled images retain the settings:

dpkg-divert --local --rename --add /etc/cloud/templates/sources.list.tmpl

sed -i  's,http://.*ubuntu.com,http://OLDRELEASEDOMAIN.com,g' \

     /etc/cloud/templates/sources.list.tmpl.distrib \

    | sudo tee /etc/cloud/templates/sources.list.tmpl

where OLDRELEASEDOMAIN is 'old-releases DOT ubuntu DOT com' (given that the url isnt allowed here, you are further encouraged to upgrade your system).

2
  • thanks. so when you upgrade to a newer version, do you need to backup all of the files that you want? Mar 22, 2014 at 19:14
  • Not in principle, no; an upgrade will overwrite the old operating system, but will not delete any files that you added yourself after the previous installation. However, it is a good safety precaution to backup anything you want to keep, just in case something goes wrong during the upgrade.
    – Jos
    Mar 22, 2014 at 19:41

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