Gems not installing because of "invalid stored block lengths"

daniel's Avatar

daniel

02 Apr, 2011 09:50 PM

I've been struggling the whole day today with this. I got ruby on my machine ('buntu 10.04), got rubyGems, but I cant install a single gem! I am trying to get rails up and running. Directly downloading from the website does not work either. What's going on?

  1. Support Staff 1 Posted by Luis Lavena on 02 Apr, 2011 09:54 PM

    Luis Lavena's Avatar

    Please provide exact output that you're getting, including the output of gem env and the output of the gem installation process with --debug -V options.

    That way we are going to be able to help you better.

  2. 2 Posted by daniel on 03 Apr, 2011 04:55 PM

    daniel's Avatar

    I removed all traces of ruby and rubygems, and started over. Here follows the complete output:

    After a fresh install:

    daniel@daniel-experiment:~$ sudo apt-get install ruby rubygems
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      libreadline-ruby1.9.1 libruby1.9.1 rdoc1.9.1 irb1.9.1 ruby1.9.1
    Use 'apt-get autoremove' to remove them.
    The following extra packages will be installed:
      irb1.8 libreadline-ruby1.8 rdoc1.8 rubygems1.8
    Suggested packages:
      graphviz ruby1.8-dev rubygems-doc
    The following NEW packages will be installed:
      irb1.8 libreadline-ruby1.8 rdoc1.8 ruby rubygems rubygems1.8
    0 upgraded, 6 newly installed, 0 to remove and 385 not upgraded.
    Need to get 2,684B/431kB of archives.
    After this operation, 2,265kB of additional disk space will be used.
    Do you want to continue [Y/n]? Y
    Get:1 http://za.archive.ubuntu.com/ubuntu/ lucid/universe rubygems 1.3.5-1ubuntu2 [2,684B]
    Fetched 2,684B in 0s (14.0kB/s)
    Selecting previously deselected package libreadline-ruby1.8.
    (Reading database ... 125548 files and directories currently installed.)
    Unpacking libreadline-ruby1.8 (from .../libreadline-ruby1.8_1.8.7.249-2_i386.deb) ...
    Selecting previously deselected package irb1.8.
    Unpacking irb1.8 (from .../irb1.8_1.8.7.249-2_all.deb) ...
    Selecting previously deselected package rdoc1.8.
    Unpacking rdoc1.8 (from .../rdoc1.8_1.8.7.249-2_all.deb) ...
    Selecting previously deselected package ruby.
    Unpacking ruby (from .../apt/archives/ruby_4.2_all.deb) ...
    Selecting previously deselected package rubygems1.8.
    Unpacking rubygems1.8 (from .../rubygems1.8_1.3.5-1ubuntu2_all.deb) ...
    Selecting previously deselected package rubygems.
    Unpacking rubygems (from .../rubygems_1.3.5-1ubuntu2_all.deb) ...
    Processing triggers for man-db ...
    Setting up libreadline-ruby1.8 (1.8.7.249-2) ...
    Setting up irb1.8 (1.8.7.249-2) ...
    
    Setting up rdoc1.8 (1.8.7.249-2) ...
    Setting up ruby (4.2) ...
    Setting up rubygems1.8 (1.3.5-1ubuntu2) ...
    
    Setting up rubygems (1.3.5-1ubuntu2) ...
    

    And here is the environment info:

    daniel@daniel-experiment:~$ gem env
    RubyGems Environment:
      - RUBYGEMS VERSION: 1.7.1
      - RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
      - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
      - RUBY EXECUTABLE: /usr/bin/ruby1.8
      - EXECUTABLE DIRECTORY: /usr/bin
      - RUBYGEMS PLATFORMS:
        - ruby
        - x86-linux
      - GEM PATHS:
         - /usr/lib/ruby/gems/1.8
         - /home/daniel/.gem/ruby/1.8
      - GEM CONFIGURATION:
         - :update_sources => true
         - :verbose => true
         - :benchmark => false
         - :backtrace => false
         - :bulk_threshold => 1000
      - REMOTE SOURCES:
         - http://rubygems.org/
    

    The error I get:

    daniel@daniel-experiment:~$ sudo gem install rails
    ERROR:  While executing gem ... (Zlib::DataError)
        invalid code lengths set
    

    And the verbose debug output of said error:

    daniel@daniel-experiment:~$ sudo gem install rails --debug -V
    Exception `NameError' at /usr/local/lib/site_ruby/1.8/rubygems/command_manager.rb:163 - uninitialized constant Gem::Commands::InstallCommand
    Exception `LoadError' at /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36 - no such file to load -- psych
    Exception `LoadError' at /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:60 - no such file to load -- psych
    Exception `Gem::LoadError' at /usr/local/lib/site_ruby/1.8/rubygems.rb:925 - Could not find RubyGem sources (> 0.0.1)
    
    GET http://rubygems.org/latest_specs.4.8.gz
    302 Found
    GET http://production.s3.rubygems.org/latest_specs.4.8.gz
    200 OK
    GET http://rubygems.org/specs.4.8.gz
    Exception `EOFError' at /usr/lib/ruby/1.8/net/protocol.rb:135 - end of file reached
    Exception `EOFError' at /usr/lib/ruby/1.8/net/protocol.rb:120 - end of file reached
    Exception `EOFError' at /usr/lib/ruby/1.8/net/http.rb:1061 - end of file reached
    connection reset after 2 requests, retrying
    GET http://rubygems.org/specs.4.8.gz
    302 Found
    GET http://production.s3.rubygems.org/specs.4.8.gz
    Exception `EOFError' at /usr/lib/ruby/1.8/net/protocol.rb:135 - end of file reached
    Exception `EOFError' at /usr/lib/ruby/1.8/net/protocol.rb:120 - end of file reached
    Exception `EOFError' at /usr/lib/ruby/1.8/net/http.rb:1061 - end of file reached
    connection reset after 2 requests, retrying
    GET http://production.s3.rubygems.org/specs.4.8.gz
    200 OK
    Installing gem railties-3.0.5
    Exception `Zlib::DataError' at /usr/local/lib/site_ruby/1.8/rubygems/package/tar_input.rb:220 - invalid code lengths set
    Exception `Zlib::DataError' at /usr/local/lib/site_ruby/1.8/rubygems/package/tar_input.rb:223 - invalid code lengths set
    Exception `IOError' at /usr/local/lib/site_ruby/1.8/rubygems/package/tar_input.rb:24 - closed stream
    ERROR:  While executing gem ... (Zlib::DataError)
        invalid code lengths set
        /usr/local/lib/site_ruby/1.8/rubygems/package/tar_input.rb:223:in `finish'
        /usr/local/lib/site_ruby/1.8/rubygems/package/tar_input.rb:223:in `zipped_stream'
        /usr/local/lib/site_ruby/1.8/rubygems/package/tar_input.rb:130:in `each'
        /usr/local/lib/site_ruby/1.8/rubygems/package/tar_reader.rb:64:in `each'
        /usr/local/lib/site_ruby/1.8/rubygems/package/tar_reader.rb:55:in `loop'
        /usr/local/lib/site_ruby/1.8/rubygems/package/tar_reader.rb:55:in `each'
        /usr/local/lib/site_ruby/1.8/rubygems/package/tar_input.rb:128:in `each'
        /usr/local/lib/site_ruby/1.8/rubygems/format.rb:66:in `from_io'
        /usr/local/lib/site_ruby/1.8/rubygems/package/tar_input.rb:22:in `open'
        /usr/local/lib/site_ruby/1.8/rubygems/package.rb:68:in `open'
        /usr/local/lib/site_ruby/1.8/rubygems/format.rb:62:in `from_io'
        /usr/local/lib/site_ruby/1.8/rubygems/format.rb:46:in `from_file_by_path'
        /usr/local/lib/site_ruby/1.8/rubygems/format.rb:45:in `open'
        /usr/local/lib/site_ruby/1.8/rubygems/format.rb:45:in `from_file_by_path'
        /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:413:in `load_gem_file'
        /usr/local/lib/site_ruby/1.8/rubygems/installer.rb:103:in `initialize'
        /usr/local/lib/site_ruby/1.8/rubygems/dependency_installer.rb:286:in `new'
        /usr/local/lib/site_ruby/1.8/rubygems/dependency_installer.rb:286:in `install'
        /usr/local/lib/site_ruby/1.8/rubygems/dependency_installer.rb:270:in `each'
        /usr/local/lib/site_ruby/1.8/rubygems/dependency_installer.rb:270:in `install'
        /usr/local/lib/site_ruby/1.8/rubygems/commands/install_command.rb:120:in `execute'
        /usr/local/lib/site_ruby/1.8/rubygems/commands/install_command.rb:115:in `each'
        /usr/local/lib/site_ruby/1.8/rubygems/commands/install_command.rb:115:in `execute'
        /usr/local/lib/site_ruby/1.8/rubygems/command.rb:278:in `invoke'
        /usr/local/lib/site_ruby/1.8/rubygems/command_manager.rb:133:in `process_args'
        /usr/local/lib/site_ruby/1.8/rubygems/command_manager.rb:103:in `run'
        /usr/local/lib/site_ruby/1.8/rubygems/gem_runner.rb:64:in `run'
        /usr/bin/gem:21
    

    I hope this tells you what the problem is. I already tried downloading from the website, but that did not work either. Another user had a similar problem.

  3. Support Staff 3 Posted by Eric Hodel on 05 Apr, 2011 08:31 PM

    Eric Hodel's Avatar
    ...
    Setting up rubygems (1.3.5-1ubuntu2) …
    

    Followed by:

      - RUBYGEMS VERSION: 1.7.1
    

    So you're not using RubyGems 1.3.5.

    If you're getting zlib data errors you have a problem with your network or a broken install of ruby.

  4. Support Staff 4 Posted by Luis Lavena on 23 May, 2011 09:44 PM

    Luis Lavena's Avatar

    Hello getack,

    We haven't heard back from you on this issue.

    Please let us know if you still have problems with this and none of previous comments help you.

    Going to close this in the upcoming days if there is no feedback.

    Thank you.

  5. 5 Posted by daniel on 24 May, 2011 06:26 AM

    daniel's Avatar

    Hello

    Sorry for being so quiet lately. I've been crazy busy.

    No I have not managed to get it running using the method above.
    At the end I had to compile RVM from scratch, and use that to compile and install ruby and gems.

    Somewhere along the package stream there was a broken package, and it messed up everything downstream. The fact that I compiled most of it on my machine at the end, fixed it.

    Thanks! :-)

  6. Nick Quaranto closed this discussion on 27 May, 2011 12:20 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

28 Oct, 2014 09:51 AM
23 Oct, 2014 05:37 PM
21 Oct, 2014 10:47 AM
18 Oct, 2014 08:39 PM
16 Oct, 2014 12:41 PM