Friday, July 16, 2010

RMagicK, SQLite3, MySQL - Gem setup on Ubuntu 9.10 Karmic

Recently I needed to setup what I think are common gems, for many Ruby on Rails, users on the Ubuntu 9.10 VM I use for development.  I thought I'd document these in one place since I had to go to several places to find the information I needed.

MySQL
sudo apt-get install libmysqlclient-dev 
sudo gem install mysql --no-ri --no-rdoc

SQLite3
sudo apt-get install libsqlite3-dev 
sudo gem install sqlite3-ruby --no-ri --no-rdoc


RMagicK
sudo apt-get install imagemagick
sudo apt-get install libmagick9-dev
sudo gem install rmagick --no-ri --no-rdoc

References
http://www.jsiegel.com
http://superuser.com
http://dev.honewatson.com

Thursday, July 15, 2010

SIOCSIFADDR : Parallels VM Clone : Ubuntu 9.10 Karmic

I just recently set up a development environment for Rails on Ubuntu 9.10 so that I could move towards using Apache and Passenger which would more closely resemble my production environment.  After installing Ubuntu on a VM under Parallels Workstation 2.2 build 2222 I decided to clone that VM before configuring Apache and Passenger to match my production environment.  That's when I ran into a little snag.  After creating the clone of the fresh Ubuntu install I noticed that I didn't have a network connection.  Unfortunately everything seemed fine until I tried to install the Rails gem and it complained.



Upon further investigation I noticed that the network interface was down.  I tried running:

"sudo /etc/init.d/networking restart"



This displayed the error "SIOCSIFADDR: No such device" referencing eth0.


(This of course means no network connection which in turns makes it bit more challenging to install the gems needed for my Rails applications.)  In any event, I was able to locate several posts (see a couple references below)  that ultimately lead me to a solution.  It turns out that the clone has a new MAC address (as it should) and Ubuntu (or at least some part of it) was keeping track of what MAC address belongs to each interface. When I first had this problem I tried running "ifconfig" to see what was going on.  The only thing showing was the loopback connection. 



One of the posts I read suggested running "ifconfig -a" which actually shows all interfaces (up or down) and this tipped me towards the real problem.


   NOTE: I'll be using the -a forever now.  No point in seeing just half the picture.

These posts also suggested that a file located in the folder /etc/udev/rules.d contains the persistence rules for the network interface.  In my case that file was a file named "70-persistent-net.rules".   I removed that file, restarted the VM, and the problem was solved!  That file was re-created with the correct MAC address for eth0.  I suppose you could manually edit the file to contain the correct MAC address for eth0 and remove the eth1 entry but I didn't try it since the file is automatically created. 

I hope this helps someone!



REFERENCES
http://ubuntuforums.org
http://www.amazium.com/blog