Skip to content

Instantly share code, notes, and snippets.

@dergachev
Last active September 12, 2024 02:24
Show Gist options
  • Save dergachev/f5da514802fcbbb441a1 to your computer and use it in GitHub Desktop.
Save dergachev/f5da514802fcbbb441a1 to your computer and use it in GitHub Desktop.
What to do when your ubuntu distro is End-of-Life

Let's say you're using Ubuntu 13.04 (Raring Ringtail, released in April 2013) and it just went End-of-Life on you, because it's supported for only 6 months, and the deprecated packages are taken down after 12 months.

You'll probably figure this out the hard way. When you run sudo apt-get update, it will eventually report these errors:

Ign http://archive.ubuntu.com raring-updates/universe Sources/DiffIndex
Err http://security.ubuntu.com raring-security/main Sources
  404  Not Found [IP: 91.189.91.15 80]
Err http://security.ubuntu.com raring-security/universe Sources
  404  Not Found [IP: 91.189.91.15 80]
Err http://security.ubuntu.com raring-security/main amd64 Packages
  404  Not Found [IP: 91.189.91.15 80]
Ign http://archive.ubuntu.com raring-updates/main amd64 Packages/DiffIndex
Err http://security.ubuntu.com raring-security/universe amd64 Packages
  404  Not Found [IP: 91.189.91.15 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/main/source/Sources  404  Not Found [IP: 91.189.91.15 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/universe/source/Sources  404  Not Found [IP: 91.189.91.15 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/main/binary-amd64/Packages  404  Not Found [IP: 91.189.91.15 80]

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/universe/binary-amd64/Packages  404  Not Found [IP: 91.189.91.15 80]

Visiting http://archive.ubuntu.com/ubuntu/dists does confirm that raring packages are indeed gone, while lucid, precise, saucy, and trusty are still there, as per their promised support schedule.

Some googling reveals that they're not deleted, but simply moved to http://old-releases.ubuntu.com/ubuntu/dists/, sort of a graveyard for insecure and unsupported packages.

To make apt-get update work, we simply need to edit /etc/apt/sources.list and update all URLs from security.ubuntu.com and archive.ubuntu.com to point to old-releases.ubuntu.com, as per the following sed command:

sudo sed -i.bak -r 's/(archive|security).ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

After this, sudo apt-get update seems to run without a hitch. Of course if you do this, you're accepting to use an insecure system, and should do sudo apt-get install update-manager-core; do-release-upgrade as soon as possible.

SOURCES:

@tobek
Copy link

tobek commented Feb 27, 2016

💯

Another issue you may run into is if your machine is an AMI from AWS, in which case after running that sed command I found my sources were referring to URLs like http://us-east-1.ec2.old-releases.ubuntu.com/ubuntu/dists/raring/Release.gpg.

I was able to fix this by opening up /etc/apt/sources.list and simply deleting all instances of us-east-1.ec2.old-releases. - seems like the old-releases.ubuntu.com host had everything I needed, and from there I could update, upgrade, and then sudo do-release-upgrade

@gercaceres
Copy link

Thanks men!

@fanzhoulll
Copy link

Finally find a useful answer...really getting tired of the nonsense on stack overflow asking you to do sudo apt-get update..
Thanks dude!

@ment
Copy link

ment commented Sep 30, 2016

Great tip. Also, if you continue having problems like me trying to upgrade Ubuntu 10.04, try removing the us.subdomain if you have it. Like this us.old-releases.ubuntu.com to old-releases.ubuntu.com

@fagiani
Copy link

fagiani commented Jul 5, 2017

This is life saving for legacy machines.

@davis-byamugisha
Copy link

Amazing, it worked. Thanks!

@Xunnamius
Copy link

Thanks!

@realtebo
Copy link

Thanks.

What to do for canonical repos ?

Err http://archive.canonical.com vivid/partner amd64 Packages                                       
  404  Not Found [IP: 91.189.91.15 80]

@Bacham
Copy link

Bacham commented Jan 21, 2018

Thanks!

@TaeheeYoo
Copy link

Thank you so much!!

@IRGC
Copy link

IRGC commented Feb 16, 2018

root@de2 ~ # apt-get install mediainfo
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libmediainfo0v5 libmms0 libtinyxml2-4 libzen0v5
Suggested packages:
mediainfo-gui
The following NEW packages will be installed:
libmediainfo0v5 libmms0 libtinyxml2-4 libzen0v5 mediainfo
0 upgraded, 5 newly installed, 0 to remove and 48 not upgraded.
Need to get 1,931 kB/1,984 kB of archives.
After this operation, 6,944 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Err:1 http://old-releases.ubuntu.com/ubuntu yakkety-updates/universe amd64 libzen0v5 amd64 0.4.33-3ubuntu0.16.10.1
404 Not Found
Err:2 http://old-releases.ubuntu.com/ubuntu yakkety/universe amd64 libmediainfo0v5 amd64 0.7.88-1
404 Not Found
Err:3 http://old-releases.ubuntu.com/ubuntu yakkety/universe amd64 mediainfo amd64 0.7.88-1
404 Not Found
E: Failed to fetch http://old-releases.ubuntu.com/ubuntu/pool/universe/libz/libzen/libzen0v5_0.4.33-3ubuntu0.16.10.1_amd64.deb 404 Not Found
E: Failed to fetch http://old-releases.ubuntu.com/ubuntu/pool/universe/libm/libmediainfo/libmediainfo0v5_0.7.88-1_amd64.deb 404 Not Found
E: Failed to fetch http://old-releases.ubuntu.com/ubuntu/pool/universe/m/mediainfo/mediainfo_0.7.88-1_amd64.deb 404 Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

i update the sources.list url hostname to old-releases but still not working what to do?

@mikhaildubov
Copy link

This saved me a lot of time, thanks!

@tiwansh
Copy link

tiwansh commented Apr 15, 2018

Thanks a ton ! This rescued me. :)

@tbvinh
Copy link

tbvinh commented Aug 12, 2018

Thanks

@Owl3
Copy link

Owl3 commented Sep 2, 2018

For me i had to change all the ports.ubuntu.com/..../ to old-releases.ubuntu.com/ubuntu/

Without that /ubuntu/ on the end it couldn't find the packages.

I am trying to upgrade the parabuntu distribution on the parallella.

@realtebo
Copy link

realtebo commented Sep 2, 2018

My 2 coins:

sudo sed -i.bak -r 's/(archive|security).(ubuntu|canonical).com/old-releases.ubuntu.com/g' /etc/apt/sources.list

@portgasray
Copy link

Thanks!

@bscout9956
Copy link

bscout9956 commented Jun 27, 2019

Don't forget the extras :)
sudo sed -i.bak -r 's/(extras|archive|security).(ubuntu|canonical).com/old-releases.ubuntu.com/g' /etc/apt/sources.list

Also, it may be necessary (if you are having troubles with your region being in the url) to place your region code right before archive and security

For my region that would be (br = Brazil):
sudo sed -i.bak -r 's/(extras|br.archive|br.security).(ubuntu|canonical).com/old-releases.ubuntu.com/g' /etc/apt/sources.list

It seems to work just fine. ?Hopefully doesn't break the extras?, if so, you should probably disregard this comment.

@Insidexa
Copy link

you safe my life )) legacy project ) thx

