Sunday, March 04, 2018

Ubuntu 17.04 - How to Fix apt-get update 404 Error

If you are trying to do an "apt-get update" on your Ubuntu 17.04 server and run into the following issue:

$ apt-get update

Ign:1 http://security.ubuntu.com/ubuntu zesty-security InRelease
Ign:2 http://us.archive.ubuntu.com/ubuntu zesty InRelease
Err:3 http://security.ubuntu.com/ubuntu zesty-security Release
  404  Not Found [IP: 91.189.91.23 80]
Ign:4 http://us.archive.ubuntu.com/ubuntu zesty-updates InRelease
Ign:5 http://us.archive.ubuntu.com/ubuntu zesty-backports InRelease
Err:6 http://us.archive.ubuntu.com/ubuntu zesty Release
  404  Not Found [IP: 91.189.91.23 80]
Err:7 http://us.archive.ubuntu.com/ubuntu zesty-updates Release
  404  Not Found [IP: 91.189.91.23 80]
Err:8 http://us.archive.ubuntu.com/ubuntu zesty-backports Release
  404  Not Found [IP: 91.189.91.23 80]
Reading package lists... Done
E: The repository 'http://security.ubuntu.com/ubuntu zesty-security Release' does no longer 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://us.archive.ubuntu.com/ubuntu zesty Release' does no longer 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://us.archive.ubuntu.com/ubuntu zesty-updates Release' does no longer 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://us.archive.ubuntu.com/ubuntu zesty-backports Release' does no longer 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.

This is due to the fact of that official support for Ubuntu 17.04 "Zesty Zapus" ends on 2018-01-13 and the Ubuntu 17.04 repositories have been closed and withdrawn. I strongly recommend you to upgrade to 17.10, in the long term. But to fix the above error, you can quickly hack your "/etc/apt/sources.list" file to use the old-release repo.


Make a copy of the current "sources.list" file

$ cp /etc/apt/sources.list /etc/apt/sources.list-bk


Update repository links

$ vim /etc/apt/sources.list
Update
http://us.archive.ubuntu.com/ubuntu
to
http://old-releases.ubuntu.com/ubuntu

Update
http://security.ubuntu.com/ubuntu
to
http://old-releases.ubuntu.com/ubuntu

Now you should be able to perform an "apt-get update"

No comments: