Installing ruby-sqlite3 on Red Hat or CentOS Linux

For my development environment, I like to SQLite3 on Red Hat Enterprise Linux (RHEL / CentOS.)  When working with the gem installer for the sqlite-ruby package I kept getting an error on my newest machine.  I searched online and found no answers anywhere while finding many people having this save problem.  I have found a solution.  There is no need to compile Ruby again from source.

The command used was:

gem install sqlite3-ruby

What I found was the following error:

gem install sqlite3-ruby
Building native extensions.  This could take a while…
ERROR:  Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb install sqlite3-ruby
checking for fdatasync() in -lrt… no
checking for sqlite3.h… no

make
make: *** No rule to make target `ruby.h’, needed by `sqlite3_api_wrap.o’.  Stop.

Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out

There are two main causes of this problem.  The first is that the correct dev packages are not installed.  Be sure that you install the correct packages for Red Hat.  In RHEL 5, which I use, SQLite3 is now simply SQLite.

yum install ruby-devel sqlite sqlite-devel ruby-rdoc

If you are still receiving the error then you most likely do not have a C compiler installed.  The Gem system needs make and the GCC.  So install those as well.  (Obviously you could combine these two steps.)

yum install make gcc

Voila, you SQLite / SQLite3 installation on Red Hat (RHEL), Fedora, or CentOS Linux should be working fine.  Now your “rake db:migrate” should be working.

Update: If you follow these direction and get the error that sqlite3-ruby requires Ruby version > 1.8.5 then you can go to my follow-up directions on
SQLite3-Ruby Gem Version Issues on Red Hat Linux and CentOS

November 22, 2008: No Baby Yet

40 Weeks and One Day Pregnant

As of this morning we are officially past the due date.  Dominica is definitely ready for this baby to arrive.  She had a really good pregnancy without ever getting sick and not being very uncomfortable but now she is rather uncomfortable and ready for it to be over.

I worked from a quarter till eight until nine thirty.  Not what I really wanted to do after a really long day of work yesterday.  As soon as I was done with work for the office Dad and I had to run to Enterprise in Cortlandt Manor to pick up the cargo van that Dominica had reserved yesterday.

We got to Enterprise right at ten.  We did the paperwork but the van had been dropped off at a different location and so someone had to drive us a few towns over to get it.  The other location was almost ten miles away, which takes much longer in Westchester than you would think that it would, so we had about twenty or thirty minutes of drive time to go pick up the van.  At least the other location was only barely farther away from the Toys ‘R’ Us than was the first one so it didn’t cost us anything but the extra drive time.

We picked up the crib and headed back to the house, dropped off the crib and ran back to Enterprise to drop off the van.  After tax and insurance (we needed extra as it was a commercial van) the van was still cheaper than having the furniture delivered.  The gas in the van was actually free since the distance was too short to measure from the fuel gauge.

On the way home we picked up lunch from Burger King and brought it home for Dominica (meatless Whoppers.)  By the time that we were done eating it was already one in the afternoon.

This afternoon I needed to take a Microsoft training class, “Implementing, Managing and Deploying Applications in Windows Server 2003”, so I buckled down and went through that while no one from the office needed me for anything else.  That took about an hour or so.

It was a really busy day for all of us.  Dad assembled the crib up in the nursery.  It is very large but it looks great in there.  It completely matched the table that has been put there as the changing table that used to be our hall table when we lived at Eleven80.  Now that we have that assembled we are pretty sure that we are actually ready for the baby to arrive.  Our “big task” for tomorrow is to attempt to figure out how to put the child seat into the car.  We can’t bring the baby home until we have the car seat in place.

Once we were all exhausted and couldn’t keep working anymore I put a log in the fireplace (we use the fake logs that burn clean) and we relaxed in the living room for about an hour.  Then dad and I made dinner, just simple stuff that we had in the kitchen like a frozen pot pie for him and Annie’s P’shetti and vegetarian meatballs for Dominica and I, and put on several episodes of Mary Tyler Moore before going to bed before ten.

Tomorrow we have nothing scheduled so, most likely, we will just be staying home and relaxing.

November 21, 2008: It’s Baby Due Day

Nine months.  Forty weeks.  Well, we’ve made it to this point.  The baby is now officially “due”.

Dominica and I slept in until nine this morning.  I really needed that after working so hard yesterday.  I sat starring at the computer screens for almost every moment of the day yesterday.  It was rather brutal.

Dominica made me eggs and toast for breakfast this morning.  This time of year is very busy for me at work because the financial industry has a “freeze” that occurs during most of the month of December going into January in which no real work can be done.  So that makes November a very important time to get a lot of stuff done.

The big news today around here is the price of Citi stock.  Everyone was in shock when it dipped below $6 per share yesterday but this morning we found that it had already fallen into the mid $3 range!  The stock was worth only about 10% of its value from one year ago.  Obviously there is a certain amount of panic going on when it gets this low.  Luckily, we are diversified, but a lot of people that I know are heavily invested in Citi stock and this has all but wiped them out.

