Dropbox - sync issues

Help
LeO
2014-04-18
2014-04-20
  • LeO
    LeO
    2014-04-18

    I read the history update for 2.26 and there were several sync-issues fixed. I don't know if I run in one of them, but currently I have serve problems with my db. I use Keepass like the following:

    • kdbx-file is located in a Dropbox-folder which gets automatically synced
    • I use on my Android Keepass2Droid to change/add entries

    For the very moment I have 4 different versions of my db mainly due to conflicts. I didn't look too close up till now, but I see now that the different versions have different time stamps AND content :(

    Now I want to cleanup the stuff and make a proper setup to avoid in future similar problems. I looked for plugins but KeeCloud doesn't work and KPDataSave mention its sufficient to have the file located in the Dropbox folder. So, I guess this shouldn't be a problem - although I don't understand why they run into conflict.
    Q1: Any ideas on this point?

    My second task is now to sync the 4 files manually, cause they might contain different data. I thought I could search for time stamp and filter out all which are before/after a certain one and then copy it. But I didn't find a method where to search for the timestamp. Also I don't find a way to copy-paste from one db an entry to another one.
    Q2: What are suggestions to merge different entries into one major db?

     
  • wellread1
    wellread1
    2014-04-18

    Q1 I don't understand why they run into conflict.

    The problem is caused by the fact the Cloud Synchronization services are actually file replication services. These services don't synchronize the internal contents of the files so conflicted copies can occur if simultaneous changes are made at both end nodes.

    Note: For the purposes of this discussion 'simultaneous' means on a time scale shorter than the cloud replication time scale (which could be seconds, or days/weeks for disconnected devices).

    Q2: What are suggestions to merge different entries into one major db?

    Use KeePass synchronization 'Tools>Synchronize>Synchronize with file…' to merge each conflicted copy with your current database. The most recent objects (whole entries) in each of the individual databases will become the current object (whole entry) in the synchronized database. The final result should be a database where each entry corresponds to the last edited version of the entry. Older versions of each entry will be in the entry History up to the configured limits. See File>Database Settings...>Advanced(tab).

    All databases involved in a KeePass synchronization are modified, so if you want to check the synchronization results against the original databases you must make copies of the original databases prior to synchronization.

    Note: If you deleted an entry in one database, it may be deleted in the final database depending on the time stamp of the most recent edit.

    Going forward: Use the Dropbox Synchronization Trigger from the example triggers at http://keepass.info/help/kb/trigger_examples.html#dbsync on every end node where KeePass resides. This will eliminate "loss" of data resulting from edits at these end nodes because the changes are retained in a local database and will eventually synchronize to the cloud even if a conflicted copy occurs.

    I don't believe any Android ports of KeePass implement KeePass synchronization, so edits made at an Android device are subject to being "lost" (i.e. promoted to a conflicted copy). You can minimize this problem by preferentially making edits at sync trigger enabled KeePass end nodes, and by confirming that changes made on the Android device are incorporated into the database after a synchronization at a sync trigger enabled KeePass end node but before saving a database at a KeePass end node. If an edit originating on an Android device still ends up in a conflicted copy, synchronize that conflicted copy using KeePass synchronization.

     
    Last edit: wellread1 2014-04-18
  • steelej
    steelej
    2014-04-18

    I use Keepass2Android rather than keepass2droid so I don't know what difference that makes. Keypass2droid only claims beta support for KeePass version 2 which is why I avoided it.

    I have chosen to make my phone read only to avoid synchronisation issues.

    I use a trigger to sync a local copy of my database on each PC to the cloud copy. Changes replicate to the phone from all my PC devices. It should not matter but I use a different cloud service which is more secure than Dropbox. The principles however are the same

    My cloud copy replicates the file to my phone and I can then access all my entries. Until we have Keepass sync that synchronises at the KeePass key entry level to the phone it would seem to me there will always be a risk of conflicts arising if you allow entries to be made from the phone.

     
  • LeO
    LeO
    2014-04-19

    Hi,

    thx for the long and detailed explanation from both of you.

    @steelej: I have to admit that I am using Keepass2Android use it for data change as well. Up till now I haven't thought about problems, but.... Anyhow, I am curious what 'more secure than Dropbox' you are using. Especially with the focus reg. how they are kept synced?

    @wellread1: Hm', I tried the Files-> Synchronize and it seems like this is working. Although I have no idea how to check. I mean I can do it for those entries I remember, but to be honest I have no clue which I changed the last weeks.
    Q1: Is there a way to filter out e.g. those which are changed within the last 3 weeks?

    I tried to follow the hint with the SyncTrigger and succeeded after some troubles. Just my 2 cents for the description:
    A) There is a severe difference in step 7 between 'Saved database files' and 'Saving database files' - perhaps a little highlight of the difference might help
    B) According to my trigger understanding it might be useful to add a trigger at launch time. I mean, how else would I recognize changes from different computer/devices? So, I would add that event as well between 6 and 7. Although I don't know about the difference between 'Application started and ready' and 'Application initialized' the first option works perfectly.

    Last but not least: I just tested with Keepass2Android and as long I don't update changes in both dbs at the same time it seems like this works nice.

    thx for your help.

     
    • steelej
      steelej
      2014-04-19

      Hi

      I use a cloud service TeamDrive. There is an Android version available - I think all platforms are available.

      I am concerned about the privacy of DropBox and would never use it for any sensitive files. KeePass does encrupt the database file. TeamDrive encrypts the file (and any other file) on your PC or phone before it is sent to TeamDrive using another encryption key unique to the machines I choose to share the data amongst.

      I have other files which as a matter of principle I wish to store away from any prying eyes and to minimise any risk of a request under the USA Patriot Act to release my data. TeamDrive will undertake to store any file on a European server for European based users (like me). DropBox is an American based company and would therefore have to comply with such a request.

      I have been using this cloud service flawlessly with KeePass for some time on several PCs (I previously used SpiderOak but there were occasional stability issues) and have recently added an Android phone. I do not currently allow the phone write access to my TeamDrive folders due to the slight risk of synchronisation conflicts. This access permission is controlled by my administrator access to my TeamDrive account on my PC and this cannot be changed on the phone.

       
  • Paul
    Paul
    2014-04-19

    Sync requires an open database so having a trigger run at start up may not work. You should set the trigger to run after the database you want to sync has been opened, although this may get in the way of your Global Auto-Type, which also opens your database. Ultimately it's up to you to decide how and when to run the sync.

    cheers, Paul

     
  • wellread1
    wellread1
    2014-04-20

    Synchronize and it seems like this is working. Although I have no idea how to check.

    The easiest method to compare a sync'ed database with an original database (an original database is one that didn't participated in your recent syncs, either as the active database or as the target database) is to open independent KeePass Workspaces (instances) side by side, and open an original database in one Workspace and a synchronized database in the other. Display all entries, ungrouped in the Main window and either sort both Workspaces descending by Last Modified Time; or sort the Synchronized database by Last Modified Time and the old database by Title. Compare the entries in the synchronized database with the original database.

    To open two Workspaces with different database.
    Uncheck 'limit to single instance' in 'Tools>Options>Advanced(tab)>Start and Exit(section)'. Then start a second instance of KeePass.

    To display all entries, ungrouped in the Main Window
    Set 'View>Grouping in Entry List' to OFF
    Check 'View>Show Entries in Subgroups'
    Select the Top Group in the Group pane.

    To view Last Modified Time and sort all entries
    Select View>Configure Columns... and Check Last Modified Time (also uncheck columns that are not needed for comparison so that each view is reasonably uncluttered); unhide username and password fields to facilitate comparison.
    Click on the column header of the column you want to sort until the appropirate sort order is indicated by the little triangle in the header. There are three sort orders: Ascending, Descending, and No Sort.

    it might be useful to add a trigger at launch time.

    You can tune your triggers to other Events to match your preferences. You can change the Event that triggers the synchronization to an "Opened database file" or "Closing database file before Saving". If you retain the original trigger linked to "Saved Database File" you will also need to change the Action argument 'Change trigger on/off state' in the new trigger(s) to disable the original trigger while each new trigger executes, then re-enable the original trigger. Otherwise synchronization will occur twice, once triggered by the Open or Close Events and once triggered by the "Saved database file" trigger. The later is triggered because a synchronization also includes a database save.

    Use the Tools button at the bottom left corner of the Trigger dialog to duplicate triggers so that you don't have to enter everything again. Select 'Copy Selected Trigger to Clipboard', then Select 'Paste Triggers from Clipboard'.