Upgrading to Debian Etch for Rails Mongrel Hosting

We need more power!

I just completed a major upgrade to our main production web host box.

Apache 2.0 / FCGI just wasn’t cutting it any more. I wanted speed, I wanted the new hotness…I wanted to run Mongrel. I was one of the first to sign onto Rimu Hosting, who originally set everything up.

Unfortunately I was also one of those who couldn’t install Ruby 1.8.4 / Mongrel / etc the preferred way for Debian Sarge as outlined here.

The backport way looked a little scary, and the ‘gotchas’ about having to install rubygems and zlib seemed too much to handle.

In the end I got it all done, but not without some problems. Good thing I didn’t have anything to do today…

From Debian Sarge to Etch (aka Debian Testing)

Being completely ignorant about what could happen I bit the bullet and started the upgrade to Debian Etch. (Well not completely ignorant, I backed up all my mail, sites, and databases first :)

Beginning the upgrade

This part was easy, I updated my /etc/apt/sources.list to look like this:


deb http://mirrors.easynews.com/linux/debian/ etch main contrib non-free
deb-src http://mirrors.easynews.com/linux/debian etch main contrib non-free

deb http://security.debian.org/ etch/updates main contrib non-free
deb-src http://security.debian.org/ etch/updates main
After that it was a matter of typing
  • sudo apt-get update
  • sudo dist-upgrade

Houston, we have a problem…

It went along its merry way until I started getting errors like this:


Errors were encountered while processing:
Unpacking openssh-server (from .../openssh-server_1%3a4.3p2-7_i386.deb) ...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en_US:en_GB:en",
        LC_ALL = (unset),
        LANG = "en_US" 
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Transferring ownership of conffile /etc/default/ssh ...
Transferring ownership of conffile /etc/init.d/ssh ...
Transferring ownership of conffile /etc/pam.d/ssh ...
dpkg: error processing /var/cache/apt/archives/openssh-server_1%3a4.3p2-7_i386.deb (--unpack):
 trying to overwrite `/etc/init.d/ssh', which is also in package ssh
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Aborting ownership transfer of conffile /etc/default/ssh ...
Aborting ownership transfer of conffile /etc/init.d/ssh ...
Aborting ownership transfer of conffile /etc/pam.d/ssh ...
Errors were encountered while processing:
 /var/cache/apt/archives/openssh-client_1%3a4.3p2-7_i386.deb
 /var/cache/apt/archives/openssh-server_1%3a4.3p2-7_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Oh boy, this didn’t look good at all. Locale was busted. I started freaking out, but Google came to the rescue with this tidbit of helpful information


setenv LANGUAGE en_us
setenv LANG en_us
apt-get install -f

That fixed that error, but trying to continue with the install (apt-get install -f) started giving me other errors about SSH not being able to properly install. Something weird about not being able to overwrite a configuration file.

Worse yet, I couldn’t SSH into or out of the server at this point. Thankfully I still had a connection up.

I started freaking out. I considered wiping the entire system and having the Rimu folks install a fresh Rails stack with FC6. I sent tons of emails inquiring about the possibilities….

...Then I got fed up with the prospects of changing OSes and decided to fix this damn thing.

You’ve got questions, we’ve got answers…

Freenode IRC #debian to the rescue. Someone pointed me in the direction of this command:


apt-get -o DPkg::Options::="--force-overwrite" install openssh-client openssh-server 

This fixed all my problems, and install went along without a hitch. SSH was hanging on overwriting a configuration file. With that out of the way everything seemed to start working again.

A pack of rabid Mongrels

Finally, we had a working system again. MySQL was responsive and Apache was up, even if all of my Rails sites previously running on FCGI were screwed.

I went through the steps outline here to get Mongrel up, running and configured. Again, another problem. I had configured everything properly (I thought), but I kept getting ‘403 Forbidden’ errors when trying to access my sites.

Stumped, I checked out Apache’s error_log:


[Mon Dec 18 02:46:02 2006] [warn] proxy: No protocol handler was valid for the URL /goodnews/GenSelectsPatentedPreconceptionGenderSelectionSystemExplanation. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

Not sure what to make of that, Google again came to the rescue with this helpful hint. It seems that by default Debian doesn’t include the proxy_balancer or proxy_http modules. I enabled them, restarted Apache, and everything was running smoothly.

One last thing

I was also lucky to find this great script for automatically starting your Mongrel clusters upon a server reboot. Check it out, you’ll probably find it useful.

Bedtime

It took all day, but I was able to get it done. All in all not so bad. My production box is humming along with Mongrel now, and all is right with the world.

Hopefully this article can help some of you out there that might be struggling with the same thing.

seth, Mon, 18 Dec 2006 13:05:00 GMT
1 comment