My KeePass to LastPass Migration Woes!

Preliminary

This blog post details the technical difficulties faced when trying to migrate from using KeePass to LastPass. KeePass has been an excellent password companion for the last 6 years and I’ve been using MiniKeePass for iOS, loading my password safe from Dropbox quite happily. But since starting to use a Chromebook I’ve been increasingly frustrated in this area. There are a few Chrome extensions that provide access to KeePass. CKP has 4.5 stars in the Chrome app store, but I’ve found this browser extension clunky and annoying to say the least. Manual search in CKP doesn’t work properly and despite the good reviews overall the experience in my opinion is poor. Not to mention it only gives read-only access to the password safe.

So I finally bit the bullet and decided to migrate to LastPass, after months of frustration trying to access my password safe from ChromeOS.

Here I document my migration woes, for no other reason than to provide help to anyone who might be googling for this info!

The import

LastPass supports importing from KeePass. You have to export to XML then upload the XML. Sounds simple, but fraught with the following problems.

Tip #1: use Firefox. Don’t question this, just install Firefox and run the import in Firefox. This solves a lot of issues.

Tip #2: if you used folders in KeePass, consider exporting each folder as a separate XML file. If you export the whole database, the result is that *all* your folders will be in a top-level folder. There’s no obvious way to change this later.

Problem: import process hangs

Solution:

  • My KeePass database had a folder structure. As per Tip #2 above, split up your export into different XML files, one per top-level folder. To do this, right click on your folder in KeePass and there’s your option to export
  • The process can still hang, and I scoured the XML file for possible issues, however I learned after much trial and error that the hanging was random and not related to strange characters. Delete the folder that may or may not have been imported into LastPass by right-clicking on the folder in the web interface. Again – don’t attempt this in any other browser than Firefox, results are highly unreliable in Chrome! Then simply re-attempt to import. For me at least, it worked on the second or third try.

Problem: Items are imported as note ITEMS, not website ITEMS

I used KeePass to store credentials for websites, banking, etc., as well as other personal info like driver’s licence info etc.

LastPass stores items as different object types. Anything you import that had something in the URL field in KeePass will be stored into a website item. Anything else will become a “Secure Note” of type “General”.

So if you’re like me and didn’t really bother putting anything in the URL field in some / many / all of your entries in KeePass, you’ll need to do the following.

Screenshots

What you need to do is edit your XML file before importing to give the URL field some value. I gave mine this: http:/0 as if you accidentally attempt to launch the website we don’t want LastPass attempting to send your credentials to a website that actually exists like www.null.com (yes, it exists…)

To do the above, using Sublime Text Editor:

  • Remove leading whitespace from the XML file, otherwise the following step won’t work. Press Ctrl-H to find and replace, click the Regex button, and use this string ^[^\S\r\n]+ and make sure nothing is typed into the replace box. Replace all to remove leading spaces / tabs
  • You now want to find and replace all instances of the URL field where it’s blank, but not where it’s not. Find multiline string

<Key>URL</Key>
<Value />

with

<Key>URL</Key>
<Value>http://0</Value>

Use Ctrl-Enter to split the lines in the find and replace fields.

Now hit Replace, save the file, and try the import. This time you should notice the icon next to all items is not the purple pen (secure note), but the white box (website).


Posted

in

by

Tags:

Comments

