Redmine Svn Auto Creation: Can't make DBI com handle for DBD::mysql::db: unknown package.

Added by Dave Hrycyszyn over 11 years ago

Hi,

I've set Redmine up so that it auto-creates SVN repos when a project gets created. This part seems to work - the one thing I have a problem with right now is that when I attempt to check out a repository, I get the following error in Apache 2's error logs:

Can't make DBI com handle for DBD::mysql::db: unknown package.

I have my Redmine set up using an Apache vhost like so:

<VirtualHost *:80>
  ServerName foo.com
  DocumentRoot /var/www/foo.com/public
  <Directory "/var/www/foo.com/public">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>
   <Location /sys>
      Order allow,deny
      Allow from 127.0.0.1
   </Location>

   PerlLoadModule Apache::Authn::Redmine
   <Location /svn>
     DAV svn
     SVNParentPath "/var/svn" 

     AuthType Basic
     AuthName redmine
     Require valid-user

     PerlAccessHandler Apache::Authn::Redmine::access_handler
     PerlAuthenHandler Apache::Authn::Redmine::authen_handler

     ## for mysql
     RedmineDSN "DBI:mysql:database=redmine;host=127.0.0.1" 
     ## for postgres
     # PerlSetVar dsn DBI:Pg:dbname=databasename;host=my.db.server

     RedmineDbUser "foo" 
     RedmineDbPass "bar" 
  </Location>

  # a private location in read only mode to allow Redmine browsing
  <Location /svn-private>
    DAV svn
    SVNParentPath "/var/svn" 
    Order deny,allow
    Deny from all
    # only allow reading orders
    <Limit GET PROPFIND OPTIONS REPORT>
      Allow from 127.0.0.1
    </Limit>
  </Location>
</VirtualHost>

Redmine.pm is installed in /usr/lib/perl5/Apache/Authn.

I'm using the latest r1923 revision of Redmine trunk (I upgraded to see if it would help anything, previously I was at r1770 with the same behaviour).
Rails 2.1
MySql
Ubuntu 7.10
libapache-dbi-perl, libapache2-mod-perl2, and libdbd-mysql-perl are all installed.

I'm not much of a Perl person so I am not too sure how to proceed, I have never understood Perl module loading :).

Any tips on how to proceed?

Also it appears to me that given the instructions inside Redmine.pm, the how-to at http://www.redmine.org/wiki/redmine/Repositories_access_control_with_apache_mod_dav_svn_and_mod_perl is a bit out of date, I'd be happy to update it if people think that's a good idea.

Replies (10)

RE: Redmine Svn Auto Creation: Can't make DBI com handle for DBD::mysql::db: unknown package. - Added by Nicolas Chuche over 11 years ago

Can't make DBI com handle for DBD::mysql::db: unknown package.

Perl (or DBI) seems to think that you don't have the DBD::mysql perl module.

Could you try this command line to verify that perl can find the package :

perl -MDBD::mysql -le 'print $DBD::mysql::VERSION'

It should give something like that :

perl -MDBD::mysql -le 'print $DBD::mysql::VERSION'
4.005

Yes, some instructions are a bit out of date. I hadn't time to update them for the moment.

RE: Redmine Svn Auto Creation: Can't make DBI com handle for DBD::mysql::db: unknown package. - Added by Dave Hrycyszyn over 11 years ago

$ perl -MDBD::mysql -le 'print $DBD::mysql::VERSION'
4.005

Weird stuff. Any thoughts?

As far as the tutorial goes, it's all fine other than the perl module stuff, I think only this part needs changing:

PerlRequire /usr/local/apache/Redmine.pm

should change to:

# copy Redmine.pm into your perl path, on debian/ubuntu this would be at /usr/lib/perl5/Apache/Authn
PerlLoadModule Apache::Authn::Redmine

RE: Redmine Svn Auto Creation: Can't make DBI com handle for DBD::mysql::db: unknown package. - Added by Borja Sotomayor over 10 years ago

Was this issue solved? I'm encountering the same problem, but only when doing an svn merge. More specifically, the merge fails with the following message:

svn: PROPFIND of '/svn/haizea/!svn/bc/614/branches/TP2.0/src/haizea/policies': Could not read status line: Secure connection truncated (https://redacted.server.name.com)
svn: Error reading spooled REPORT request response

And the following appears on the Apache log:

Can't make DBI com handle for DBD::mysql::db: unknown package, <DATA> line 343.
Can't make DBI com handle for DBD::mysql::db: unknown package, <DATA> line 343.

Pretty much every other SVN operation I've done so far --checking out, updates, checking in, etc.-- has worked fine (also, when doing those operations, the DBI error message doesn't show up on the Apache logs). Furthermore, this problem only shows up when using the "public" SVN directory that uses Redmine.pm for authorization. If I use the "internal" SVN directory, the svn merge completes correctly (the "internal" SVN directory also uses HTTPS, so I'm pretty sure this isn't an SSL issue).

The Apache version string is "Server Version: Apache/2.2.9 (Debian) DAV/2 SVN/1.5.1 mod_ssl/2.2.9 OpenSSL/0.9.8g mod_perl/2.0.4 Perl/v5.10.0". I'm using Redmine 0.8.4 with Rails 2.1.2.

The DBD::mysql module is installed:

$ perl -MDBD::mysql -le 'print $DBD::mysql::VERSION'
4.007

I'm not a perl person, but is the fact that "DBD::mysql::db:" has an extra colon at the end relevant? (a typo? I looked at the Redmine.pm code but, not knowing Perl, I couldn't figure out if there was something wrong along those lines).