My work day was incredibly long.  We had mostly anticipated that it would be but that doesn’t make it any easier.  I worked all day long from the moment that I got up until it was time for bed.  I ate breakfast and lunch while sitting at my desk.  No time to relax at all.

Our new chest of drawers for our bedroom arrived today.  Unfortunately it has a pretty serious crack in the bottom of the frame and has to be swapped out for a new one.  We have another one being delivered on Tuesday.  We had been hoping that we were going to be able to put all of our clothes and stuff into the dresser so that we could get our bedroom floor cleaned up but that will have to wait several more days.

Dad and Dominica were very busy today as well.  The nursery is completely ready now for the baby except for the crib.  They managed to assemble the glider as well and that is now moved into our bedroom although there isn’t any room for it yet because we can’t put our clothes, which are all over the floor, into the dresser since the dresser has to be swapped out yet.

I ended up working until about ten thirty at night.  It was just a completely insane day.  By the end of the day I was completely exhausted.  It was a really good thing that the baby decided not to come today as it would have been really rough on the guys left in the office to try to pick up that much extra slack.

Off to bed the moment that I am done working.  Have to be up around seven thirty tomorrow as I have an eight o’clock deployment tomorrow and that has to be completed as quickly as possible.  We have the cargo van from Enterprise reserved from nine to noon and we have to get it as early as we can so that we can get to Toys ‘R’ Us, pick up the giant crib, get it back to Peekskill and then drop off the van.  It is a lot of work but it is a lot cheaper than having the crib shipped in the first place and this is not an economy in which to be throwing money away unnecessarily.  Especially for those of us who work in banking and finance!

High IOWait on VMWare Server on Linux

In using VMWare Server running on Red Hat Enterprise Linux 5 (CentOS 5) I discovered a rather difficult problem.  My setup includes Red Hat Linux 5.2, Solaris 10 and Windows Server 2003 guests running on a Red Hat 5.2 host server all 64bit except for Windows running on AMD Opteron multicore processors on an HP Proliant DL145 G3.

The issue that I found was that the Windows guest was exhibiting serious performance issues.  The box would freeze regularly, networking would stop although pings continued but remote desktop (RDP) would be interrupted.  In the logs I consistently found symmpi errors in the System Event Log:

The device, \Device\Scsi\symmpi1, did not respond within the timeout period.

Because the issues were only exhibiting on Windows and not on Linux or Solaris guests I was convinced that the issue was Windows related.  I could see that the Linux host operating system was showing massive IOWait states (you can see this in top or with the iostat command from the sysstat package.)  I assumed that this was being caused by the Windows guest; it was not.

I turned off all three guest operating systems and noticed almost no drop in the IOWait levels, however if I turned of the VMWare Server process (/etc/init.d/vmware stop) the IOWait would drop almost instantly and return again as soon as I restart the process even without starting any virtual machine images.  Clearly the issue was with VMWare Server itself.

My first thought was to make sure that VMWare Server was up to date.  I have been running VMWare Server 1.0.7 and so downloaded and updated the very recent 1.0.8 update just to be sure that this issue was not addressed in that package.  It was not.  I am aware that the 2.0 series is available now but as this box is used a bit I am not interested yet in moving to the new series unless absolutely necessary.

Once I narrowed down that the issue was a problem with VMWare Server on Linux I was able to track down a solution.  Special thanks to Mr. Pointy for publishing the solution to this for Gutsy Gibson.  Red Hat and Ubuntu are sharing a problem in this case.

The issue is with memory configuration defaults with VMWare Server on this platform.  Very likely this will apply to Novell SUSE Linux, OpenSUSE, Fedora and others, but I have not tested it.  In the main VMWare Server configuration file (/etc/vmware/config) the following changes should be added:

prefvmx.useRecommendedLockedMemSize = “TRUE”
prefvmx.minVmMemPct = “100″

Then, in each of the individual virtual machine configuration files (*.vmx) you need to add:

sched.mem.pshare.enable = “FALSE”
mainMem.useNamedFile = “FALSE”
MemTrimRate = “0″
MemAllowAutoScaleDown = “FALSE”

These changes are taken directly from Mr. Pointy’s blog.  Once the changes are made you can restart VMWare Server (/etc/init.d/vmware restart) and the difference should be immediately visible.  Mr. Pointy posted his own sar results and here are mine.  You can clearly see the change in the %iowait column at 10:10pm when I restarted VMWare with the new configuration.  The numbers are low around 7:00pm because I had VMWare off much of that hour.

