and, just for the sake of completeness... what about extras repository (for Skype etc)? Are they available anywhere after EOF?
– MestreLionApr 27 '13 at 1:00

17

An even easier way is sudo nano /etc/apt/sources.list, as vi* is just annoying...
– WilfMar 1 '14 at 18:35

1

@TomášZato, until someone can answer the bits about extras.ubuntu.com, you can comment out the particular lines to proceed with other apt-get uses.
– Vineet MenonAug 21 '14 at 7:29

4

The sed command doesn't always work, as there are mirrors that are run by organizations outside of ubuntu.com. I'm not even sure that there are three dots for all of the domain names. For those, you must manually edit /etc/apt/sources.list.
– OlatheJul 9 '15 at 5:06

3

There is an issue with this in upgrading from 15.04 as of 3/21/17. Vivid is no longer supported, however the dist is not on old-releases.
– Matthew TitsworthMar 21 '17 at 20:07

Why are we facing 404 errors

Normal Ubuntu releases are supported for 9 months. LTS releases are supported for 5 years.

Past releases may have different support schedules (for example, normal releases (before 13.04) used to be supported for 18 months, while LTS releases (before 12.04) used to be supported for 3 years on the desktop and 5 years on the server).

EOL: Once the support period for a particular release is over; they are called End Of Life (EOL) and all the updates and package repositories for that Release are transferred to a different server which results in 404 errors while running sudo apt-get update. You can confirm if your release has become EOL by going to this page. If your Ubuntu release is mentioned under "End Of Life (EOL)" Table, then the release is no longer supported and you should try to upgrade to a newer supported release. However, if you wish to continue using this unsupported release, you would have to make necessary modifications in /etc/apt/sources.list to point to the old-releases server of Ubuntu.

Steps to make necessary modifications

Open your Terminal:

Press Ctrl + Alt + T; OR

If you have Gnome: Applications → Accessories → Terminal; OR

If you have Unity: press Super (the key between Left Ctrl and Left Alt) and query for Terminal.

Run the following command to enter into root shell:

sudo -i

input your user password and press Enter. The prompt would change and would indicate that the root user is now logged in. Here run the following command:

gedit /etc/apt/sources.list

The file would open in a new Gedit window. Find the first line which doesn't start with #. Suppose you are running Karmic Koala (Ubuntu 9.10): it should be like the following line:

Search for: http://security.ubuntu.com/ubuntu (this exact url for all the Ubuntu Releases — whatever be the present server that you are using)

Replace with: http://old-releases.ubuntu.com/ubuntu

Press Replace All

Save your file and exit Gedit.

Run the following command to get out of root shell:

logout

You would find that the prompt switches back to indicate that your normal user is now logged in. Then run the following:

sudo apt-get update

There you go. No 404 Errors this time. You can now install all the available packages for your Ubuntu Release. You can also run sudo apt-get dist-upgrade to install any Security/Bug-fix updates which have not yet been installed but you won't get any further Security/Bug-fix updates from Ubuntu.

+1 for also including instructions to update the security repo.
– GaffiMar 16 '13 at 16:07

Actually the first line without a # was raring main restricted, no deb whatsoever. I changed it as specified, and then also replaced the urls, but still got 404s.
– YokhenOct 23 '14 at 23:11

2

@Yokhen If the line didn't begin with deb <siteurl>, then most likely your /etc/apt/sources.list file has become corrupted due to some reason. Please follow the answers given at: How do I restore the default repositories?. That would restore the correct /etc/apt/sources.list for you and then follow my answer to change the servers to point to the old-releases server.
– AdityaOct 24 '14 at 8:15

thanks! Somehow I managed to upgrade from 13.04 to 13.10 though, and now I'm on my way to 14.04.
– YokhenOct 24 '14 at 8:56

1

@Dan, modified the answer, now we enter into root shell and then run the graphical program. No need to use gksudo anymore. I want to keep this answer for the novice users like me and don't want to complicate matters with using terminal based editors, however easy or powerful they may be.
– AdityaJul 17 '16 at 13:56

GUI Method

Well, actually we will do this without to use any terminal. Not even once. Just GUI, I promise ;-)

First, open Software Sources (or Software & Updates in newer versions). It does not matter how old is your Ubuntu, there is certainly something like this. For Ubuntu 9.04 (Jaunty Jackalope) look at next image to see where is located:

After Software Sources (or Software & Updates) it is open, go in Ubuntu Software and Updates tabs and unselect everytiyng like in next pictures. You don't need this things anymore since your Ubuntu version is End of Life:

Without closing Software Sources (or Software & Updates), go in Third-Party Software (for newest releases this tab is named Other Software) tab and add a new apt repository. Insert exactly next line when you are asked:

