2

I'm installing packages via apt-get on a cluster on Databricks on Azure. Every time I spin up the cluster I need to reinstall the packages. (I specify Databricks only because it's relevant to mention that this is not happening on the same physical machine each time – and thus my question about how I can check what could be changing between runs.)

Sometimes a particular package successfully installs; other times it cannot be found.

Questions (Three attempts to get to the same place)

  1. What could be changing between runs that could be causing this, and how can I check them?
  2. What would cause apt-get update to not specify the most recent version?
  3. What would prevent apt-get install from finding the most recent version, when the version is specified?

Context

My initial problem is that I'm trying to install gdal:

sudo apt-get update -y
sudo apt-get install gdal -y
Err:1 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libmysqlclient21 amd64 8.0.28-0ubuntu0.20.04.3
#   404  Not Found [IP: 91.189.91.39 80]
# ...
# Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/libmysqlclient21_8.0.28-0ubuntu0.20.04.3_amd64.deb  404  Not Found [IP: 91.189.91.39 80]

To see what's going on, I tried installing libmysqlclient21 alone and looking at what apt-get is trying to install when it installs libmysqlclient21.

sudo apt-get update

Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists...

sudo apt-get install -y libmysqlclient21

Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  libmysqlclient21
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,292 kB of archives.
After this operation, 7,652 kB of additional disk space will be used.
Ign:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libmysqlclient21 amd64 8.0.28-0ubuntu0.20.04.3
Err:1 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libmysqlclient21 amd64 8.0.28-0ubuntu0.20.04.3
  404  Not Found [IP: 91.189.91.39 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/libmysqlclient21_8.0.28-0ubuntu0.20.04.3_amd64.deb  404  Not Found [IP: 91.189.91.39 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

(Running apt-get update with --fix-missing has not changed the output.)

If the install is going to succeed, the version is 8.0.29-0ubuntu0.20.04.3

apt-cache policy libmysqlclient21

libmysqlclient21:
  Installed: (none)
  Candidate: 8.0.29-0ubuntu0.20.04.3
  Version table:
     8.0.29-0ubuntu0.20.04.3 500
        500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
     8.0.19-0ubuntu5 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

When it fails, it is 8.0.28-0ubuntu0.20.04.3

apt-cache policy libmysqlclient21


libmysqlclient21:
  Installed: (none)
  Candidate: 8.0.28-0ubuntu0.20.04.3
  Version table:
     8.0.28-0ubuntu0.20.04.3 500
        500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
     8.0.19-0ubuntu5 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages

If I go the Ubuntu repository (I think that's what this is?), I find that the 8.0.29 version exists but the 8.0.28 version does not. (security.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/)

Occasionally when I specify to install the 8.0.29 version, even when the candidate version is 8.0.28, the install will succeed but not typically:

sudo apt-get update -y
sudo​ apt-get install -y libmysqlclient21=8.0.29-0ubuntu0.20.04.3
# E: Version '8.0.29-0ubuntu0.20.04.3' for 'libmysqlclient21' was not found

One time, using apt-get clean before updating and installing also worked. I've not been able to recreate this yet.

sudo apt-get clean
sudo apt-get update -y
sudo apt-get install libmysqlclient21

Databricks-specific, of questionable site relevance Finally, I am running this on both an interactive Databricks cluster and on a jobs Databricks cluster. All of the successes have been on the interactive cluster; the jobs cluster has always failed to install the package. I only include this in the off-chance it adds to understanding.

Other SE questions I've read a number of other stackexchange questions on apt-get, including these:

  • inconsistent apt-get update behaviour on official Ubuntu AWS AMI; I feel this may be close to the issue. The particular solution doesn't work for me and I don't know what the equivalent of /var/lib/cloud/instance/boot-finished would be for me.
  • Why apt-get doesn't install the newest software; My issue, though, is not that I'm not getting the newest version, but that I can only inconsistently get the version hosted by Ubuntu
  • apt-get not getting latest version on some servers
  • An answer I can no longer find that says focal-updates and focal-security don't offer the full package, only updates to the package and that I'd need to find the package elsewhere. That said, this doesn't change the fact that I've had inconsistent success. Why would apt-get sometimes know the correct origin, and other times not?

Edit

I do not believe this is a duplicate of Why don't the Ubuntu repositories have the latest versions of software? because the more recent version that I'm specifying is in the ubuntu repository.

Also, I should emphasize that I am not committed to any particular package version. I simply need to install gdal, and its failing because apt-get cannot find libmysqlclient21.

When I go to the ubuntu repository, I see that a version 8.0.29-0ubuntu0.20.04.3 exists, but there is no version 8.0.28-0ubuntu0.20.04.3. I also notice that when the candidate version under apt-cache policy libmysqlclient21 is 8.0.29… it successfully installs, and when it is 8.0.28…, it does not.

4
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – andrew.46
    May 9, 2022 at 20:24
  • I have now found this very similar question, but it has no comments or answers: stackoverflow.com/questions/69767441/…
    – Unrelated
    May 10, 2022 at 20:23
  • Hi There. I am having the same issue and it's becoming a nightmare. Were you able to resolve it and do you have a solution from end to end on this. Thanks
    – 89_Simple
    Nov 12, 2022 at 23:57
  • @89_Simple The selected answer below from user1594889 solved the problem for me. If you need more detail I can look into my actual files tomorrow or Tuesday
    – Unrelated
    Nov 13, 2022 at 23:33

4 Answers 4

1

I had exactly the same issue. Put:

sudo apt-get update -y --fix-missing;
sudo apt-get install -y libmysqlclient21=8.0.29-0ubuntu0.20.04.3;

At the very beggining of my script worked for me.

I use a job cluster, with 10.5 ML runtime, in standard mode.

1
  • Unfortunately I tried this after reading your answer and it doesn't appear to change anything for me
    – Unrelated
    May 10, 2022 at 20:22
1

Coming from the other thread, https://stackoverflow.com/questions/69767441/issues-installing-gdal-bin-libmysqlclient21-dependency-on-20-04-3-databricks, where I had the same problem.

The issue become infrequent and never appeared again. At the time 9.1 LTS came into the mix, whilst also the newer version of libmysqlclient21 had recently appeared. So it felt like an issue to do with the versions available on the runtime vs. what was available in the ubuntu repo's and had been moved (made unavailable, hence the IP not found issues).

We also had a DNS issue that was causing extended timeouts, so that could have played a part and caused errors in the updates and install.

I'd suggest trying to rollback to older runtimes (say 9.1 LTS) and see how you go trying to install the library using (the below), as we continue to have success.

# check
apt-cache policy gdal-bin
apt-cache rdepends gdal-bin

# install
sudo apt-get --fix-missing -y update
sudo apt-get install -y gdal-bin

# check
gdalinfo --version

I'll also try using 10.5 and 10.4 LTS with our same code, and see what happens.

== EDIT == Interestingly, I created 5 jobs (9.1 LTS Job Cluster, 10.4 LTS Job Cluster, 10.4 LTS Compute Cluster, 10.5 Job Cluster, 10.5 Compute Cluster)

All the jobs failed, for the same reason failed to find an update to 8.0.29 and then failed to install libmysqlclient21_8.0.28

sh sudo apt-get --fix-missing -y update
Hit:1 hXttp://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 hXttps://repos.azul.com/zulu/deb stable InRelease
Hit:3 hXttp://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 hXttp://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 hXttp://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists...

Get:36 ...//archive.ubuntu.com/ubuntu focal/universe amd64 libgdal26 amd64 3.0.4+dfsg-1build3 [6,156 kB]

Err:27 ...//security.ubuntu.com/ubuntu focal-updates/main amd64 libmysqlclient21 amd64 8.0.28-0ubuntu0.20.04.3
  404  Not Found [IP: 91.189.91.39 80]
Get:37 ...//archive.ubuntu.com/ubuntu focal/universe amd64 python3-gdal amd64 3.0.4+dfsg-1build3 [527 kB]
Get:38 ...//archive.ubuntu.com/ubuntu focal/universe amd64 gdal-bin amd64 3.0.4+dfsg-1build3 [256 kB]
Get:39 ...//archive.ubuntu.com/ubuntu focal/universe amd64 proj-bin amd64 6.3.1-1 [88.8 kB]
Fetched 27.8 MB in 5s (5,886 kB/s)
E: Failed to fetch hXttp://security.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/libmysqlclient21_8.0.28-0ubuntu0.20.04.3_amd64.deb  404  Not Found [IP: 91.189.91.39 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

This lead to us investigating our own production and found the error has been ocurring since 5th of May, aligning with the release of the security patch:

mysql-8.0 (8.0.29-0ubuntu0.20.04.3) focal-security; urgency=medium

* SECURITY REGRESSION: 8.0.29 breaks existing charm configurations
(LP: #1971565)
- debian/patches/lp1971565.patch: add "name" to the supported global
  options list so existing configurations keep working.

-- Marc Deslauriers <[email protected]>  Wed, 04 May 2022 08:36:15 -0400

You fortunately are not alone now! Although, we are in the same boat without a solution

2
  • I'm sorry you're also affected but so grateful to not be alone!
    – Unrelated
    May 11, 2022 at 4:15
  • 1
    Tried again this morning, still the same issue. Specifically requesting 8.0.29 to install yields: E: Version '8.0.29-0ubuntu0.20.04.3' for 'libmysqlclient21' was not found
    – Rhys Lohf
    May 12, 2022 at 0:06
0

I had success by putting

sudo apt clean && sudo apt update --fix-missing -y && sudo apt install -y libmysqlclient21

before trying to install gdal and it seems to be working now....

Revision from comment:

sudo rm -r /var/lib/apt/lists/* 
sudo apt clean && 
   sudo apt update --fix-missing -y &&
   sudo apt install -y  libmysqlclient21
sudo apt install -y gdal-bin

It seems to be important to run these commands first. Running them later in the process may not succeed.

(This uses apt-get rather than the initially commented apt because apt-get is more oriented towards scripts; however, both work.)

7
  • I've previously tried this, though without the && operator; I'll try it again tomorrow. Glad it worked for you!
    – Unrelated
    May 12, 2022 at 4:14
  • nevermind was working yesterday...failing again today... May 12, 2022 at 17:27
  • ok what about.. sudo rm -r /var/lib/apt/lists/* sudo apt clean && sudo apt update --fix-missing -y && sudo apt install -y libmysqlclient21 sudo apt install -y gdal-bin May 12, 2022 at 18:13
  • I’ll try it out! One of the frustrating things about this is certainly the inconsistency. I also was sure that apt clean had solved my problem … until it didn’t on the next run. I’ll respond with the results from removing the list!
    – Unrelated
    May 13, 2022 at 13:20
  • 1
    doing sudo rm -r /var/lib/apt/lists/* first is the key. This has been working for me consistently.... May 13, 2022 at 15:05
0

I finally had again some issues but I fixed it with that:

wget http://archive.ubuntu.com/ubuntu/pool/main/m/mysql-8.0/libmysqlclient21_8.0.19-0ubuntu5_amd64.deb;
sudo dpkg -i libmysqlclient21_8.0.19-0ubuntu5_amd64.deb;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .