Fix mod_auth_mysql on Ubuntu 64-bit

September 13, 2009 - 8:12pm

At least twice, now, I've encountered problems (read: apache segfaults, oh noes!) with mod_auth_mysql on Ubuntu 64-bit installs, most recently using Jaunty Jackalope (9.04) -- the most recent release (at least until 9.10 comes out soon). In searching for solutions, I discovered that this issue has been reported at least a couple times, the issue has been identified (and is a super-simple fix), and a working patch exists... but as of the writing of this article, the fix has not yet been compiled into the repo packages.

So then this becomes one of those relatively rare times that I will compile my own package. I prefer to compile binary packages (deb files) rather than simply compiling from source and doing a "make install," since packages leverage the package management system for things like dependencies and upgrades. For instance, if Ubuntu does release the fix in the next version of mod_auth_mysql, I want to be able to seemlessly upgrade to the next version.

I'm going to describe the steps to fix mod_auth_mysql 4.3.9-11, but this general process should work for applying community patches and building deb files in general.

  1. Uninstall mod_auth_mysql:
    $ sudo apt-get remove libapache2-mod-auth-mysql
  2. Get mod_auth_mysql source (drops it in the current directory, so be where you want it, such as ~/src):
    $ sudo apt-get source libapache2-mod-auth-mysql
  3. Get dependencies for building from source:
    $ sudo apt-get build-dep libapache2-mod-auth-mysql
  4. Get a dependencies that didn't install with build-dep:
    $ sudo apt-get install apache2-threaded-dev (could be different for your system)
  5. Get devscripts package to make this all much easier:
    $ sudo apt-get install devscripts (installs postfix -- annoying)
  6. Set file perms on the source files you downloaded:
    $ sudo chown -R josh:josh *
  7. Enter src dir:
    $ cd mod-auth-mysql-4.3.9
  8. Prepare to apply patch. This actually starts a new shell with the current directory containing a copy of the code so you can edit it.
    $ dpatch-edit-patch -a fix_segfaults
  9. Apply patch, a one-line edit to mod_auth-mysql.c described here.
  10. Exit the shell.
  11. Add fix_segfaults to the end of debian/patches/00list.
  12. Record the changes and change the package version info. Change the version at the top of the file. I usually just add something at the end of the existing version string.
    $ dch -i
  13. Build the deb file. This will compile the source, package the binaries, and put the deb file one directory up.
    $ dpkg-buildpackage -rfakeroot
  14. Install the new package. Note: Your deb file name will be different based on how you changed the version string above.
    $ sudo dpkg -i ../libapache2_mod_auth_mysql-4.3.9-11_amd64.deb

Seems like a lot, but after you do it, it doesn't seem too bad, and you can bask in the glory of creating your own package -- which is reusable on all same-type systems.

  1. Anonymous (not verified) on October 3, 2009 - 1:30pm

    I followed these directions but I still have the same error. Is there something that I could be doing wrong?

  2. Josh on October 3, 2009 - 9:06pm

    That's a pretty broad question. The least specific part of the directions above are the details on applying the patch, which is just adding an additional include line. Make sure when you add the include line, that the other lines shown in the patch around it look right.

    Otherwise -- is it compiling the source (should take at least a little bit usually)? Is the .deb file being generated? Are you installing using dpkg -i after the .deb file is created? Did you first UNinstall the existing package?

  3. Joost (not verified) on October 4, 2009 - 5:29pm

    Great info !
    Thanks.

    I had the exact same problem after installing Jaunty 64 on my brand new Intel i7 computer. So I was very disappointed, as using Apache without the option to shield folders is basically useless to me.

    I followed the steps above, and it worked like a charm.

    So thnx.

  4. M^LiBuQ (not verified) on January 16, 2010 - 7:30pm

    Tried so much guides 2Night and yours are Working , THX ^^

  5. Post new comment

    The content of this field is kept private and will not be shown publicly.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
    • Lines and paragraphs break automatically.
    • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <geshi>, <bash>, <c>, <cpp>, <csharp>, <css>, <drupal5>, <drupal6>, <html>, <js>, <mysql>, <php>, <python>, <rails>, <ruby>, <sql>, <text>, <mssql>, <xml>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

    More information about formatting options