The proper and straight forward solution is to upgrade to a recent version by:
sudo apt-get dist-upgrade
dist-upgrade is too risky for some people. Because they might still be considering for any side effect, preparing for upgrade etc.
And they might not want to upgrade now.
Luckily, there is a workaround to solve this by using the new location for the old package repository, which is located at
I write a script below and you could run it on your server and it will replace all of the repository urls that are pointed to ‘archive.ubuntu.com’ or ‘security.ubuntu.com’ by ‘old-releases.ubuntu.com’
You could download the above script and run as executable by:
curl -O https://gist.githubusercontent.com/zdk/875c9fdf3ef588b2e792/raw/81d0ff37e4179ea05fd8694f8c7e10b0c3187d58/fix-404-no-distupgrade.sh sudo chmod +x fix-404-no-distupgrade.sh ./fix-404-no-distupgrade.sh
Without manually editing files.