Menu

Error syncing on linux

2014-07-06
2020-04-19
1 2 3 > >> (Page 1 of 3)
  • Jérôme De Greef

    Hi,
    I use the latest version of both Keepass and KeepassGoogleSync from a usb key.
    Everything's ok on windows but when I try to sync on linux (ubuntu 14.04) I get a "An exception was thrown by the type initializer for DotNetOpenAuth.Logger"
    I have latest version of mono fully installed as well as mono-dmcs.

    Any idea ?

    Thanks in advance,
    Jérôme

     
    • Marc BOUVIER

      Marc BOUVIER - 2018-08-22

      Hi!

      I got it working on Ubuntu 18.4
      https://marc-bouvier.github.io/2018/08/22/using-keepass2-on-ubuntu-18-4/

      • Prerequisite : having already create a kdbx database and synced it google drive from Windows 10
      • First install keepass 2
      • Then download the latest version of Google Sync plugin
      • Extraxt and copy GoogleSyncPlugin.plgx to /usr/lib/keepass2 side by side with Keepass.exe
      • Download log4net from https://logging.apache.org/log4net/download_log4net.cgi
      • Extract and copy path_to_extracted_archive/log4net-2.0.8/bin/mono/4.0/release/log4net.dll to /usr/lib/keepass2 side by side with Keepass.exe
      • On windows 10 get System.ServiceModel.Web.dll from C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.ServiceModel.Web.dll.
      • Copy System.ServiceModel.Web.dll to /usr/lib/keepass2 side by side with Keepass.exe
      • You can now run keepass2 and sync with google drive!
       
      👍
      1
      • juan martin

        juan martin - 2020-04-16

        hi,
        Can you explain me a little bit how can i get installed log4net in linux mint?
        I'm not a programmer and i'm stucked.
        I could install Nuget, but i can't make it install log4net. Also no tutorials online because if you use nuget it's supposed you're kind of an expert...well i'm not.
        Thanks

         
  • Adrian Fiergolski

    Hi Jérôme,
    Did you find solution for this error ?

    Thanks,
    Adrian

     
  • Danyal

    Danyal - 2014-10-15

    I myself have no experience with using mono on Linux distros and this plugin was only developed for Windows with .NET 4 framework.

    So, does windows version of KeePass work fine in mono? If so, I will try to look into why my plugin requires .NET 4.

     
  • Fred Welland

    Fred Welland - 2014-11-03

    No solution -- but this is what i found

    --I am on Fedora20x64.
    --KeePass works ok.
    --Gsynch gets the same dot net auth logger error
    --log4net seems to be used somewhere and that wasn't installed for me
    --I put the log4net dll in my dir where keepass was installed...
    that error is gone....
    --but...libgluezilla seems to be used for open browser and maybe get the 'ok to access google from this app' form.
    --libgluezilla seems like dead wood, but still laying around if you search hard enough.
    --I found a 64bit rpm for OpenSuse --- seemed to install
    --but KP doing a google sync operation crashes hard...
    --this crash isn't because something missing...

    So the libgluezilla really isn't meant for my rig -- so that could be it....only way I'd really know is by building from sources to make a libglue that at least is 'matching' my OS....if still crashy..maybe end of line...not sure I will take time to build from sources.....

    shoveled enough time on this....

     
    • Uranium235

      Uranium235 - 2014-11-03

      I have tried with Plugin v2.0 and a working configuration. Unfortunately I only get: "Web request to 'https://accounts.google.com/o/oauth/token' failed."

      I am not sure why. It could be that the http client used by google is not working at all or that it is a certificate (https) problem.

      I will try and extract some more debug information when I have some more time...

      But hey, at least it didn't crash ;)

       
  • Uranium235

    Uranium235 - 2014-11-03

    Is that with the new Plugin Version 2.0?
    Yes, some google dlls net log4net. That dll is not included because it works fine on windows without that library. The version that comes with the included Google dlls is here
    Try configuring and initially syncing the database with a windows machine then copy the database (and KeePass config) to Linux. Once initial setup is done, the Plugin does not open the internal Browser anymore. That is only needed once to get authorization. Maybe that helps.

     

    Last edit: Uranium235 2014-11-03
  • Uranium235

    Uranium235 - 2014-11-05

    I tried using the most up to date Google API DLLs that use different http clients. Unfortunately that only makes things worse, as mono does not support async programming required by the non-beta Google SDK yet.

     
  • Kenneth Jernigan

    I'm attempting to use the Google Drive Sync on Linux and I feel like i'm getting somewhere, but I've hit a roadblock. I have an Archlinux installation with mono 3.10. I installed mono-tools and log4net. I then sym-linked the log4net.dll file to the root of Keepass (/usr/share/keepass/). This fixed the logger error. However, I'm now getting this error "Could not load type 'System.Runtime.Serialization.Json.JsonReaderWriterFactory' from assembly 'DotNetOpenAuth'". Anyone have ideas of where to look to fix this?

     
    • Uranium235

      Uranium235 - 2014-12-05

      At what stage do you get that error?
      When loading the Plugin at KeePass statup or when trying to sync?
      Do you use the compiled plugin or the plgx format?
      Did you use the log4net.dll I linked above?

      Also see my next post:

       
  • Uranium235

    Uranium235 - 2014-12-05

    Got The Plugin working with Linux and Mono!

    My suspicion was right. The problem was that Mono does not install any root certificates by default. I tried manually importing certificates until I got it working. Long story short, the easiest way is to import the mozilla root certificates into Mono.

    I used:
    Ubuntu 12.04 LTS
    Mono 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.2)

    Here's what I did to get it working:

    • Put the GoogleSyncPlugin.plgx into the KeePass folder (where the KeePass.exe is)
    • Prepare a KeePass database on a Windows machine. The database needs to have been synced (or uploaded) at least once so that the authentication process is complete
    • Install mono: $ sudo apt-get install mono-complete
    • Downloaded the archive with the log4net.dll here
    • Copy the log4net.dll inside the Lib\ThirdParty\ folder of that archive into the KeePass folder
    • Import the mozilla root certificates into mono: $ mozroots --import --sync
    • Start KeePass with mono: $ mono KeePass.exe
    • Open the previously prepared database
    • Go to Tools > Google Sync Plugin > Configuration and select the correct Google Account

    The Plugin should now work.

    You need to prepare the database on a Windows machine, as the authentication process with the native browser window does not work with linux and mono.

     

    Related

    Support: Getting Started
    Support: GoogleSyncPlugin-2.1.0

    • Tamer Ziady

      Tamer Ziady - 2015-04-26

      Thank you very much for this information. I tried it and have been unable to sync with the DB on my Google drive. I have attached the error that I am getting. This occurs whether or not running mono; so my assumption is something else is wrong. Can you please help me to trouble shoot this problem?

      Thanks in advance,
      Your article was very helpful and useful.

      T

       
      • Uranium235

        Uranium235 - 2015-04-27

        By "not running mono", do you mean that you get the same error with Windows? Or did you mean that you have registered the .exe as a non-native binary and simply call the .exe from the shell. In that case mono is automatically invoked.

        Anyway, looks like you are missing the log4net.dll inside your KeePass folder. That solved that error for me.

        Have a look at the bullet points #4 and #5 in my post above.

         
    • dregad

      dregad - 2015-12-01

      Hi,

      I tried the above steps, but it's not working - I'm getting the following error message.

      Google Sync Plugin
      Could not load type 'System.Runtime.Serialization.Json.JsonReaderWriterFactory' from assembly 'DotNetOpenAuth'.
      

      Running Mono with --debug gives the following output just before the above error message is displayed:

      Missing method CreateJsonReader in assembly /home/dregad/.local/share/KeePass/PluginCache/i9bFr4M1G5PTUeIFYZag/DotNetOpenAuth.dll, type System.Runtime.Serialization.Json.JsonReaderWriterFactory
      

      This is on Ubuntu 15.04 with
      Keepass 2.28,
      KPGoogleSync 2.1.2,
      * Mono 3.2.8 (Debian 3.2.8+dfsg-4ubuntu4)

      Any ideas ?

       
      • Uranium235

        Uranium235 - 2015-12-04

        The suggestions in this post didn't help?

         
    • Heiko Lechner

      Heiko Lechner - 2017-10-13

      That didn't work for for me (debian testing). I'm still getting the oauth token failed😕
      I'm running keepass on wine now

       
  • Mizo

    Mizo - 2014-12-31

    but Now when The Plugin Finishes KeePass Crashes

     

    Last edit: Mizo 2014-12-31
    • Uranium235

      Uranium235 - 2015-01-06

      That is unfortunate. I did not experience that.
      Try opening KeePass from the shell with the --debug parameter:

      $ mono --debug KeePass.exe

      Is there anything indicating the cause of the crash?

       
      • Kenneth Jernigan

        I've managed to get this to work. On ArchLinux with Mono 3.12.0, I was required to copy System.ServiceModel.Web.dll from /usr/lib/mono/gac/System.ServiceModel.Web/3.5.0.0__31bf3856ad364e35/ tot /usr/local/keepass/

        Once i did this, I got the same response as Mizo. Running the --debug option, the output seems quite unhelpful:

        SendMessage (0, 0x1204, 0x4, 0x7ffffd2e05f0)
        Stacktrace:
        
        Native stacktrace:
        
            /usr/lib/libmonosgen-2.0.so.1(+0xd6092) [0x7f444311e092]
            /usr/lib/libmonosgen-2.0.so.1(+0x1324bb) [0x7f444317a4bb]
            /usr/lib/libmonosgen-2.0.so.1(+0x3fc43) [0x7f4443087c43]
            /usr/lib/libpthread.so.0(+0x10210) [0x7f4442e38210]
        
        Debug info from gdb:
        
        =================================================================
        Got a SIGSEGV while executing native code. This usually indicates
        a fatal error in the mono runtime or one of the native libraries 
        used by your application.
        =================================================================
        

        Doing a bit of research, it looks like aggressive garbage collection on in-use variables. A quick look at the code and I don't see any culprits. I tried downgrading to mono 3.2.8, and I observe the same behavior.

         
  • Kenneth Jernigan

    I posted this response once, but it doesn't show up. I'm almost using this plugin in ArchLinux with Mono 3.12.8. I did have to link/move System.ServiceModel.Web.dll from /usr/lib/mono/gac/System.ServiceModel.Web/3.5.0.0__31bf3856ad364e35/ to the keepass folder to get past my previous error. After that, all other steps seem to work until following a save, there's a crash.

    Running with mono --debug shows:

    Stacktrace:
    
    Native stacktrace:
    
        /usr/lib/libmonosgen-2.0.so.1(+0xcf1da) [0x7f498387f1da]
        /usr/lib/libmonosgen-2.0.so.1(+0x12cd7b) [0x7f49838dcd7b]
        /usr/lib/libmonosgen-2.0.so.1(+0x48016) [0x7f49837f8016]
        /usr/lib/libpthread.so.0(+0x10210) [0x7f49835a0210]
    
    Debug info from gdb:
    
    =================================================================
    Got a SIGSEGV while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries 
    used by your application.
    =================================================================
    
    Aborted (core dumped)
    

    Looks like an unhandled exception to me....

     
  • Uranium235

    Uranium235 - 2015-01-25

    Yes, this looks like a serious problem. SIGSEGV means some native code is trying to access memory it shouldn't.
    Unfortunately I have not enough experience with mono to have any idea what the problem could be.

    Does the save work? I mean does it crash after it successfully uploaded or before even trying to upload?

    I also do not have the environment you have to try and narrow down the issue.

    Have you tried using a different version of mono? Maybe a version of the 2.x family helps.

    Next I would try a poor man's debugging attempt by inserting popup messages at various points in the Plugin's code to pinpoint the location of the error.

    It may very well be that the problem is inside one of the 3rd party dlls - either Google or Log4Net. In fact, that is where I would put my money. Unfortunately using more up to date versions of the Google SDK is not an option either (no async support in mono).

    It looks like chances are good, that there is no fix possible at this time, unfortunately.

    My best guess at a solution attempt right now would be to try a different version of mono.

     

    Last edit: Uranium235 2015-01-25
  • Kenneth Jernigan

    I'm able to get it work work if I remove the "try-catch" inside the "finally" command of the function syncWithGoogle. I used the poors man debugging to identify that I was getting a crash at the end of the finally block. Patch attached if you wish to see my changes. Not sure the purpose of this particular try/catch, but I'm now living happily without it....

     
    • Uranium235

      Uranium235 - 2015-02-01

      Great work!

      I am responsible for that particular piece of code.

      The UpdateUI statement refreshes the main window and updates where the focus is.
      Initially the plugin always reset the focus to the root group, probably to not have an issue where after a sync the previously selected entry/group was deleted by the sync. I removed that and let KeePass deal with that issue.

      But I only tested the new method with the most recent version and even looked at the KeePass code to see if it is even possible to throw an exception in case the previously selected item is not present anymore. I found that KeePass handles that by itself and does not throw an exception. But I couldn't be 100% sure if that was the case for past KeePass versions, hence I put the old UpdateUI statement inside the catch block.

      It is weird that the client crashes because of that though. That should not have happened in this case. The interesting thing is, that you only removed the fallback to the old method, but the new method seems to work just fine. If that is the case, code execution inside the catch-block should have never occurred. So from a theoretical point of view, your patch should not make any difference.

      Yet it does...

      Maybe it's the construct of a try-catch inside a finally block?

      Could you try just commenting out the line inside the catch-block but letting the try-catch itself be? If it crashes again, I think that is a bug with mono. If it doesn't, I am at a loss...

      Anyway, I think it's safe to remove the old update method. That piece of code was probably being overly cautious anyway.

       

      Last edit: Uranium235 2015-02-01
      • Kenneth Jernigan

        Simply commenting out the command to UpdateUI inside the catch didn't fix the issue.. So I moved the try-catch inside the finally block to outside the finally block (up one function into the OnSyncWithGoogle function). When I did this, the crash went away (I did lose the 'status' variable, so I output just "Done").

        Per a quick search of the Xamarin bug tracker, Mono does exhibit some errors with finally blocks... perhaps this is an example. Perhaps as a workaround, you could refactor the code without a finally block?

         
1 2 3 > >> (Page 1 of 3)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.