尝试在 Ubuntu 20.04 上安装 libcurl4-openssl-dev 时出现错误

尝试在 Ubuntu 20.04 上安装 libcurl4-openssl-dev 时出现错误

我目前正在尝试在 Databricks 上运行一些 R 代码。一些 R 包要求我安装 libcurl4-openssl-dev。我在尝试安装 libcurl4-openssl-dev 时收到以下错误:

Ign:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 libcurl4-openssl-dev amd64 7.68.0-1ubuntu2.15
Err:1 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libcurl4-openssl-dev amd64 7.68.0-1ubuntu2.15
  404  Not Found [IP: 185.125.190.39 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/curl/libcurl4-openssl-dev_7.68.0-1ubuntu2.15_amd64.deb  404  Not Found [IP: 185.125.190.39 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

我之前尝试过apt-get update安装软件包,但没有帮助。问题似乎是它试图寻找 7.68.0-1ubuntu2.15而最新版本似乎是 7.68.0-1ubuntu2.16

在再次尝试安装之前,我也尝试运行以下命令:

sudo apt --fix-missing update

sudo apt update

sudo apt install -f

也没有帮助。任何关于如何安装 libcurl4-openssl-dev 的建议都将非常有帮助。谢谢!

编辑: sudo apt update输出如下

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Hit:1 https://repos.azul.com/zulu/deb stable InRelease
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists...
Building dependency tree...
Reading state information...
All packages are up to date.

apt-cache policy libcurl4-openssl-dev输出如下

libcurl4-openssl-dev:
  Installed: (none)
  Candidate: 7.68.0-1ubuntu2.15
  Version table:
     7.68.0-1ubuntu2.15 500
        500 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
     7.68.0-1ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages`

不确定软件包的安装顺序是否重要,但我想无论如何还是要在这里提一下。以下是我正在尝试的:

apt-get update

apt-get install -y make libnode-dev libgdal-dev gdal-bin libgeos-dev libproj-dev libsqlite3-dev libpng-dev libudunits2-dev libicu-dev

sudo apt --fix-missing update

sudo apt update

sudo apt install -f

apt-get install -y libssl-dev libcurl4-openssl-dev pandoc

如果我尝试apt install libcurl4-openssl-dev上述操作,我会得到以下结果,但现在已经过去了 15 分钟,命令还没有运行完成。不确定这是否应该花这么多时间。当我发布此更新时,它仍在运行。

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Reading package lists...
Building dependency tree...
Reading state information...
Suggested packages:
  libcurl4-doc libidn11-dev libkrb5-dev libldap2-dev librtmp-dev
The following packages will be REMOVED:
  libcurl4-gnutls-dev
The following NEW packages will be installed:
  libcurl4-openssl-dev
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Need to get 322 kB of archives.
After this operation, 13.3 kB of additional disk space will be used.

解决方案 下面的方法似乎有效,但我并不完全确定为什么。我对 Linux 还很陌生,所以我对此不太了解。我想在这里提到它,以便它可以帮助其他人。如果这里有人可以解释为什么会发生这种情况,那就太好了!

以下是输出sudo apt-get update

Hit:1 https://repos.azul.com/zulu/deb stable InRelease
Hit:2 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists...

现在,这是结果 sudo add-apt-repository 'deb http://mirrors.kernel.org/ubuntu focal-updates main'

sudo apt-get update

Hit:2 https://repos.azul.com/zulu/deb stable InRelease
Hit:3 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease
Get:1 http://mirrors.edge.kernel.org/ubuntu focal-updates InRelease [114 kB]
Hit:5 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:6 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Get:7 http://mirrors.edge.kernel.org/ubuntu focal-updates/main amd64 Packages [3,014 kB]
Fetched 3,128 kB in 2s (1,690 kB/s)
Reading package lists...
Hit:2 https://repos.azul.com/zulu/deb stable InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:1 http://mirrors.edge.kernel.org/ubuntu focal-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease
Reading package lists...

当我在添加存储库后尝试安装 libcurl4-openssl-dev 时,我可以毫无问题地安装它。如果我尝试在不添加存储库的情况下执行此操作,则会收到错误。我很高兴找到了解决方案,但很想知道为什么我需要这样做。为什么它不从一开始就搜索“focal-updates main”?每次我需要安装软件包时,我都应该这样做吗?

相关内容