I don't have a reliable way to reproduce this issue, but it happens often enough for me.
I saw this issue multiple times on both Ubuntu 20 and Ubuntu 22
Sometimes, when I spin up a new instance on cloud, and run apt-get update
, the command succeeds with all Hit but no Get in output. However, when I run apt-get install
, it will fail with 404. The issue usually gets fixed by itself after 30 mins to 1 hour.
And I found a workaround that if I do
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
sudo apt-get update
sudo mv /etc/apt/sources.list.bak /etc/apt/sources.list
sudo apt-get update
the last apt-get update will pull the latest package information and apt-get install
will work.
Why does this happen?
*edit: it's nothing about repository or mirror, it's apt update
doesn't actually pull latest information unless I make some change to the /etc/apt/sources.list
file first. See the output below, the first apt-get update
just did nothing
root@0815-165022-e6ssl3ar-10-68-168-233:/databricks/driver# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
root@0815-165022-e6ssl3ar-10-68-168-233:/databricks/driver# apt-get update
Hit:1 https://repos.azul.com/zulu/deb stable InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports jammy InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease
Reading package lists... Done
W: https://repos.azul.com/zulu/deb/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
root@0815-165022-e6ssl3ar-10-68-168-233:/databricks/driver# apt list | grep 7.81.0-1ubuntu1.13
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
root@0815-165022-e6ssl3ar-10-68-168-233:/databricks/driver# mv /etc/apt/sources.list /etc/apt/sources.list.bak
root@0815-165022-e6ssl3ar-10-68-168-233:/databricks/driver# apt-get update
Hit:1 https://repos.azul.com/zulu/deb stable InRelease
Reading package lists... Done
W: https://repos.azul.com/zulu/deb/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
root@0815-165022-e6ssl3ar-10-68-168-233:/databricks/driver# mv /etc/apt/sources.list.bak /etc/apt/sources.list
root@0815-165022-e6ssl3ar-10-68-168-233:/databricks/driver# apt-get update
Hit:1 https://repos.azul.com/zulu/deb stable InRelease
Get:2 http://ports.ubuntu.com/ubuntu-ports jammy InRelease [270 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports jammy-updates InRelease [119 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports jammy-backports InRelease [109 kB]
Get:5 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease [110 kB]
Get:6 http://ports.ubuntu.com/ubuntu-ports jammy/universe arm64 Packages [17.2 MB]
Get:7 http://ports.ubuntu.com/ubuntu-ports jammy/restricted arm64 Packages [24.2 kB]
Get:8 http://ports.ubuntu.com/ubuntu-ports jammy/main arm64 Packages [1758 kB]
Get:9 http://ports.ubuntu.com/ubuntu-ports jammy/multiverse arm64 Packages [224 kB]
Get:10 http://ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 Packages [1121 kB]
Get:11 http://ports.ubuntu.com/ubuntu-ports jammy-updates/multiverse arm64 Packages [27.8 kB]
Get:12 http://ports.ubuntu.com/ubuntu-ports jammy-updates/main arm64 Packages [1014 kB]
Get:13 http://ports.ubuntu.com/ubuntu-ports jammy-updates/restricted arm64 Packages [556 kB]
Get:14 http://ports.ubuntu.com/ubuntu-ports jammy-backports/universe arm64 Packages [23.7 kB]
Get:15 http://ports.ubuntu.com/ubuntu-ports jammy-backports/main arm64 Packages [48.8 kB]
Get:16 http://ports.ubuntu.com/ubuntu-ports jammy-security/main arm64 Packages [745 kB]
Get:17 http://ports.ubuntu.com/ubuntu-ports jammy-security/restricted arm64 Packages [548 kB]
Get:18 http://ports.ubuntu.com/ubuntu-ports jammy-security/universe arm64 Packages [866 kB]
Get:19 http://ports.ubuntu.com/ubuntu-ports jammy-security/multiverse arm64 Packages [23.4 kB]
Fetched 24.8 MB in 9s (2875 kB/s)
Reading package lists... Done
W: https://repos.azul.com/zulu/deb/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
root@0815-165022-e6ssl3ar-10-68-168-233:/databricks/driver# apt list | grep 7.81.0-1ubuntu1.13
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
curl/jammy-updates,jammy-security 7.81.0-1ubuntu1.13 arm64 [upgradable from: 7.81.0-1ubuntu1.11]
libcurl3-gnutls/jammy-updates,jammy-security 7.81.0-1ubuntu1.13 arm64 [upgradable from: 7.81.0-1ubuntu1.11]
libcurl3-nss/jammy-updates,jammy-security 7.81.0-1ubuntu1.13 arm64
libcurl4-doc/jammy-updates,jammy-security 7.81.0-1ubuntu1.13 all
libcurl4-gnutls-dev/jammy-updates,jammy-security 7.81.0-1ubuntu1.13 arm64 [upgradable from: 7.81.0-1ubuntu1.11]
libcurl4-nss-dev/jammy-updates,jammy-security 7.81.0-1ubuntu1.13 arm64
libcurl4-openssl-dev/jammy-updates,jammy-security 7.81.0-1ubuntu1.13 arm64
libcurl4/jammy-updates,jammy-security 7.81.0-1ubuntu1.13 arm64 [upgradable from: 7.81.0-1ubuntu1.11]
root@0815-165022-e6ssl3ar-10-68-168-233:/databricks/driver#
**edit: it's nothing to do with the deprecation warning, I am complaining apt-get update
didn't pull latest information (I ran apt-get list
to check desired version)! Please check the output I pasted in first edit! Ubuntu Version, release information is there and I ran apt-get update
twice, the 1st try didn't work (apt-get list
cannot find the latest version of curl), there is only HIT but no GET. I moved and restored /etc/apt/sources.list
so that 2nd apt-get update
could somehow work (apt-get list
can find the latest version of curl).