Menu

#1755 Current mono package breaks ability to sync db from trigger

KeePass_2.x
closed
5
2021-06-04
2018-07-03
No

Just to let you know the current mono package on linux arch (and probably other variants) is not able to successgully perform the action "Syncronize active database with file/URL" anymore due to unability to save DB. The plain FTP url is used. Tmp file seems to appear indefinitely, the saving status window doesn't close until cancelled. The last mono version that still works is 5.10.1.47-1 (already few months old, sorry for the late report!), the current one is 5.12.0.260-1. Please provide a fix or workaround, thanks!

Discussion

1 2 > >> (Page 1 of 2)
  • Paul

    Paul - 2018-07-04

    Not sure how KeePass can fix a bug introduced by mono.
    Does a straight save to FTP work?
    Manual sync?
    Sync to local via trigger?
    What version of KeePass? Have you updated this recently?

    cheers, Paul

     
  • Anonymous

    Anonymous - 2018-07-04

    Well, there has to be workaround at least. There were several mono versions already after sync stopped.

     

    Last edit: Anonymous 2018-07-05
  • Paul

    Paul - 2018-07-04

    To test where the problem is you need to try to sync manually and locally. Without this we can only guess where the issue might be.

    cheers, Paul

     
  • Anonymous

    Anonymous - 2018-07-04
    1. local manual sync (when both db are in the same dir or different also) works.
    2. manual ftp sync does not, it displays this screen until (and remote ftp leaves db.tmp file) the KP app completely disappears (crash) after a minute or so (mono versions after 5.10.1.47):
     

    Last edit: Anonymous 2018-07-04
  • Paul

    Paul - 2018-07-05

    This implies a problem with saving to the FTP server. Can you do a manual save?
    Does your FTP server allow multiple connections from a single client?
    Try turning off "File Transactions". Tools > Options > Advanced > File input /output connections.

    cheers, Paul

     

    Last edit: Paul 2018-07-05
  • Anonymous

    Anonymous - 2018-07-05

    No, SaveAs to URL... via the same FTP has the same failure: it creates .tmp file of similar size, then showing the status in the pic below, then app crashes/disappears after timeout.

    Never had problems with file managers on diff OSes with that FTP, I think it supports multiple connects from the same app, but can't say 100% sure. But it works as expected with older mono packages, so I don't see the relation.

    Turning File Transactions OFF makes a remote file without .tmp extension, otherwise the status is the same and timeout + crash happens the same way.

     

    Last edit: Anonymous 2018-07-05
  • Paul

    Paul - 2018-07-05

    As the FTP server works with a client it would appear to be a problem with either mono or KeePass 2.39.1. Can you try a manual save with an older version of KeePass? (Use a portable version to save installing.)
    If it is mono you may have to resort to using a script to download the remote version, sync locally, then upload. :(

    cheers, Paul

     
  • Anonymous

    Anonymous - 2018-07-05

    @Dominik Reichl
    I don't think the Paul's suggestion is the adequate answer to the issue. Basically, it is your responsibility to check what causes the KeePass crash. I provided you even FTP server logs, and also version numbers of mono. Obviously, the app can't handle some new changes introduced by updated mono and crashes. I have no idea how to fix your app while you guys even don't want to test it at your site and either locate and fix the issue or prove it's working alright!

     

    Last edit: Anonymous 2018-07-05
  • Paul

    Paul - 2018-07-05

    KeePass is written for Windows. Dominik does his best to work around mono issues, but he can't fix them all. (Very good service from a free app IMO.)

    cheers, Paul

     
  • Dominik Reichl

    Dominik Reichl - 2018-07-05
    • status: open --> closed
    • Priority: 8 --> 5
     
  • Dominik Reichl

    Dominik Reichl - 2018-07-05

    Mono apparently changed something in its FTP implementation and now it's incompatible with your server. The FTP implementation is basically a black box for KeePass: KeePass simply requests to download/upload a file and all the details (connecting to the server, issuing FTP commands, transferring the data, etc.) are handled by Mono. Thus, I don't see how a workaround could look like (except including a different FTP implementation, but that isn't really reasonable); the issue should be fixed in Mono.

    Until the Mono developers fix it, my suggestion would be to use a different protocol. For example, the SftpSync plugin adds support for SFTP and SCP (and should also work on Linux).
    https://keepass.info/plugins.html#sftpsync

    Best regards,
    Dominik

     
  • Lorenzo Stanco

    Lorenzo Stanco - 2019-10-21

    Same exact issue here on a freshly installed Xubuntu 19.10 and KeePass 2.43.

    While syncing, the tmp file is created on the FTP server, but the the interface hangs and the sync is not completed by replacing the tmp file with the real one. If there's something I can do to provide more info for fixes / workaround, I'd be happy to help. In the meantime I'll try disabling File Transactions, using Wine instead of Mono, or rewriting the trigger to download, sync locally and re-upload with an external command.

    Also, strangely, while KeePass is "locked" during syncronization, my entire system UI (XFCE) is unresponsive, I have to force kill KeePass with a terminal session to be able my desktop environment again. This happened also before updating to 19.10, but when KeePass finished syncing successfully, system got "unlocked" again.

     

    Last edit: Lorenzo Stanco 2019-10-21
  • Paul

    Paul - 2019-10-21

    Let us know how you go with a copy/sync/copy script. It might be useful for others here.

    cheers, Paul

     
  • Lorenzo Stanco

    Lorenzo Stanco - 2019-10-21

    Sure, I think I did it with a 3-actions trigger using only "curl" as an external command (which is well-known and available everywhere):

    1. Execute command line / URL for downloading the remote file in the temporary folder, with curl as File/URL, "ftp://HOST/PATH/{DB_NAME}" -o "/tmp/{DB_NAME}" --user USER:PWD as Arguments, and Wait for exit enabled.
    2. Synchronize active database with a file/URL for syncing it, with /tmp/{DB_NAME} as File/URL.
    3. Execute command line / URL again for uploading the synced file, with curl as File/URL, -T "/tmp/{DB_NAME}" "ftp://HOST/PATH/{DB_NAME}" --user USER:PWD as Arguments, and Wait for exit enabled.
    4. Execute command line / URL for deleting the temporary file, with rm and "/tmp/{DB_NAME}".

    Hope this helps!

    PS: Here's the XML for quick pasting from clipboard. The trigger Event must be changed according to preferences, since I used a test toolbar button.

    <?xml version="1.0" encoding="utf-8"?>
    <TriggerCollection xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <Triggers>
            <Trigger>
                <Guid>MhoAZ6jrUUas+6liVsLayg==</Guid>
                <Name>Command-line sync</Name>
                <Events>
                    <Event>
                        <TypeGuid>R0dZkpenQ6K5aB8fwvebkg==</TypeGuid>
                        <Parameters>
                            <Parameter>test</Parameter>
                        </Parameters>
                    </Event>
                </Events>
                <Conditions />
                <Actions>
                    <Action>
                        <TypeGuid>2uX4OwcwTBOe7y66y27kxw==</TypeGuid>
                        <Parameters>
                            <Parameter>curl</Parameter>
                            <Parameter>"ftp://HOST/PATH/{DB_NAME}" -o "/tmp/{DB_NAME}" --user USER:PWD</Parameter>
                            <Parameter>True</Parameter>
                            <Parameter>0</Parameter>
                            <Parameter />
                        </Parameters>
                    </Action>
                    <Action>
                        <TypeGuid>Iq135Bd4Tu2ZtFcdArOtTQ==</TypeGuid>
                        <Parameters>
                            <Parameter>/tmp/{DB_NAME}</Parameter>
                            <Parameter />
                            <Parameter />
                        </Parameters>
                    </Action>
                    <Action>
                        <TypeGuid>2uX4OwcwTBOe7y66y27kxw==</TypeGuid>
                        <Parameters>
                            <Parameter>curl</Parameter>
                            <Parameter>-T "/tmp/{DB_NAME}" "ftp://HOST/PATH/{DB_NAME}" --user USER:PWD</Parameter>
                            <Parameter>True</Parameter>
                            <Parameter>0</Parameter>
                            <Parameter />
                        </Parameters>
                    </Action>
                    <Action>
                        <TypeGuid>2uX4OwcwTBOe7y66y27kxw==</TypeGuid>
                        <Parameters>
                            <Parameter>rm</Parameter>
                            <Parameter>"/tmp/{DB_NAME}"</Parameter>
                            <Parameter>True</Parameter>
                            <Parameter>0</Parameter>
                            <Parameter />
                        </Parameters>
                    </Action>
                </Actions>
            </Trigger>
        </Triggers>
    </TriggerCollection>
    
     
    👍
    2

    Last edit: Lorenzo Stanco 2019-10-21
  • Anonymous

    Anonymous - 2019-11-11

    Great workaround, Lorenzo! I wonder would this fix help to resolve FTP sync?

     
    • Lorenzo Stanco

      Lorenzo Stanco - 2019-11-11

      I think it isn't related, but don't take my words for granted, since I don't know anything about the FTP client implementation in Mono.

       
  • Pietro Marini

    Pietro Marini - 2019-11-16

    Hi Lorenzo, where and how do you apply the "3-actions trigger"? Where do you paste the XML?
    Thanks

     
    • Lorenzo Stanco

      Lorenzo Stanco - 2019-11-16

      Triggers system is accessibile from Tools menu, then Triggers...

      There you can click "Add..." for manually entering events and actions, or you can use the "Tools" button to paste the XML that you previously copied in the clipboard (CTRL+C):

       
  • Pietro Marini

    Pietro Marini - 2019-11-16

    Great, thanks for the quick reply, I ignored their existence.

     
  • Alexander Wessel

    Hi, why has this issue been closed? The problem still exists on my Gentoo (~amd64) install. Do we know if there is a bug in Mono regarding this? Maybe we can get to the base of the problem and report it upstream? I wonder if the FTP rename operation is simply broken in the mono FTP client library? Or maybe it does not allow a rename "onto" an existing file? I. e. from the kdbx.tmp file to the kdbx file. It almost looks like we're waiting for the file rename to unblock, doesn't it?

     
  • Paul

    Paul - 2021-05-30

    This is closed because it can't be fixed in KeePass.
    As far as we can tell mono is the problem. If you can show exactly how it fails in mono you could report the issue to the mono developers.

    Have you tried the SftpSync plug-in?
    Do the triggers work for you?

    cheers, Paul

     
  • Alexandre Da Costa

    Hello Paul
    I tried both: the triggers trick synchronises, but ends with KeePass and all programs with GUI freezing. I have to kill the process in a terminal to free all.
    Regarding the SftpSync, I can't say: the sftp://host/path ends with an error "An exception occurred during a WebClient request. No such file". It is the same URL as the FTP one, but just with 's' in front.
    Regards

     
    • Alexandre Da Costa

      I just add that the mere 'save' freezes all programs the same way.

      Regarding the SftpSync plugin, may be I don't know how to use it? I haven't seen any settings for it.
      (System: LUbuntu on x86_64)

       
  • Paul

    Paul - 2021-06-04

    Maybe the trigger is not correct on your system.
    Are you able to see the triggers in the trigger system after you paste the trigger data?
    Editing triggers in the GUI may not work in mono - we have had that problem reported before. How did you change the trigger to work for your system?
    Can you post the trigger you used so we can test it?

    cheers, Paul

     
    • Alexandre Da Costa

      The trigger does work, since the files are well synchronised by the trigger. The only issue is the freezing at the end.
      I suppose that it is more related to the mono FTP issue whilst the program saves the modifications and synchronises itself. But it occurs after each tie I use the trigger.

       
1 2 > >> (Page 1 of 2)

Log in to post a comment.

MongoDB Logo MongoDB