@shikam
Copy link

shikam commented Apr 27, 2020

Hi,

root@shai-pc:/etc/apt/sources.list.d# apt-get update
Err:1 http://us.old-releases.ubuntu.com/ubuntu disco InRelease
Could not resolve 'us.old-releases.ubuntu.com'
Err:2 http://us.old-releases.ubuntu.com/ubuntu disco-updates InRelease
Could not resolve 'us.old-releases.ubuntu.com'
Err:3 http://us.old-releases.ubuntu.com/ubuntu disco-backports InRelease
Could not resolve 'us.old-releases.ubuntu.com'
Get:4 http://old-releases.ubuntu.com/ubuntu disco-security InRelease [97.5 kB]
Get:5 http://old-releases.ubuntu.com/ubuntu disco-security/main i386 Packages [176 kB]
Get:6 http://old-releases.ubuntu.com/ubuntu disco-security/main amd64 Packages [188 kB]
Get:7 http://old-releases.ubuntu.com/ubuntu disco-security/main Translation-en [77.3 kB]
Get:8 http://old-releases.ubuntu.com/ubuntu disco-security/main amd64 DEP-11 Metadata [37.6 kB]
Get:9 http://old-releases.ubuntu.com/ubuntu disco-security/main DEP-11 48x48 Icons [12.9 kB]
Get:10 http://old-releases.ubuntu.com/ubuntu disco-security/main DEP-11 64x64 Icons [27.4 kB]
Get:11 http://old-releases.ubuntu.com/ubuntu disco-security/main amd64 c-n-f Metadata [5,000 B]
Get:12 http://old-releases.ubuntu.com/ubuntu disco-security/restricted amd64 Packages [1,560 B]
Get:13 http://old-releases.ubuntu.com/ubuntu disco-security/restricted Translation-en [628 B]
Get:14 http://old-releases.ubuntu.com/ubuntu disco-security/restricted amd64 c-n-f Metadata [116 B]
Get:15 http://old-releases.ubuntu.com/ubuntu disco-security/universe i386 Packages [280 kB]
Get:16 http://old-releases.ubuntu.com/ubuntu disco-security/universe amd64 Packages [283 kB]
Get:17 http://old-releases.ubuntu.com/ubuntu disco-security/universe Translation-en [86.0 kB]
Get:18 http://old-releases.ubuntu.com/ubuntu disco-security/universe amd64 DEP-11 Metadata [19.9 kB]
Get:19 http://old-releases.ubuntu.com/ubuntu disco-security/universe DEP-11 48x48 Icons [14.3 kB]
Get:20 http://old-releases.ubuntu.com/ubuntu disco-security/universe DEP-11 64x64 Icons [49.7 kB]
Get:21 http://old-releases.ubuntu.com/ubuntu disco-security/universe amd64 c-n-f Metadata [6,652 B]
Get:22 http://old-releases.ubuntu.com/ubuntu disco-security/multiverse i386 Packages [1,624 B]
Get:23 http://old-releases.ubuntu.com/ubuntu disco-security/multiverse amd64 Packages [1,460 B]
Get:24 http://old-releases.ubuntu.com/ubuntu disco-security/multiverse Translation-en [1,000 B]
Get:25 http://old-releases.ubuntu.com/ubuntu disco-security/multiverse amd64 c-n-f Metadata [116 B]
Fetched 1,368 kB in 1s (1,018 kB/s)
Reading package lists... Done
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/disco/InRelease Could not resolve 'us.old-releases.ubuntu.com'
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/disco-updates/InRelease Could not resolve 'us.old-releases.ubuntu.com'
W: Failed to fetch http://us.old-releases.ubuntu.com/ubuntu/dists/disco-backports/InRelease Could not resolve 'us.old-releases.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

i update the sources.list url hostname to old-releases but still not working what to do?

@filipmihal
Copy link

Thanks a lot! ❤️

@ths2
Copy link

ths2 commented Aug 5, 2020

Thanks a lot!
Take some BATs!
Agradecimentos sinceros.

@tacianosilva
Copy link

Thanks a lot!

@kqvanity
Copy link

@moha312 Same thing goes for me with Ubuntu 10.04 LTS

@Sappurit
Copy link

Thanks, save my life.
ubuntu 14.04
sudo sed -i.bak -r 's/(extras|archive|security).(ubuntu).com/old-releases.ubuntu.com/g' /etc/apt/sources.list

@realtebo
Copy link

Happy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment