The repository does not have a Release file on older Ubuntu releases

Recently I working on some posts on how to upgrade to Node v14.x on a
variety of different versions of Debian and Ubuntu. The big gotcha came with
trying to get things running on versions of Ubuntu that were at end of life and
no longer receiving security updates.

The issue cropped up when attempting to run apt update and would error out
because the Release file for security.ubuntu.com was not available for the
release in question.

To see it in action, we can use Ubuntu 16.10 in Docker:

% docker run -it ubuntu:16.10 bash
root@f5d0f05cbaf9:/# apt update
Ign:1 http://archive.ubuntu.com/ubuntu yakkety InRelease
Ign:2 http://security.ubuntu.com/ubuntu yakkety-security InRelease
Ign:3 http://archive.ubuntu.com/ubuntu yakkety-updates InRelease
Err:4 http://security.ubuntu.com/ubuntu yakkety-security Release
  404  Not Found [IP: 91.189.88.152 80]
Ign:5 http://archive.ubuntu.com/ubuntu yakkety-backports InRelease
Err:6 http://archive.ubuntu.com/ubuntu yakkety Release
  404  Not Found [IP: 91.189.88.142 80]
Err:7 http://archive.ubuntu.com/ubuntu yakkety-updates Release
  404  Not Found [IP: 91.189.88.142 80]
Err:8 http://archive.ubuntu.com/ubuntu yakkety-backports Release
  404  Not Found [IP: 91.189.88.142 80]
Reading package lists... Done
E: The repository 'http://security.ubuntu.com/ubuntu yakkety-security Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu yakkety Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu yakkety-updates Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'http://archive.ubuntu.com/ubuntu yakkety-backports Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

No good.

Now while I personally don’t condone running operating systems that are so
severely out of date that they are out outside of their security support window,
I still wanted to figure out how to handle this because I do run into older
versions of Ubuntu from time to time.

Also, fun fact, some of my highest trafficked posts in 2020 are actually for
Ubuntu versions as old as 14.04 LTS. Yeah, I couldn’t believe it either.

Anyway, I’m not here to judge your upgrade decisions and wanted to share a quick
tip to get your old version of Ubuntu able to update again.

The trick is that you need to edit /etc/apt/sources.list to reference
old-releases.ubuntu.com instead of both archive.ubuntu.com and
security.ubuntu.com.

You certainly could edit sources.list with your favorite command-line editor,
but if you’re starting from scratch with a brand new Docker container, you may
not have any editors available.

Maybe there is an editor available, but it wasn’t vi[m] so I was kind of dead
in the water.

Fortunately there’s always sed or “stream editor” which is available, can
handle replacing multiple strings with ease
and can modify the file in
place, and even create a backup for us.

sed --in-place='.bak' 
  's/(archive|security).ubuntu.com/old-releases.ubuntu.com/g' 
  /etc/apt/sources.list

If you don’t believe me, you can either run cat /etc/apt/sources.list and
check or just run apt update again:

root@f5d0f05cbaf9:/# apt update
Get:1 http://old-releases.ubuntu.com/ubuntu yakkety InRelease [247 kB]
Get:2 http://old-releases.ubuntu.com/ubuntu yakkety-updates InRelease [102 kB]
Get:3 http://old-releases.ubuntu.com/ubuntu yakkety-backports InRelease [102 kB]
Get:4 http://old-releases.ubuntu.com/ubuntu yakkety-security InRelease [102 kB]
Get:5 http://old-releases.ubuntu.com/ubuntu yakkety/universe Sources [10.2 MB]
Get:6 http://old-releases.ubuntu.com/ubuntu yakkety/restricted amd64 Packages [13.9 kB]
Get:7 http://old-releases.ubuntu.com/ubuntu yakkety/universe amd64 Packages [10.1 MB]
Get:8 http://old-releases.ubuntu.com/ubuntu yakkety/main amd64 Packages [1593 kB]
Get:9 http://old-releases.ubuntu.com/ubuntu yakkety/multiverse amd64 Packages [179 kB]
Get:10 http://old-releases.ubuntu.com/ubuntu yakkety-updates/universe Sources [78.0 kB]
Get:11 http://old-releases.ubuntu.com/ubuntu yakkety-updates/multiverse amd64 Packages [12.4 kB]
Get:12 http://old-releases.ubuntu.com/ubuntu yakkety-updates/universe amd64 Packages [232 kB]
Get:13 http://old-releases.ubuntu.com/ubuntu yakkety-updates/restricted amd64 Packages [12.1 kB]
Get:14 http://old-releases.ubuntu.com/ubuntu yakkety-updates/main amd64 Packages [340 kB]
Get:15 http://old-releases.ubuntu.com/ubuntu yakkety-backports/universe amd64 Packages [4179 B]
Get:16 http://old-releases.ubuntu.com/ubuntu yakkety-backports/main amd64 Packages [3619 B]
Get:17 http://old-releases.ubuntu.com/ubuntu yakkety-security/universe Sources [31.2 kB]
Get:18 http://old-releases.ubuntu.com/ubuntu yakkety-security/main amd64 Packages [184 kB]
Get:19 http://old-releases.ubuntu.com/ubuntu yakkety-security/multiverse amd64 Packages [3204 B]
Get:20 http://old-releases.ubuntu.com/ubuntu yakkety-security/restricted amd64 Packages [11.8 kB]
Get:21 http://old-releases.ubuntu.com/ubuntu yakkety-security/universe amd64 Packages [117 kB]
Fetched 23.7 MB in 4s (4963 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.

Now with your system back in working order, maybe it’s a good time to upgrade?
😉

Josh Sherman - The Man, The Myth, The Avatar

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.


If you found this article helpful, please consider buying me a coffee.