22 responses to “My KeePass to LastPass Migration Woes!”

  1. Dan avatar
    Dan

    Huge thanks for the fix for importing items as notes. That was a large roadblock to successful migration!

  2. Julio avatar
    Julio

    Great article! Thank you. I was very close to abandoning the move to LastPass.

  3. Bruce Schena avatar
    Bruce Schena

    Having trouble (I’m not a Sublime pro) with “Find multiline string” URL replacement step – how do I do that? Is there actually a “multiline replace” function in Sublime? I don’t see it…a bit more detail on that would be helpful! Thanks!

  4. Jonas avatar
    Jonas

    As with Dan, thanks for the extremely helpful tips to avoid an import as a note!

  5. Jonathan Medd avatar

    This was really helpful – thanks!

  6. Tapio avatar
    Tapio

    Thank you so much!

  7. Jon avatar
    Jon

    Just another thank-you for posting this info!

  8. Dave avatar
    Dave

    Thanks for doing this investigation, and for posting about it.

    Is this still the state of the art?

  9. VB avatar
    VB

    Just googled my problem and found here a solution.
    Thank you random blogger that solved yet another problem of mine 😉

  10. Renato avatar
    Renato

    Thanks a lot for the URL tip! It was driving me crazy!
    Cheers!

  11. marcel avatar
    marcel

    Awesome! Thanks for that! Well done

  12. Rodrigo avatar
    Rodrigo

    Thank you! Very good workaround for this silly issue to import keepass data, also liked that regex, well done!!

  13. Kurt Smith avatar
    Kurt Smith

    Thank the google I found you!
    You saved me hours of agony!

  14. Petr 'PePa' Pavel avatar

    Just wanted to mention that LastPass now supports KeePass folders and I was able to process 1259 passwords in a single export.

    Also, it’s possible to replace empty urls without getting rid of the white space first.
    Open the xml file and directly use this regular expression in Sublime:
    Find: URL(\s+)
    Replace: URL$1http://0
    This deals with various indentation levels (the white space that Mat was removing).

  15. Petr 'PePa' Pavel avatar

    Eech, all tags have been removed 🙁 Let me try again.

    Just wanted to mention that LastPass now supports KeePass folders and I was able to process 1259 passwords in a single export.

    Also, it’s possible to replace empty urls without getting rid of the white space first.
    Open the xml file and directly use this regular expression in Sublime:
    Find: <Key>URL</Key>(\s+)<Value />
    Replace: <Key>URL</Key>$1<Value>http://0</Value&gt;
    This deals with various indentation levels (the white space that Mat was removing).

  16. gadfly1974 avatar
    gadfly1974

    Thank you! This is exactly what I needed.

    Exporting folder by folder and using Firefox was perfect!

  17. […] password managers and don’t like it? A: Try a different one! (Import from LastPass to KeePass/Import from KeePass to LastPass, although if you have a very small number of passwords it might be easier to just install the […]

  18. Giles Levy avatar
    Giles Levy

    Only thing different for me was using \r\n for line break in Visual Studio.
    Otherwise, followed your directions and everything worked great – thank you!
    (Tried to do this last year without your help and gave up.)

  19. Kent Richardson avatar
    Kent Richardson

    Highly recommend you go into your KeePass database maintenance and choose to delete all history one or more days old. I had MANY entries in KeePass with references in the History tab. What it does it copy every one of them into the Notes field in LastPass. I though it was dupe info, but it was the history. And, the one of the bottom is the current record. Fortunately, figured this out in my export of my smaller folders before I did my big websites folder.

  20. Boyd P avatar
    Boyd P

    Thank you!! This is amazingly still an accurate way to do this, 4 years later. Seriously, you would think LastPass had a better way of importing. The mind reels.

  21. Brian avatar
    Brian

    Helped a friend migrate from KeePass to LastPass recently. Import worked fine, but we found that all HISTORY from KeePass entries is imported in the notes field. Not a huge deal, but annoying to find a bunch of old junk in your password entries. Just a word of caution to others migrating. I’ve been unable to find a solution or workaround, so he’s just going with it for now and cleaning up old entries as he has time.

  22. RJ avatar
    RJ

    Wow, it’s concerning that all these issues are still relevant five years later. Another problem when importing from KeePass (even with this these workarounds) is that my KeePass notes for a given entry sometimes end up duplicated in LastPass. I could manually delete the duplications, but all of this has convinced me that I don’t trust LastPass with my sensistive data. Checking out other password managers instead.

Leave a Reply

Your email address will not be published. Required fields are marked *