3

I've just recently installed Ubuntu 20.04 on my PC. When I try to sudo apt-get update in a new terminal, it gives me this error:

Hit:1 http://ppa.launchpad.net/git-core/ppa/ubuntu trusty InRelease            
Err:2 http://my.old-releases.ubuntu.com/ubuntu focal InRelease                 
  Could not resolve 'my.old-releases.ubuntu.com'
Ign:3 http://old-releases.ubuntu.com/ubuntu focal-security InRelease
Err:4 http://old-releases.ubuntu.com/ubuntu focal-security Release
  404  Not Found [IP: 91.189.91.123 80]
Err:5 http://my.old-releases.ubuntu.com/ubuntu focal-updates InRelease
  Could not resolve 'my.old-releases.ubuntu.com'
Err:6 http://my.old-releases.ubuntu.com/ubuntu focal-backports InRelease
  Could not resolve 'my.old-releases.ubuntu.com'
Reading package lists... Done
E: The repository 'http://old-releases.ubuntu.com/ubuntu focal-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.

How do I rectify this error? Thanks and I look forward to your answer shortly.

Yi Sun
  • 31
  • Neither the git-core PPA nor old-releases.ubuntu.com nor my.old-releases.ubuntu.com are part of a stock 20.04 install, so it seems clear that you have made some changes. Look at each error, and undo the change you made that caused it. If that's too much work, or you're not sure how to undo the change, then backup your data and reinstall...or ask a new question on how to undo that specific change. – user535733 Nov 01 '21 at 17:00
  • 2
    "Trusty" is Ubuntu 14.04. Something went terribly wrong with your install. Re-install after a good Wipe of the HD. – EODCraft Staff Nov 01 '21 at 17:00
  • 1
    Do you remember why and when your system started to have my.old-releases / old-releases is sources.list? @EODCraftStaff reinstallation is very time-consuming procedure. Bad recommendation. – N0rbert Nov 01 '21 at 21:46

1 Answers1

4

Ubuntu 20.04 LTS (focal) is actual release, so its packages are located in archive, not old-releases. You can fix this problem by using commands below:

sudo sed -i "s/my.old-releases/archive/g" /etc/apt/sources.list /etc/apt/sources.list.d/*.list
sudo sed -i "s/old-releases/archive/g" /etc/apt/sources.list /etc/apt/sources.list.d/*.list

and then update package lists by

sudo apt-get update
N0rbert
  • 99,918
  • 1
    Doing this on Ubuntu 20.04, I got again the exact same error – FabioSpaghetti Dec 19 '22 at 11:03
  • Hit:1 http://de.archive.ubuntu.com/ubuntu jammy InRelease Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB] Ign:3 http://packages.ros.org/ros/ubuntu jammy InRelease
    Err:4 http://packages.ros.org/ros/ubuntu jammy Release 404 Not Found [IP: 64.50.236.52 80] Reading package lists... Done E: The repository 'http://packages.ros.org/ros/ubuntu jammy 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 con..
    – FabioSpaghetti Dec 19 '22 at 11:04
  • The whole error is too long for commenting – FabioSpaghetti Dec 19 '22 at 11:04