trac: Solving sqlite-issues when upgrading from Debian etch to lenny

On my dev-server I had to upgrade to the newer version of debian lenny (which will be released as stable version this week).

The upgrade went fine but after it was finished trac (0.11.2.1 ) refused to start, throwing the error message

DatabaseError: file is encrypted or is not a database

According to the ticket system of trac the problem is the wrong version of sqlite which is used by trac. Sadly all my efforts to make the database useable again failed with the error message above.

After some research I discovered another way to let trac use the default sqlite3 but keeping my data alive. This chatlog states a simple way to convert your sqlite2 database to the newer sqlite3-format. Here is a quick walkthrough:

  1. Install the packages sqlite (v2) and sqlite3 (guess the version ;) )
    1
    
    aptitude install sqlite sqlite3
  2. Dump the old database and convert it to sqlite3
    1
    2
    3
    4
    5
    6
    
    cd /path/to/trac-repos
    cd db
    mv trac.db trac.db.old-sqlite2
    sqlite trac.db.old-sqlite2 .dump | sqlite3 trac.db
    chown www-data:www-data trac.db
    /etc/init.d/apache2 restart

And you’re done. The old database is now named trac.db.old-sqlite2 in case you need it for whatever reason. The new one is named with the default name trac.db so trac will use this one if not specified otherwise in conf/trac.ini.

I hope this tip saves you from some worries after upgrading to Debian Lenny. Keep on coding!

About stevie

Born in the north of Germany, raised in Berlin and stayed there since. After graduating, studying applied computer science at the FHTW Berlin (now HTW Berlin), I started my own company with a former fellow student, providing high class application solutions for web and desktop for small and medium companies (see www.jnamic.com (english version to be finished) for more information). My personal favorite programming languages are PHP for the web and Java for everything else - although I must admit Java evolved very much in the past few years. I love to code and build new applications from the scratch, optimizing it through day and night till I am satisfied with it's performance. So follow my articles, share your thoughts and experience with me and have a good time browsing this blog!
This entry was posted in common and tagged , , , , , . Bookmark the permalink.

5 Responses to trac: Solving sqlite-issues when upgrading from Debian etch to lenny

  1. Pingback: Debian »Lenny« released :: WE ARE ROOT

  2. Thanks a lot for this tip.

    This migration procedure should have been written in NEWS.Debian.gz or something like that.

    Olivier;

  3. Thanks a lot for this tip.

    This migration procedure should have been written in NEWS.Debian.gz or something like that.

    Olivier;

  4. Eric says:

    Great how-to. Also, this link has some other steps for transitioning from etch to lenny’s trac:
    http://wiki.kartbuilding.net/index.php/Upgrade_Trac
    They forgot to mention at the end to also run ‘trac-admin /location/of/trac wiki upgrade’ as well.

  5. Eric says:

    Great how-to. Also, this link has some other steps for transitioning from etch to lenny’s trac:
    http://wiki.kartbuilding.net/index.php/Upgrade_Trac
    They forgot to mention at the end to also run ‘trac-admin /location/of/trac wiki upgrade’ as well.

Leave a Reply