Ubuntu 18.04-准备安装 rbenv 时依赖关系中断

Ubuntu 18.04-准备安装 rbenv 时依赖关系中断

我正在尝试安装萊本使用本指南. 为此,需要以下依赖项:

$ sudo apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev

但这是我尝试从终端安装它们时得到的响应:

$ sudo apt install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'libreadline-dev' instead of 'libreadline6-dev'
build-essential is already the newest version (12.4ubuntu1).
libgdbm5 is already the newest version (1.14.1-6).
zlib1g-dev is already the newest version (1:1.2.11.dfsg-0ubuntu2).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libncurses5-dev : Depends: libtinfo5 (= 6.1-1ubuntu1) but 6.1-1ubuntu1.18.04 is to be installed
                   Depends: libncurses5 (= 6.1-1ubuntu1) but 6.1-1ubuntu1.18.04 is to be installed
                   Depends: libtinfo-dev (= 6.1-1ubuntu1) but it is not going to be installed
 libreadline-dev : Depends: libtinfo-dev but it is not going to be installed
 libssl-dev : Depends: libssl1.1 (= 1.1.0g-2ubuntu4) but 1.1.0g-2ubuntu4.1 is to be installed
E: Unable to correct problems, you have held broken packages.

好像我安装了一些损坏的软件包,但我不太确定。我该如何解决这个问题?

答案1

正如@guiverc 指出的那样,我缺少一些来源。

我进入“软件和更新”,在“更新”选项卡下,选中“重要安全更新”和“推荐更新”。 (不知道为什么没有选中它们...)

此后,一切正常。

答案2

您应该能够使用以下命令进行安装,以首先指定您所需的特定版本:

sudo apt update
sudo apt upgrade
sudo apt install --reinstall libncurses5-dev=6.1-1ubuntu1.18.04 libtinfo-dev=6.1-1ubuntu1.18.04 libssl-dev=1.1.0g-2ubuntu4.1 

然后,运行包含重新安装的原始安装命令,并发布任何错误:

sudo apt install --reinstall autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev

答案3

我曾经有过类似问题使用 GRASS 包。下面是我解决这个问题的方法:

  1. 安装aptitude,包安装程序。sudo apt install aptitude
  2. sudo aptitude install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev
  3. 现在 aptitude 应该会询问您是否要安装选项 a、选项 b 等的软件包。您可能希望通过说“否”来检查每个可能的选择,直到到达最后,然后重新运行命令并做出“明智的”选择。

答案4

还有另一个相当难以解决的问题。我的问题是系统时钟比实际日期晚了几天。修复后,我能够安装 libncurses5-dev

检查我的终端输出

# apt-get install libncurses-dev
<snip>
The following packages have unmet dependencies:
 libncurses5-dev : Depends: libtinfo5 (= 6.1-1ubuntu1) but 6.1-1ubuntu1.18.04 is to be installed
                   Depends: libncurses5 (= 6.1-1ubuntu1) but 6.1-1ubuntu1.18.04 is to be installed
                   Depends: libtinfo-dev (= 6.1-1ubuntu1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
# apt-get update
<snip>
Reading package lists... Done
E: Release file for http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease is not valid yet (invalid for another 10d 22h 52min 0s). Updates for this repository will not be applied.
E: Release file for http://us.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease is not valid yet (invalid for another 10d 22h 53min 14s). Updates for this repository will not be applied.
E: Release file for http://us.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease is not valid yet (invalid for another 10d 22h 54min 51s). Updates for this repository will not be applied.
# date
Mon Aug  3 17:03:26 EDT 2020
# apt-get install ntp
# systemctl status ntp
# date
Fri Aug 14 16:26:10 EDT 2020
# apt-get install libncurses-dev
<snip>
The following NEW packages will be installed:
  libc-dev-bin libc6-dev libncurses5-dev libtinfo-dev linux-libc-dev manpages-dev
<snip>
Setting up libncurses5-dev:amd64 (6.1-1ubuntu1.18.04) ...

相关内容