KeePass is a free and utterly genius password management tool that has allowed me to leave the days of reusing passwords way in the past. Now all of my passwords are different, securely managed, and look something like “út8¥Äbë¬eqö«ûëU^Èm¯”. (Go ahead — try to guess it!) It was written in Microsoft .Net, and supposedly works just fine under Mono in Linux. Mono is a .Net compatibility layer and it’s already included in Ubuntu installations. Well, most of it is.
The problem is that it didn’t quite work out of the box on our Ubuntu 10.10 machine. In particular, I wasn’t able to connect to my password database via FTP like I usually do, but I solved a couple other common problems along the way as well.
First, download the portable version KeePass from the site’s download page, and move all the files onto your linux box. I put them in my home directory under a new hidden directory called “.KeePass”. The first thing I did was add an application launcher to Ubuntu’s top panel, and lo and behold it would not launch.In console, I saw this error message:
The assembly mscorlib.dll was not found or could not be loaded. It should have been installed in the `/usr/lib/mono/1.0/mscorlib.dll’ directory.
The problem was simple; there was a typo in the path. So be sure to type the path carefully, like this: “mono /home/myname/.KeePass/KeePass.exe”. When Mono can’t find the file, it decides it wants to try to run an older version of itself, and that older version it’s included in Ubuntu by default.
Next there were a couple of errors that I wouldn’t have gotten if I had read the instructions carefully. They were both the standard “assembly not found” errors with the text “The following assembly referenced from /home/myname/.KeePass/KeePass.exe could not be loaded” and “The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly.” The first referred to “System.Windows.Forms” and the next to “System.Runtime.Remoting”.
These assemblies were simply not installed in Ubuntu 10.10 by default, but they’re available in the Ubuntu Software Center. Here’s what they look like when you’re adding them.

Adding Mono System.Windows.Forms Support
Sorry about the overlaid screen shot window in this one, but you can still see how to filter and what to click.

Adding Mono System.Runtime Support
Finally it would run, but I was still unable to from open the database from the URL of the FTP site. When I tried either by opening it directly or tweaking the config file, I got a polite error from KeePass that said, “The requested feature is not implemented.” I recognize this as a System.NotImplementedException that’s trapped (but probably not expected) in the code. What it probably means is that KeePass uses some features of .Net that are not yet implemented in Mono; it’s not KeePass’s fault.
I saw two ways around this error: First I could mount the FTP site to a local path using curlftpfs, but that would mean installing something new. Instead I wrote a short shell script to download the database, launch KeePass, and then upload the database back to the FTP site. Here’s the content of the script:
Server="ftp://my_ftp_site.com"
User="my_ftp_username"
Password="my_password"
DBFile="database.kdbx"
LocalPath="$HOME/.KeePass/"
lftp -u $User,$Password $Server <
Finally, I made the script executable, remapped the launcher to the script, picked a better icon, and I was in business again. I hope someone else out there finds this helpful. I know I will the next time I forget what I did. 🙂