If your version of Ubuntu is other than 9.04, replace in the above line jaunty with your Ubuntu codename (for example if you have Ubuntu 9.10, replace with karmic and so on):

Now, when you will close Software Sources (or Software & Updates) you will be asked to reload the information about available software. Just be sure that you have a working internet connection:

And now you are free to download almost whatever you want. For 9.04 you can use Synaptic Package Manager. For newest releases there is Ubuntu Software Center.

For example to install VLC in Ubuntu 9.04 using Synaptic Package Manager, follow the instructions in the following pictures:

If you want to Update your Ubuntu to a new release, just go to System > Update Manager:

I tested this method from a live session of Ubuntu 9.04 (Jaunty Jackalope) and as you can see from these pictures it worked. If you are on an installed session of Ubuntu you will be asked sometimes for root or admin password. Just insert your personal user password when you are asked.

Thanks mikewhatever, but the result is the same when I try "apt-get install lm-sensors". Maybe there's another missing source: "Reading package lists... Done Building dependency tree Reading state information... Done Package lm-sensors is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package lm-sensors has no installation candidate"
– RorroApr 13 '12 at 10:55

I got here since I could not upgrade a system from 15.10 (EOL) to 16.04. But none of the answers worked for me... even after doing everything that was suggested here I kept getting from sudo do-release-upgrade the annoying response:

Checking for a new Ubuntu release
No new release found

And I had no success in running update-manager; it kept throwing exceptions which I could not resolve. I suspect something is corrupted in my 15.10 installation, but the bottom line is that the built-in upgrades just fail.

So I looked for a non-built-in method, and sure enough I found it looking at this answer.

It took me a while to find this post. Only using the referenced tarball I succeeded in getting the upgrade running from 15.04 / wily. The approaches using the old-releases urls did not work. I hope this helps other users getting into this problem.
– JeroenDec 19 '16 at 9:34

Seriously thanks for this, I just used these steps to upgrade 10.04 to 12.04. My issue was different in that my install wasn't corrupted, but there was an error on do-release-upgrade which I was unable to find in the terminal. Following these steps popped up a dialog telling me "error authenticating some packages" which led me to askubuntu.com/a/426121/262601 which DID allow the upgrade to continue successfully. Was pulling my hair out, but its my own fault for not upgrading sooner.
– FooxzJan 6 '17 at 0:27

Unfortunately, not even this works for 15.04
– MiroJanosikJan 22 '18 at 18:32

Works as a charm! I had a zesty server that i neglected and I got it to artful and could upgrade further from there, thanks!
– Patrick CornelissenAug 6 '18 at 7:18

The trick is to add http://old-releases.ubuntu.com/ubuntu/ as a mirror, and then tell Software Sources to switch to that mirror.

To do this, backup and edit /usr/share/python-apt/templates/Ubuntu.mirrors. Choose a fake location for the old-releases server (e.g. #LOC:US), and add the following line under it:

#LOC:US
http://old-releases.ubuntu.com/ubuntu/

Now open the system's Software Sources dialog, and manually select old-releases.ubuntu.com as though it were your regional mirror. You should find it listed under the fake location you chose in the previous step.

The next time you reload your package information via Synaptic or Update Manager, you should see it successfully retrieving updated package information.

Thanks gajdipajti, I'm looking for it inside the package list, but cannot find the correct ".deb". My ubuntu already has "libsensors3", but all the packages ask me for the "libsensors4". I know the normal solution should be upgrade, but I cannot do it because the computer is dedicated to be used with a software that only runs on 9.10.
– RorroApr 13 '12 at 10:34

There is an edge case - apt-get claims 16.04 LTS does not exist - where the old package (Vivid, in my case) was not in on the "old-releases" server. But apt-get could only find kernel and Google updates.

I am not sure exactly what my problem was because I had blindly followed the accepted answers sed command (never a smart move).

This did not work because Vivid was not in the "old-releases" archive but was still on the gb.archive.ubuntu.com mirror.

In that specific case, the solution was as follows:

sudo -i
edit /etc/apt/sources.list

Carefully go through all the sources and discover one of them was old and wrong and had failed to be properly updated (or something). Or, as I did, search replace from old-releases.ubuntu.com to gb.archive.ubuntu.com. It then upgraded, without a problem, to the next release while I caught up on some reading.

So either:

There was a fault in my sources

The gb.archive.unbuntu.com mirror has an older set of releases.

The takeaway here is that while the majority of answers here may apply in some cases it would pay to be sure that your /etc/apt/sources.list is correct before you nuke it for the "old-releases" archive.

You can figure out which of the archive or your mirror has the version you need by simply pointing a browser tab at the archive and question and looking for your version name in the folder list. Whichever one has your version, is the source you need to use.

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).