无法安装更新的 Ruby deb 包:ruby1.9.1 与 ruby​​ 冲突

无法安装更新的 Ruby deb 包:ruby1.9.1 与 ruby​​ 冲突

我有一个包含特定版本 Ruby 的.deb包 ( ruby-2.1.2_amd64.deb),我尝试使用 来安装dpkg,但出现以下错误:

$ sudo dpkg -i /tmp/chef-solo/ruby-2.1.2_amd64.deb
dpkg: regarding .../chef-solo/ruby-2.1.2_amd64.deb containing ruby:
 ruby1.9.1 conflicts with ruby (<= 4.5)
  ruby (version 2.1.2) is to be installed.
dpkg: error processing /tmp/chef-solo/ruby-2.1.2_amd64.deb (--install):
 conflicting packages - not installing ruby
Errors were encountered while processing:
 /tmp/chef-solo/ruby-2.1.2_amd64.deb

根据该消息,听起来 dpkg 拒绝安装该软件包,因为系统上已经存在旧版本的 Ruby。好吧,我会卸载旧版本然后......

$ sudo dpkg -r ruby1.9.1
dpkg: dependency problems prevent removal of ruby1.9.1:
 libaugeas-ruby1.9.1 depends on ruby1.9.1.
 facter depends on ruby | ruby-interpreter; however:
  Package ruby is not installed.
  Package ruby1.8 which provides ruby is not installed.
  Package ruby-interpreter is not installed.
  Package ruby1.8 which provides ruby-interpreter is not installed.
  Package ruby1.9.1 which provides ruby-interpreter is to be removed.
 puppet-common depends on ruby | ruby-interpreter; however:
  Package ruby is not installed.
  Package ruby1.8 which provides ruby is not installed.
  Package ruby-interpreter is not installed.
  Package ruby1.8 which provides ruby-interpreter is not installed.
  Package ruby1.9.1 which provides ruby-interpreter is to be removed.
 ruby-json depends on ruby | ruby-interpreter; however:
  Package ruby is not installed.
  Package ruby1.8 which provides ruby is not installed.
  Package ruby-interpreter is not installed.
  Package ruby1.8 which provides ruby-interpreter is not installed.
  Package ruby1.9.1 which provides ruby-interpreter is to be removed.
 puppet depends on ruby | ruby-interpreter; however:
  Package ruby is not installed.
  Package ruby1.8 which provides ruby is not installed.
  Package ruby-interpreter is not installed.
  Package ruby1.8 which provides ruby-interpreter is not installed.
  Package ruby1.9.1 which provides ruby-interpreter is to be removed.
 hiera depends on ruby | ruby-interpreter; however:
  Package ruby is not installed.
  Package ruby1.8 which provides ruby is not installed.
  Package ruby-interpreter is not installed.
  Package ruby1.8 which provides ruby-interpreter is not installed.
  Package ruby1.9.1 which provides ruby-interpreter is to be removed.
dpkg: error processing ruby1.9.1 (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 ruby1.9.1

哇哦,真是一团糟。但这看起来是完全可以解决的。所有这些软件包似乎都在说,他们会对任何提供的软件包感到满意ruby,而我尝试安装的软件包确实提供了这一点。

不过,我似乎陷入了第 22 条军规。在我第一次卸载这个旧版本之前,我无法安装我想要的软件包,并且我无法卸载旧版本,因为新版本尚未安装。

我该如何解决这个问题?

我正在运行 Ubuntu 12.04 LTS,带有 dpkg 1.16.1.2。

答案1

试试这个: sudo dpkg -r --force-depends ruby1.9.1 然后确保在通过 apt 安装任何东西之前安装 ruby​​-2.1.2。

相关内容