Troubleshooting KeePass2 Syncing

2024-07-09

These are some troubleshooting steps for broken syncs of KeePass2 with KeePass2Android via Google Drive (Windows).

Symptom Cause Flow Chart

  ---
title: Symptom Cause Flow Chart
config:
    theme: default
---
flowchart TD
baseline(Broken Sync)
pc_client_question{{"Can the Database be opened in Windows?"}}
broken_gdrive_client[Broken Google Drive Client]
android_client_question{{"Does an error pop up appear when opening the database in Android?"}}
mismatched_filename_question{{"Are you opening the same file in both clients?"}}
mismatched_files_diagnosis[Mismatched Files]
local_copy_available_question{{"Does the error state that the local backup copy is loaded?"}}
local_copy_mismatched_question{{"Does the error state that the local copy is mismatched with the remote copy?"}}
local_copy_mismatched_diagnosis["Local Copy on Android differs"]
dunno["🤷"]

baseline --> pc_client_question
pc_client_question -->|No| broken_gdrive_client
pc_client_question -->|Yes| android_client_question
android_client_question -->|No| mismatched_filename_question
mismatched_filename_question -->|No| mismatched_files_diagnosis
android_client_question -->|Yes| local_copy_available_question
local_copy_available_question -->|Yes| local_copy_mismatched_question
local_copy_mismatched_question -->|Yes| local_copy_mismatched_diagnosis
local_copy_available_question -.->|No| dunno
local_copy_mismatched_question -.->|No| dunno
mismatched_filename_question -.->|Yes| dunno

click broken_gdrive_client "#broken-google-drive-client"
click mismatched_files_diagnosis "#mismatched-files"
click local_copy_mismatched_diagnosis "#local-copy-on-android-differs"
click dunno "#synchronize-mismatched-databases"

Fixes

Broken Google Drive Client

Symptoms

  • Database cannot be opened in Windows.
  • No G:/ drive is mounted.

Causes

  • You aren’t logged into Google Drive.
  • Google Drive never updated.

Fixes

Your database could not sync because Google Drive was not active at all. As you could not access the database on the computer, the database is not broken.

  • Log into Google Drive and update the client.
  • Reinstall Google Drive.

Mismatched Files

This problem may seem relatively simple, but it is easy to overlook.

Symptoms

  • Everything seems to appear fine appart from the databases mismataching.
  • Entries are in one database but not in the other and vice versa.
  • Both databases are in Google Drive.

Causes

  • You might have copied or renamed the database but forgot to do so for one of your clients.

Fixes

Have a look at Synchronize Mismatched Databases.

Local Copy on Android differs

Symptoms

  • Error message when entering database warning that database could not be synced.
  • Still able to enter local backup database.

Causes

  • The local copy is loaded when you do not have access to Google Drive (no internet). If you save into the local database it differs from the one in Google Drive and might not be synced anymore.

Fixes

  1. Make a safety copy of said local database via settings > database > export database. You can also ignore this.
  2. Press synchronize database in the Android client after loading the database.

Synchronize Mismatched Databases

Prerequisites

  1. You must have access to both databases.
  2. Repeat after me: I do not bust my database! I, do, not, bust, my, databaseeee

Steps

  1. Export the database from KeePass2Android via settings > database > export database.
  2. Get that database to your PC.
  3. Copy both databases on your PC to safety.
  4. Take the PC database and enter it.
  5. File > Synchronize > Synchronize with File with the database from Android.
  6. Check if this database has both entries!
  7. Check if this database is on Google Drive!
  8. Open the database in Google Drive from the Android application and check if all entries are there.

Troubleshooting

Synchronize with File did not work

Yeahhhhh, try doing it by hand. 😓

Exporting the Database in Android did not work

Yeahhhhh, check if the app has the rights to write to your fs. Try multiple export options.

Synching with Google Drive

Synching with Google Drive between Android and Windows has worked flawlessly for me over the past few years, though there is much to dislike about Google Drive:

  • Create G:/ drive which it needs to mount on boot.
  • Very often very slow on Android.
  • Does not work for Linux at all!

Alternatives

  • MEGA
  • sFTP

Using MEGA also works great and does not cost anything compared to hosting an sFTP server.