0

I have a .deb package (ruby-2.1.2_amd64.deb) containing a specific version of Ruby I'm trying to install using dpkg, but I'm getting the following error:

$ 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

Based on that message, it sounds like dpkg is refusing to install the package because an older version of Ruby is already on the system. Fair enough, I'll just uninstall the older version then...

$ 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

Woah, that's a mess. But it looks like a totally solvable one. All of those packages seem to be saying they'd be satisfied with any package that provides ruby, and the package I'm trying to install does provide that.

It seems I'm stuck in a catch-22 here though. I can't install the package I want until I first uninstall this old version, and I can't uninstall the old version because the new version isn't already installed.

How do I get around this problem?

I'm running Ubuntu 12.04 LTS, with dpkg 1.16.1.2.

  • First please explain what you are trying to do and why. – Faheem Mitha Feb 11 '16 at 20:10
  • @FaheemMitha I'm trying to install the Debian package located at /tmp/chef-solo/ruby-2.1.2_amd64.deb to my system (was that somehow not clear from the question?), because I need to deploy an application that requires the version of Ruby contained in that package. (The currently installed version, 1.9, will not work.) – Ajedi32 Feb 11 '16 at 20:14
  • No, it was not clear. Are you running Debian, and if so, what version/release? 2.1 is the default on jessie, so if you are running Debian, I assume you are running something older, probably wheezy. Please clarify. If you are running wheezy, you could probably backport ruby 2.1 if it isn't available there, though you'd really be better off using jessie. – Faheem Mitha Feb 11 '16 at 20:28
  • @FaheemMitha I've updated the question with additional system information. (Ubuntu 12.04 LTS, which isn't based on any specific named release of Debian afaik.) Also, this is an enterprise environment where upgrading to a new version of the operating system would be a very much a non-trivial task. – Ajedi32 Feb 11 '16 at 21:01
  • 1
    Well, if you replace the ruby default version, you're probably going to break (at least some) ruby packages in the system. So I would not recommend that. I'm surprised it works in any Ubuntu system. Having said that, if you want to remove ruby 1.9.1, you should use apt. Why are you using dpkg? If you want to force removal ignoring depends, you could use a --force-depends flag to dpkg and then install your new package, but that's risky unless you really know what you are doing. – Faheem Mitha Feb 11 '16 at 22:42
0

Try this: sudo dpkg -r --force-depends ruby1.9.1 Then be sure to install ruby-2.1.2 before installing anything via apt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.