XEN, Ruby Enterprise Edition and 4gb seg fixup

My new CentOS XEN server has a virtual machine which serves as a dedicated web server. The on the console and in /var/log/messages the following message appeared:

4gb seg fixup, process ruby (pid 20252), cs:ip 73:00e0a636
printk: 151939 messages suppressed.

The console is unusable, because every second a new message appears. The logfile is unusable as well, because it is very large and takes long to open in a text editor and interesting messages are difficult to find. After some google’ing I’ve found the following page with some instructions to fix it. I’ve mixed up various methods, but this is the most robust one to use. It creates a wrapper around the gcc and g++ binaries with the correct parameters.

mv /usr/bin/gcc /usr/bin/gcc.orig
mv /usr/bin/g++ /usr/bin/g++.orig
echo '#!/bin/sh' > /usr/bin/gcc
echo '#!/bin/sh' > /usr/bin/g++
echo 'exec gcc.orig -mno-tls-direct-seg-refs $@' >> /usr/bin/gcc
echo 'exec g++.orig -mno-tls-direct-seg-refs $@' >> /usr/bin/g++
chmod a+x /usr/bin/gcc
chmod a+x /usr/bin/g++

Extract the Ruby Enterprise Edition. Be careful to use a fresh extracted version to compile, because the files will not be recompiled. Compile and install Ruby Enterprise Edition as stated in the manual.

tar zxvf ruby-enterprise-1.8.7-2009.10.tar.gz
./ruby-enterprise-1.8.7-2009.10/installer

Don’t forget to reinstall passenger, and off course reinstall all the gems from the old installation.

Now you can restore gcc and g++ as this will probably break yum updates of gcc and g++.

rm -rf /usr/bin/gcc && mv /usr/bin/gcc.orig /usr/bin/gcc
rm -rf /usr/bin/g++ && mv /usr/bin/g++.orig /usr/bin/g++

Hopefully I’ve saved you guys some time ;-)

This entry was posted in Ruby on Rails, VPS and tagged , , . Bookmark the permalink.

One Response to XEN, Ruby Enterprise Edition and 4gb seg fixup

  1. Wout Mertens says:

    You need to put quotes around the $@ or it will not handle gcc arguments with spaces properly.
    e.g.
    echo ‘exec gcc.orig -mno-tls-direct-seg-refs “$@”‘ >> /usr/bin/gcc

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>