Salvaging Evolution Addressbook Data

By | May 28, 2011

I’ve been in the process of migrating from Ubuntu to OpenSuSE 11.1 this past week. While I really liked Ubuntu, they put out a 64-bit kernel update which was any direction but “up”. Problems were spread far and wide, yet they didn’t send out another update backing this update out. Given the company putting out Ubuntu wants to become the desktop of choice when corporations dump their legacy Windows desktops, this was not a smooth move. It alienated a lot of users at a time when most of the off-shore consulting companies have already begun abandoning Microsoft products. The first cut has been to get rid of Outlook and Exchange, replacing them with Gmail. The second step has been to remove MS Office and replace it with OpenOffice. Pretty much every corporation which will still be here in 3 years has moved to the Open Document Standard. Even IBM has now released a free Lotus Symphony word processor which runs on a lot of platforms and creates the Open Document format as its default output. (Not only that, but it can read Lotus WordPro and other IBM document file formats. There may very well be some quirks when reading complex documents, but so far this is your only “free” option.)

I dutifully did an image backup and even copied my home directory off to a USB drive. I nuked the Ubuntu partitions and performed the process of installing SuSE. Then I performed the process of installing all of that software you don’t have the option of choosing when installing from DVD. When I started configuring email, I learned of a real bug-a-boo with Evolution. You cannot simply copy the addressbook.db file from your backup copy to the correct place in the newly created folder. That trick works with the email tree, but it is a prescription for heartache when you try it with the addressbook.db file.

Needless to say, I’ve spent the better part of the last few days searching the Web and trying various things. The bottom line is that you are nearly pooched if you forget to use the “export” function in Evolution before moving to a new OS or even re-installing Evolution. Then I found this Web site:

In case the site moves, I’m going to post the code here. It requires you have the BerkeleyDB package for perl installed, but you probably already do, if not, I haven’t found a distro that didn’t include it. You want to direct the output to a listing file because it is pretty ugly. A little time spent with a text editor and your new Evolution installation will allow you to salvage most of your data.

#!/usr/bin/perl -w

use strict;

use 5.008;

use BerkeleyDB;

package addressbook;


sub new {

# Create new object

my $class = shift;

my $self = {};

bless $self, $class;


sub getBook {

# initialize variables

my $self = shift;


sub printBook {

my $self = shift;

use vars qw( %h $k $v ) ;

my $filename = “/media/USB_250/addressbook/local/1/addressbook.db” ;

tie %h, “BerkeleyDB::Hash”,

-Filename => $filename,

-Flags => BerkeleyDB::DB_RDONLY

or die “Cannot open file $filename: $! $BerkeleyDB::Error\n” ;

# print the contents of the file

while (($k, $v) = each %h) {

print “\n$k -> $v”;


untie %h ;



package main;


my $addressbook = new addressbook();


print “\n”;




Category: Information Technology Tags: , , ,

About seasoned_geek

Roland Hughes started his IT career in the early 1980s. He quickly became a consultant and president of Logikal Solutions, a software consulting firm specializing in OpenVMS application and C++/Qt touchscreen/embedded Linux development. Early in his career he became involved in what is now called cross platform development. Given the dearth of useful books on the subject he ventured into the world of professional author in 1995 writing the first of the "Zinc It!" book series for John Gordon Burke Publisher, Inc. A decade later he released a massive (nearly 800 pages) tome "The Minimum You Need to Know to Be an OpenVMS Application Developer" which tried to encapsulate the essential skills gained over what was nearly a 20 year career at that point. From there "The Minimum You Need to Know" book series was born. Three years later he wrote his first novel "Infinite Exposure" which got much notice from people involved in the banking and financial security worlds. Some of the attacks predicted in that book have since come to pass. While it was not originally intended to be a trilogy, it became the first book of "The Earth That Was" trilogy: Infinite Exposure Lesedi - The Greatest Lie Ever Told John Smith - Last Known Survivor of the Microsoft Wars When he is not consulting Roland Hughes posts about technology and sometimes politics on his blog. He also has regularly scheduled Sunday posts appearing on the Interesting Authors blog.