06:40:01 PM       CPU     %user     %nice   %system   %iowait    %steal     %idle
06:50:01 PM       all      0.16      0.00      1.77     43.15      0.00     54.92
07:00:01 PM       all      2.83      0.00      6.83      9.51      0.00     80.82
07:10:01 PM       all      0.10      0.00      1.38      4.93      0.00     93.59
07:20:01 PM       all      0.11      0.20      1.84     14.78      0.00     83.07
07:30:01 PM       all      0.10      0.00      2.08      8.84      0.00     88.98
07:40:02 PM       all      0.11      0.00      2.36     26.84      0.00     70.70
07:50:01 PM       all      0.11      0.00      2.32     28.54      0.00     69.04
08:00:01 PM       all      0.10      0.00      2.13     30.63      0.00     67.14
08:10:01 PM       all      0.10      0.00      2.06     22.74      0.00     75.10
08:20:01 PM       all      0.09      0.20      2.02     22.75      0.00     74.94
08:30:04 PM       all      0.09      0.00      2.21     23.22      0.00     74.48
08:40:01 PM       all      0.09      0.00      3.03     25.06      0.00     71.81
08:50:01 PM       all      0.09      0.00      3.09     27.21      0.00     69.61
09:00:01 PM       all      0.10      0.00      3.13     29.40      0.00     67.37
09:10:01 PM       all      0.09      0.00      3.11     25.56      0.00     71.23
09:20:01 PM       all      0.09      0.19      3.07     23.79      0.00     72.86
09:30:01 PM       all      0.09      0.00      2.98     21.50      0.00     75.43
09:40:01 PM       all      0.10      0.00      2.97     25.94      0.00     70.99
09:50:01 PM       all      0.10      0.00      3.28     32.70      0.00     63.93
10:00:01 PM       all      0.20      0.00      4.96     40.73      0.00     54.11
10:10:01 PM       all      0.69      0.00      8.57      1.23      0.00     89.50
10:20:01 PM       all      0.88      0.21      6.34      0.67      0.00     91.90
10:30:01 PM       all      0.81      0.00      6.04      0.26      0.00     92.89
10:40:01 PM       all      0.78      0.00      5.55      0.20      0.00     93.47
10:50:01 PM       all      0.77      0.00      5.47      0.07      0.00     93.69

After the change was complete I had no problem running i/o system intensive operations like disk compression, defragmentation, etc.

Original solution from: Mr. Pointy – Gutsy and VMWare Server – You’re In for Some Pain.

November 20, 2008: One More Day

1 Days to Baby Day! (39 Weeks and Six Days Pregnant)

“Sleep with the window open.” – Rule #285, 1001 Rules for My Unborn Son

One day to go.  It has felt like this day would not come for a very long time.  I decided that I really just needed to work from home tomorrow.  Everyone is expecting me to be home tomorrow anyway so it is no big deal.  I was just hoping to get in as much time in the office as possible before being home for a long stretch.  I really need a break from commuting and swimming though.  I am just worn out.

I slept in a bit this morning.  I really needed that.  I was awake around six thirty, but Oreo was just so snuggly.  I couldn’t bring myself to get out of bed for another hour.  He really misses me.  He got up immediately and came down to the basement and lay beside me while I worked.

At eight this morning the snow started.  Before it had started snowing I had been looking outside and thinking how “wintery” it looked.  This is our first snow in our new home.

I got Laborers for the Harvest set up today with a major WordPress code update, new theme and new plugins.  This is the first major site overhaul that we have done over there since the site first went live.

At noon, dad took Dominica down to the clinic downtown so that she could go to the final widwife appointment.  I can’t believe that we are down to the last one already.  One day short of nine months doesn’t seem very long.

Babies ‘R’ Us called while Dominica was out to let us know that our new furniture had arrived there.  The crib for the nursery and the glider-style rocking chair for our bedroom arrived.  Now we just have to figure out how to get it to the house.  It is some large stuff.

The word from the midwife is that everything looks to be fine but Dominica does not have any signs of approaching labor.  So the important thing, that the baby is healthy, is okay, but Dominica is very stressed and hoping to be able to deliver very soon.  She has an appointment to see the doctors on Monday for an ultrasound and something like a stress test in case she hasn’t gone into labor by then.

I was stuck in the basement pretty much all day working.  I’ve been working on a really tough issue with a VMWare Server instance that is producing some incredible drive activity that I am attempting to troubleshoot.  This is a particularly perplexing problem and is affecting a lot of stuff so I am desperate to get it fixed.  I will post a technical article about it once I get it figured out.

For dinner Dad and I drove out to the New City Diner in Yorktown Heights and got take out and brought food back for Dominica.  We watched a few episodes of the Mary Tyler Moore show and then Dominica went to bed around ten.  Dad put on Bones and I headed down to the basement to continue working.

I will be home tomorrow.  We are so close to the baby’s arrival that I should not be going into the office at this point.  Especially since I am able to get so much more work done when I don’t go into the office.  It is so hard to get a lot of work done when you commute for four hours.