In case it helps, this is the Apache vhost configuration:

NameVirtualHost XXX.XXX.XXX.XXX:443

<VirtualHost XXX.XXX.XXX.XXX:443>
    # The basics:
    ServerName redacted.server.name.com

    # Logs
    ErrorLog /acm/var/log/pf-http-error.log
    CustomLog /acm/var/log/pf-http-access.log combined
    ServerSignature On
    LogLevel warn

    # SSL Config
    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/phoenixforge.crt
    SSLCertificateKeyFile /etc/apache2/ssl/phoenixforge.key

    <Proxy balancer://redmine_cluster>
    Order allow,deny
    Allow from all
    BalancerMember http://127.0.0.1:8000
    BalancerMember http://127.0.0.1:8001
    BalancerMember http://127.0.0.1:8002
    </Proxy>

    ProxyPass /images !
    ProxyPass /stylesheets !
    ProxyPass /javascripts !
    ProxyPass /favicon.ico !
    ProxyPass /static !
    ProxyPass /holding !
    ProxyPass /templates !
    ProxyPass /svn !
    ProxyPass /svn-internal !
    ProxyPass / balancer://redmine_cluster
    ProxyPreserveHost On

    RewriteEngine On
    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^/svn.*$
    RewriteRule ^/(.*)$ balancer://redmine_cluster%{REQUEST_URI} [P,QSA,L]

    <Location /sys>
    Order allow,deny
    Allow from 127.0.0.1
    </Location>

    PerlLoadModule Apache::Redmine

    # Location for SVN repositories
    <Location /svn>
    DAV svn

    # The local path where the SVN repositories are located
    SVNParentPath /acm/phoenixforge-svn
    SVNPathAuthz off 
    # Authorization options
    AuthType Basic
    Authname "Foobar" 
    Require valid-user

    PerlAccessHandler Apache::Authn::Redmine::access_handler
    PerlAuthenHandler Apache::Authn::Redmine::authen_handler

    # Database access parameters for the Redmine database
    RedmineDSN "DBI:mysql:dbname=redmine;host=localhost" 
    RedmineDbUser "redmine" 
    RedmineDbPass "REDACTED" 
    </Location>

    <Location /svn-internal>
    DAV svn
    SVNParentPath "/acm/phoenixforge-svn" 
    SVNPathAuthz off 
    Order deny,allow
    Deny from all
    # Only allow read-only access from this machine
    <Limit GET PROPFIND OPTIONS REPORT>
        Allow from 127.0.0.1 XXX.XXX.XXX.XXX
    </Limit>
    </Location>

</VirtualHost>

Don't hesitate to let me know if you need any more information.

RE: Redmine Svn Auto Creation: Can't make DBI com handle for DBD::mysql::db: unknown package. - Added by Johan De Meersman over 10 years ago

I'm seeing this issue, too, on 0.8.5. I see the DBD messages appear in the logs on various actions, but I also see the following:

Usage: DynaLoader::dl_load_file(filename, flags=0), <DATA> line 343.

when executing
meersjo@soulcake-duck:~$ svn copy -rHEAD http://svn.redmineprod1.rto.be/svn/een/trunk/src http://svn.redmineprod1.rto.be/svn/een/tags/V1_3-RC1

Log message unchanged or not specified
(a)bort, (c)ontinue, (e)dit :
c
svn: COPY of '/svn/een/!svn/bc/721/trunk/src': Could not read status line: connection was closed by server (http://svn.redmineprod1.rto.be)
meersjo@soulcake-duck:~$ 

RE: Redmine Svn Auto Creation: Can't make DBI com handle for DBD::mysql::db: unknown package. - Added by Johan De Meersman over 10 years ago

I just commented out the redmine authentication lines from the vhost, and it now works. I guess this confirms that it's a problem in the authentication trail, not the subversion itself.

RE: Redmine Svn Auto Creation: Can't make DBI com handle for DBD::mysql::db: unknown package. - Added by Robin Kluth over 8 years ago

Got exatcly the same error by trying to commit something :(

How to fix it?

I've configured it over the latest manual on redmine. All working except this...

Can someone provide a fix?

RE: Redmine Svn Auto Creation: Can't make DBI com handle for DBD::mysql::db: unknown package. - Added by Johan De Meersman over 8 years ago

I had a fair amount of exchange with the (then?) maintainer; but this never got resolved in the end.

I left that installation with SVN authentication disabled as noted above (that is, the apache requests a user/pass, but doesn't check), and it ran like that for years. Not particularly to my liking, but it wasn't public anyway.

We're now running on a new install which I'm no longer the administrator for, but I'm not aware of having had the issue again.

Redmine is a very nice product, but I'm damn glad I don't have to administer the setup anymore :-)

RE: Redmine Svn Auto Creation: Can't make DBI com handle for DBD::mysql::db: unknown package. - Added by Robin Kluth over 8 years ago

Hm :(

I've configured a BasicAuth with htpasswd-file for write access. Read: no auth, write: auth required.
Works well, but the DB-Authentication would be better :/

RE: Redmine Svn Auto Creation: Can't make DBI com handle for DBD::mysql::db: unknown package. - Added by Thomas Vougessis about 8 years ago

hello,
any solution available?

i have a running ubuntu lucid at home and at my company an ubuntu oneiric with this shit failure.

because it's not python, i am a bit helpless.

please!!!

(1-10/10)