# Running Rails on 64-Bit Linux - Segmentation Fault

**URL:** <https://www.ruby-forum.com/t/running-rails-on-64-bit-linux-segmentation-fault/144664>\
**Category:** Rails\
**Created:** [July 31, 2008, 11:22pm UTC](https://www.ruby-forum.com/t/running-rails-on-64-bit-linux-segmentation-fault/144664 "2008-07-31T23:22:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_Hazlett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@Christopher\_Hazlett](https://www.ruby-forum.com/u/Christopher_Hazlett)\
**Post date:** [July 31, 2008, 11:22pm UTC](https://www.ruby-forum.com/t/running-rails-on-64-bit-linux-segmentation-fault/144664/1 "2008-07-31T23:22:48Z")

</div>

Just wanted to post a warning for everyone out there.

We just migrated our application to a 64-Bit Red Hat Enterprise 5  
Server, and when we migrated we dutifully installed the latest ruby  
patch p230 for Ruby 1.8.6. As soon as we got our web server running  
(Litespeed), our pages failed for what seemed like no reason.

At first, my only inkling on the rails side was a failure on the  
“protect\_from\_forgery?” function on a remote form, but then I started  
getting 503 errors, which shouldn’t happen. Worse yet, it happened  
intermittently, so repeating the problem was almost impossible.

When I dug into the server’s error log, I started seeing a  
segmentation fault [bug] warning. It’s not something we’ve ever  
experienced with our site or with Ruby.

Low and behold, after much hand wringing and searching the depths of  
every ruby, rails, and linux groups, it turns out that ruby-1.8.6-p230  
causes the segmentation fault sometimes when the ActiveSupport gem is  
called. To fix the problem, we downgraded our Ruby version to what we  
originally developed on ruby-1.8.6-p111. All is well. no more wierd  
errors or segmentation faults.

I know we searched far and wide for an answer to this issue, so I  
thought it would be a good idea to post how we fixed it.

On another note: when installing ruby and rails on the Red Hat  
Enterprise 5, make sure you have the zLib-devel and openssl-devel  
installed before you install ruby, or your ruby installation and  
subsequent rails installation can get almost hopelessly borked.  
Sometimes zLib and openssl is there, but zLib-devel and openssl-devel  
may not be. Use Yum to install them…it’s just easier. the ROR wiki  
says to use ‘up2date zlib\_devel’, but up2date is not valid on Red Hat  
Enterprise 5.

That’s it. I hope we saved someone a few hours.  
-Chris

---

<div class="post-metadata">

**Author:** ![Christopher\_Hazlett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@Christopher\_Hazlett](https://www.ruby-forum.com/u/Christopher_Hazlett)\
**Post date:** [July 31, 2008, 11:27pm UTC](https://www.ruby-forum.com/t/running-rails-on-64-bit-linux-segmentation-fault/144664/2 "2008-07-31T23:27:30Z")

</div>

On Thu, 2008-07-31 at 14:10 -0700, Christopher Hazlett wrote:

> intermittently, so repeating the problem was almost impossible.  
> errors or segmentation faults.  
> says to use ‘up2date zlib\_devel’, but up2date is not valid on Red Hat  
> Enterprise 5.
> 
> That’s it. I hope we saved someone a few hours.

* * *

I’m sort of curious…

# rpm -q ruby

ruby-1.8.5-5.el5\_2.3

Where did you get ruby-1.8.6-XXX from?

That’s not part of normal RedHat packages as far as I can tell.

yes, the original -p230 (patch 230) packages were a problem but that  
problem affected everyone, everywhere and not just Red Hat or Fedora  
users. That was a ruby problem and they came out with a second and third  
round of patches which seemed to fix things.

FWIW, I have no problem with Fedora’s ruby-1.8.6.230-4 packages w/  
rails…

# rpm -qa|grep ruby

ruby-libs-1.8.6.230-4.fc9.i386  
ruby-rdoc-1.8.6.230-4.fc9.i386  
ruby-1.8.6.230-4.fc9.i386  
ruby-irb-1.8.6.230-4.fc9.i386  
ruby-ri-1.8.6.230-4.fc9.i386  
ruby-devel-1.8.6.230-4.fc9.i386  
ruby-mode-1.8.6.230-4.fc9.i386  
ruby-ldap-0.9.7-5.fc9.i386

Craig

---

<div class="post-metadata">

**Author:** ![Christopher\_Hazlett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@Christopher\_Hazlett](https://www.ruby-forum.com/u/Christopher_Hazlett)\
**Post date:** [August 1, 2008, 12:47am UTC](https://www.ruby-forum.com/t/running-rails-on-64-bit-linux-segmentation-fault/144664/3 "2008-08-01T00:47:40Z")

</div>

I didn’t use the rpm or yum packages because they stopped at  
1.8.5.el5\_2.3, at least the packages I could find.  
So I compiled from source after wget  
ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.6-p111.tar.gz  
and then you followed the steps at  
[http://www.redhatmagazine.com/2006/11/16/ruby-on-rails-on-red-hat/](http://www.redhatmagazine.com/2006/11/16/ruby-on-rails-on-red-hat/).

It’s actually good to know that the 230-4 patch works as expected. I  
couldn’t find that written up anywhere…that would have saved me some  
time. Plus, I was trying to get a 64 bit build, which you will get  
when you compile from source. Installing with the rpm package only  
gives you i386. Now, I don’t know everything, obviously, We’ve only  
just graduated to our shiny new 64-bit server and had been working on  
a 32-bit during all of our dev work. Take it with a grain of salt.

-Chris

---

<div class="post-metadata">

**Author:** ![Christopher\_Hazlett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@Christopher\_Hazlett](https://www.ruby-forum.com/u/Christopher_Hazlett)\
**Post date:** [August 1, 2008, 6:53am UTC](https://www.ruby-forum.com/t/running-rails-on-64-bit-linux-segmentation-fault/144664/4 "2008-08-01T06:53:01Z")

</div>

On Thu, 2008-07-31 at 15:47 -0700, Christopher Hazlett wrote:

> just graduated to our shiny new 64-bit server and had been working on  
> a 32-bit during all of our dev work. Take it with a grain of salt.

* * *

That article is over 2 years old…a lifetime in ruby on rails and too  
much salt gives you high blood pressure.

ummm…the reason that you use a package management system is to manage  
installed software and when you need to compile from source, you really  
don’t want to just do the make && make test && make install sort of  
thing but rather build rpm’s. If you need to update/remove, it’s a mess  
to start fooling in /usr/local/…

I’m not sure why you needed ruby 1.8.6 instead of the 1.8.5 that is  
standard RHEL packages but it’s simple enough to build 1.8.6 rpm’s which  
replace the RHEL packages, and could easily be uninstalled or updated  
without fuss…

AND

the packages you build will be x86\_64 if your platform is x86\_64

These are the steps I used to compile (though I didn’t bother  
installing) and to install up to date ruby packages on a Red Hat type  
system (note - the ‘spec’ file knows which ‘devel libraries’ are needed  
and you can see, I needed to install some to build ruby packages)…

cd /opt  
wget   
[http://mirrors.usc.edu/pub/linux/distributions/fedora/linux/updates/9/SRPMS/ruby-1.8.6.230-4.fc9.src.rpm](http://mirrors.usc.edu/pub/linux/distributions/fedora/linux/updates/9/SRPMS/ruby-1.8.6.230-4.fc9.src.rpm)  
rpm -ivh ruby-1.8.6.230-4.fc9.src.rpm  
cd /usr/src/redhat/SPECS/  
rpmbuild -bb ruby.spec  
cd /usr/src/redhat/RPMS/i386  
rpm -Uvh   
ruby-1.8.6.230-4.i386.rpm   
ruby-devel-1.8.6.230-4.i386.rpm   
ruby-docs-1.8.6.230-4.i386.rpm   
ruby-irb-1.8.6.230-4.i386.rpm   
ruby-libs-1.8.6.230-4.i386.rpm   
ruby-mode-1.8.6.230-4.i386.rpm   
ruby-rdoc-1.8.6.230-4.i386.rpm   
ruby-ri-1.8.6.230-4.i386.rpm   
ruby-tcltk-1.8.6.230-4.i386.rpm

Notes:

- I used the latest ruby-1.8.6.230-4 Source RPM from Fedora (9)
- I had to install readline-devel gdbm-devel tcl-devel tk-devel byacc  
and as you noted, it’s likely that one would need zlib-devel and  
openssl-devel if not other packages too.
- If your platform is x86\_64, then your RPMS’s would be in that folder
- you don’t have to install all the packages (I don’t use ruby-tcltk)
- Fedora 9 has a number of other ruby packages that may be of  
interest…

[http://mirrors.usc.edu/pub/linux/distributions/fedora/linux/updates/9/SRPMS/](http://mirrors.usc.edu/pub/linux/distributions/fedora/linux/updates/9/SRPMS/)

Craig

---

<div class="post-metadata">

**Author:** ![Christopher\_Hazlett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@Christopher\_Hazlett](https://www.ruby-forum.com/u/Christopher_Hazlett)\
**Post date:** [August 1, 2008, 11:24pm UTC](https://www.ruby-forum.com/t/running-rails-on-64-bit-linux-segmentation-fault/144664/5 "2008-08-01T23:24:19Z")

</div>

On Fri, 2008-08-01 at 09:24 -0700, Christopher Hazlett wrote:

> From the coddled world of IIS and .NET to getting our Linux running  
> Ruby has been painful at times…and I really appreciate the advice  
> and clarification.
> 
> Thankfully, other than not using RPM, things are running smoothly  
> now. I’ll have to rectify the RPM issue for maintenance’s sake.
> 
> Thanks again,

* * *

as an FYI

- the p230 patches were put out by ruby developers to patch for a  
security issue…  
[Arbitrary code execution vulnerabilities | Ruby](http://www.ruby-lang.org/en/news/2008/06/20/arbitrary-code-execution-vulnerabilities/)

- discussion of the problems that arose from those patches definitely  
occurred on this list.

- if you have ‘packaging’ installation issues, you could ask.

Craig

---

<div class="post-metadata">

**Author:** ![Christopher\_Hazlett](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b5ac83/32.png) [@Christopher\_Hazlett](https://www.ruby-forum.com/u/Christopher_Hazlett)\
**Post date:** [August 1, 2008, 6:24pm UTC](https://www.ruby-forum.com/t/running-rails-on-64-bit-linux-segmentation-fault/144664/6 "2008-08-01T18:24:56Z")

</div>

Thanks Craig. These are all good things to know.

I knew the articles were a couple of years old. I guess this is one of  
the issues you run into when working with open source, there is so  
much information of so varying quality, that you really need to pick  
your resources carefully. Sometimes articles are new and wrong…and  
sometimes they are old and right. It sucks when you’re really just  
getting into the Linux world because the sheer quantity of information  
is daunting.

From the coddled world of IIS and .NET to getting our Linux running  
Ruby has been painful at times…and I really appreciate the advice  
and clarification.

Thankfully, other than not using RPM, things are running smoothly  
now. I’ll have to rectify the RPM issue for maintenance’s sake.

Thanks again,  
-Chris
