gem install rails on VirtualBox Ubuntu guest on a Windows 7 host times out

Apparently if you have the network interface as NAT (the most standard one) then the gem installer has issues connecting to remote sources. Use a bridged network connection, or download all the gems you need separately for rails, and install each using the gem install GEMNAME –local command in the folder where you download the gems. (I couldn’t get the bridged connection to work either, so I just installed all the gems by downloading each gem separately. Sort of annoying, but once you know how to do it, and what the dependencies are (rails has sort of a lot, but not too bad), it is easy. Use and not

This is weird since other remote gems work fine. The link at the bottom discusses how this might be a bug or something. Very annoying though, getting to the point where you find that it isn’t a linux problem, but a virtualbox and rubygems thing.

To get to the nitty gritty you have to do sudo gem install -V –debug (for verbose debugging).

The first level of error, by using the -V verbose option will show
Error fetching remote data: timed out (on some remote gem), and then eventually the non-verbose error:

ERROR: While executing gem … (Gem::RemoteFetcher::FetchError) timed out (

To get to the root of the problem, you use the –debug flag which will show

Exception `NameError’ at YOURENV/command_manager.rb:161 – uninitialized constant
Exception `Gem::LoadError’ at YOURENV
rubygems.rb:826 – Could not find RubyGem sources (> 0.0.1)
Exception `Errno::ETIMEDOUT’ at YOURENV/net/


Installing newer version of rails on ubuntu 9.10 karmic koala

I had a bunch of weird errors, like actionpack requires a certain version of rack, etc. when trying to use the gem install rails and other such commands.

I found it easier to remove any gems that were old, and then just download each gem dependency from Then I could download each gem, go to that download folder in the command line, and run sudo gem install GEMNAME – -local, and make sure the versions I wanted for everything were correct

ruby extconf.rb install mysql
extconf.rb:1:in `require’: no such file to load — mkmf (LoadError)
from extconf.rb:1

Make sure the package rubyXX-dev is installed. This will stop the mkmf errors.

ruby extconf.rb install mysql
extconf.rb:1:in `require’: no such file to load — mkmf (LoadError)
from extconf.rb:1

When installing the mysql gem in ubuntu make sure you have the following 3 packages installed: build-essential, rubyXX-dev, and libmysqlclientXX-dev, where the XXs correspond to your version numbers.

If you want to read the log, in ubuntu 9.10 with ruby 1.8.7 and rails 2.3.4 it was in /var/lib/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/mkmf.log

Also be aware that 9.10 ubuntu’s default mysql sock appears to be /var/run/mysqld/mysqld.sock

Ruby on Rails and Flex using rubyamf association errors

I’ll have to re-duplicate the exact error message on ruby’s side. From what I recall, this was obscured by a bunch of weird error messages that were deep in the codebase for rubyamf.

Basically, if your rails server barfs a bunch of errors when you try and load activerecord objects from an amf request, one cause of this can be the fact that you have associations setup in your rubyamf_config.rb file, and there are bad or missing foreign keys in the database for linking associated tables.

In the following example ruby barks when an account is loaded. Account has a location_id in the database to a location. If the location record with that id does not exist, ruby does not throw a nice error.

ClassMappings.register(:actionscript => 'Account', :ruby => 'Account', :type => 'active_record',
    :attributes => ["id", "location_id", "verified", "org_id", "login", "password", "email",  "name_title", "name_first","name_middle",
        "name_last","name_suffix","phone","phone_2","phone_3","last_login_at", "created_at", "updated_at", "business", "residential"],  
    <span style="color:#CC6666">:associations => ["locations"]</span>)