Skip to content

Instantly share code, notes, and snippets.

Created January 26, 2013 04:11
Show Gist options
  • Save anonymous/0c44c797e6b034ef01f5 to your computer and use it in GitHub Desktop.
Save anonymous/0c44c797e6b034ef01f5 to your computer and use it in GitHub Desktop.
ubuntu 12.04 with ruby 1.9.3 installed from repos "$ sudo ruby gem install rails" fails after that, apt is broken
puff@redbitter:~$ sudo dpkg -l | fgrep -i ruby
ii libruby1.9.1 1.9.3.0-1ubuntu2.4 Libraries necessary to run Ruby 1.9.1
ii ruby1.9.1 1.9.3.0-1ubuntu2.4 Interpreter of object-oriented scripting language Ruby
puff@redbitter:~$
puff@redbitter:~$ sudo aptitude search rails
p libgettext-rails-ruby - Transitional package for ruby-gettext-rail
p libgettext-rails-ruby-doc - Transitional package for ruby-gettext-rail
p libgettext-rails-ruby1.8 - Transitional package for ruby-gettext-rail
p liblocale-rails-ruby - Transitional package for ruby-locale-rails
p liblocale-rails-ruby1.8 - Transitional package for ruby-locale-rails
p rails - MVC ruby based framework geared for web ap
p rails-doc - Transitional package for rails
p rails-ruby1.8 - Transitional package for rails
p ruby-gettext-rails - Gettext support for Rails >= 2.3
p ruby-locale-rails - Pure ruby library with basic functions for
p ruby-rails-2.3 - MVC ruby based framework geared for web ap
p vim-rails - vim development tools for Rails developmen
p vistrails - Science visualisation workflow toolkit
puff@redbitter:~$
puff@redbitter:~$ ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
puff@redbitter:~$ gem install rails
Fetching: i18n-0.6.1.gem (100%)
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /var/lib/gems
puff@redbitter:~$ sudo gem install rails
[sudo] password for puff:
Fetching: i18n-0.6.1.gem (100%)
Fetching: multi_json-1.5.0.gem (100%)
Fetching: activesupport-3.2.11.gem (100%)
Fetching: builder-3.0.4.gem (100%)
Fetching: activemodel-3.2.11.gem (100%)
Fetching: rack-1.4.4.gem (100%)
Fetching: rack-cache-1.2.gem (100%)
Fetching: rack-test-0.6.2.gem (100%)
Fetching: journey-1.0.4.gem (100%)
Fetching: hike-1.2.1.gem (100%)
Fetching: tilt-1.3.3.gem (100%)
Fetching: sprockets-2.2.2.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: actionpack-3.2.11.gem (100%)
Fetching: arel-3.0.2.gem (100%)
Fetching: tzinfo-0.3.35.gem (100%)
Fetching: activerecord-3.2.11.gem (100%)
Fetching: activeresource-3.2.11.gem (100%)
Fetching: mime-types-1.19.gem (100%)
Fetching: polyglot-0.3.3.gem (100%)
Fetching: treetop-1.4.12.gem (100%)
Fetching: mail-2.4.4.gem (100%)
Fetching: actionmailer-3.2.11.gem (100%)
Fetching: rake-10.0.3.gem (100%)
Fetching: rack-ssl-1.3.2.gem (100%)
Fetching: thor-0.17.0.gem (100%)
Fetching: json-1.7.6.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/json-1.7.6 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/json-1.7.6/ext/json/ext/generator/gem_make.out
puff@redbitter:~$ ruby --version
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
puff@redbitter:~$ sudo aptitude search ruby-1.9.3-dev
puff@redbitter:~$ sudo aptitude search ruby-1.9dev
puff@redbitter:~$ sudo aptitude search ruby-1.9
puff@redbitter:~$ sudo aptitude search ruby | fgrep -i dev
p liberuby-dev - Development files for liberuby
p liberuby-dev:i386 - Development files for liberuby
p libqtruby4shared-dev - internal library for Qt 4 Ruby bindings --
p libqtruby4shared-dev:i386 - internal library for Qt 4 Ruby bindings --
p ruby-dev - Transitional package for ruby1.8-dev
v ruby-dev:i386 -
p ruby-gnome2-dev - GNOME-related bindings for the Ruby langua
p ruby-gnome2-dev:i386 - GNOME-related bindings for the Ruby langua
p ruby-rspec - Behaviour Driven Development framework for
p ruby-rspec-core - Behaviour Driven Development framework for
p ruby-rspec-expectations - Behaviour Driven Development framework for
p ruby-rspec-mocks - Behaviour Driven Development framework for
p ruby-sinatra - Ruby web-development dressed in a DSL
p ruby1.8-dev - Header files for compiling extension modul
p ruby1.8-dev:i386 - Header files for compiling extension modul
p ruby1.9.1-dev - Header files for compiling extension modul
p ruby1.9.1-dev:i386 - Header files for compiling extension modul
puff@redbitter:~$ sudo aptitude install ruby1.9.1-dev
The following NEW packages will be installed:
ruby1.9.1-dev
0 packages upgraded, 1 newly installed, 0 to remove and 143 not upgraded.
Need to get 1,211 kB of archives. After unpacking 4,070 kB will be used.
Get: 1 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main ruby1.9.1-dev amd64 1.9.3.0-1ubuntu2.4 [1,211 kB]
Fetched 1,211 kB in 0s (1,294 kB/s)
debconf: unable to initialize frontend: Dialog
debconf: (Dialog frontend will not work on a dumb terminal, an emacs shell buffer, or without a controlling terminal.)
debconf: falling back to frontend: Readline
dpkg: warning: 'ldconfig' not found in PATH or not executable.
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable.
dpkg: error: 2 expected programs not found in PATH or not executable.
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
E: Sub-process /usr/bin/dpkg returned an error code (2)
A package failed to install. Trying to recover:
dpkg: warning: 'ldconfig' not found in PATH or not executable.
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable.
dpkg: error: 2 expected programs not found in PATH or not executable.
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
puff@redbitter:~$
After this point, trying to install or remove anything with apt gets the same error message.
I finally worked around this by running a root shell, editing PATH to include /sbin, and running the desired apt command.
However, that doesn't fix normal operation.
I didn't do an apt remove or install immediately beforehand, so it's possible this problem happened before I ran ruby gems and is only showing up now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment