Sync fails with offlineimap-7.1.0

Andreas Fink finkandreas at web.de
Tue May 2 09:11:18 BST 2017


On Tue, 2 May 2017 09:22:23 +0200
Nicolas Sebrecht <nicolas.s-dev at laposte.net> wrote:

> On Tue, May 02, 2017 at 07:48:18AM +0200, Andreas Fink wrote:
> 
> > > > OfflineIMAP 7.1.0
> > > >   Licensed under the GNU GPL v2 or any later version (with an
> > > > OpenSSL exception) *** Processing account gmail    
> > > > Establishing connection to imap.googlemail.com:993
> > > > (gmailremote) XOAUTH2 authentication failed: AUTHENTICATE
> > > > command error: BAD ['Client aborted AUTHENTICATE command.
> > > > r7mb353432922edb']. Data: LPNC2 AUTHENTICATE XOAUTH2
> > > > 
> > > > PLAIN authentication failed: [AUTHENTICATIONFAILED] Invalid
> > > > credentials (Failure) LOGIN authentication failed:
> > > > [AUTHENTICATIONFAILED] Invalid credentials (Failure) ERROR: All
> > > > authentication types failed: XOAUTH2: AUTHENTICATE command
> > > > error: BAD ['Client aborted AUTHENTICATE command.
> > > > r7mb353432922edb']. Data: LPNC2 AUTHENTICATE XOAUTH2
> > > > 
> > > >         PLAIN: [AUTHENTICATIONFAILED] Invalid credentials
> > > > (Failure) LOGIN: [AUTHENTICATIONFAILED] Invalid credentials
> > > > (Failure) *** Finished account 'gmail' in 0:01
> > > > ERROR: Exceptions occurred during the run!
> > > > ERROR: All authentication types failed:
> > > >         XOAUTH2: AUTHENTICATE command error: BAD ['Client
> > > > aborted AUTHENTICATE command. r7mb353432922edb']. Data: LPNC2
> > > > AUTHENTICATE XOAUTH2
> > > > 
> > > >         PLAIN: [AUTHENTICATIONFAILED] Invalid credentials
> > > > (Failure) LOGIN: [AUTHENTICATIONFAILED] Invalid credentials
> > > > (Failure)    
> 
> > No I get the exact same exception message now with 7.0.14 and
> > python2 as with 7.1.0.  
> 
> No surprise, here. There are very few changes between both.
> 
> >                                                                                      My
> > offlineimaprc is attached. My setup is local dovecot imap syncing
> > with remote gmail imap. get_username and get_password get the
> > credentials from gnome-keyring...  
> 
> Thanks.
> 
> I've made a change in current 'next' branch for users not using
> XOAUTH2. Could you try it, please?
> 
> 

The error message did not change a lot. I get with python2:
OfflineIMAP 7.1.0
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
imaplib2 v2.57 (bundled), Python v2.7.13
Debug mode: Forcing to singlethreaded.
Now debugging for imap: IMAP protocol debugging
Now debugging for : Other offlineimap related sync messages
[imap]: Using authentication mechanisms ['GSSAPI', 'XOAUTH2', 'CRAM-MD5', 'PLAIN', 'LOGIN']
[imap]: Using authentication mechanisms ['GSSAPI', 'XOAUTH2', 'CRAM-MD5', 'PLAIN', 'LOGIN']
The 'sep' setting is being ignored for IMAP repository 'gmaillocal' (it's autodetected)
*** Processing account gmail
Establishing connection to imap.googlemail.com:993 (gmailremote)
[imap]: gmailremote: level 'tls_compat', version 'None'
[imap]: Attempting XOAUTH2 authentication
[imap]: Attempting PLAIN authentication
[imap]: __plainhandler: returning andreas.fink85(passwd hidden for log)
PLAIN authentication failed: [AUTHENTICATIONFAILED] Invalid credentials (Failure)
[imap]: Attempting LOGIN authentication
[imap]: Attempting IMAP LOGIN authentication
LOGIN authentication failed: [AUTHENTICATIONFAILED] Invalid credentials (Failure)
ERROR: All authentication types failed:
        PLAIN: [AUTHENTICATIONFAILED] Invalid credentials (Failure)
        LOGIN: [AUTHENTICATIONFAILED] Invalid credentials (Failure)
['  File "/home/andreas/coding/offlineimap/offlineimap/accounts.py", line 281, in syncrunner\n    self.__sync()\n', '  File "/home/andreas/coding/offlineimap/offlineimap/accounts.py", line 344, in __sync\n    remoterepos.getfolders()\n', '  File "/home/andreas/coding/offlineimap/offlineimap/repository/IMAP.py", line 452, in getfolders\n    imapobj = self.imapserver.acquireconnection()\n', '  File "/home/andreas/coding/offlineimap/offlineimap/imapserver.py", line 558, in acquireconnection\n    self.__authn_helper(imapobj)\n', '  File "/home/andreas/coding/offlineimap/offlineimap/imapserver.py", line 431, in __authn_helper\n    "failed:\\n\\t%s"% msg, OfflineImapError.ERROR.REPO)\n']
*** Finished account 'gmail' in 0:01
ERROR: Exceptions occurred during the run!
ERROR: All authentication types failed:
        PLAIN: [AUTHENTICATIONFAILED] Invalid credentials (Failure)
        LOGIN: [AUTHENTICATIONFAILED] Invalid credentials (Failure)

Traceback:
  File "/home/andreas/coding/offlineimap/offlineimap/accounts.py", line 281, in syncrunner
    self.__sync()
  File "/home/andreas/coding/offlineimap/offlineimap/accounts.py", line 344, in __sync
    remoterepos.getfolders()
  File "/home/andreas/coding/offlineimap/offlineimap/repository/IMAP.py", line 452, in getfolders
    imapobj = self.imapserver.acquireconnection()
  File "/home/andreas/coding/offlineimap/offlineimap/imapserver.py", line 558, in acquireconnection
    self.__authn_helper(imapobj)
  File "/home/andreas/coding/offlineimap/offlineimap/imapserver.py", line 431, in __authn_helper
    "failed:\n\t%s"% msg, OfflineImapError.ERROR.REPO)

It seems as if my password is not saved correctly, but I have double
checked the get_username/get_password within the offlineimap-helper.py
file, and they can be correctly be received with python2 and python3. I
checked my gmail account settings if "unsafe" apps are allowed, which
is also set to true...

Output of git status:
On branch next
Your branch is up-to-date with 'origin/next'.
nothing to commit, working tree clean


Some more things that I have checked now: You were right, I was using
python2 before. I always logged the offlineimap runs to a file, the
last successful run was:
2017-05-01 08:26:30 INFO: OfflineImap 7.0.14 starting...
  Python: 2.7.13 Platform: linux2
  Args: /usr/bin/offlineimap -o -l /home/andreas/.offlineimap/logfile -f INBOX
2017-05-01 08:26:30 INFO: The 'sep' setting is being ignored for IMAP repository 'gmaillocal' (it's autodetected)
2017-05-01 08:26:30 INFO: *** Processing account gmail
2017-05-01 08:26:30 INFO: Establishing connection to imap.googlemail.com:993 (gmailremote)
2017-05-01 08:26:30 WARNING: XOAUTH2 authentication failed: AUTHENTICATE command error: BAD ['Client aborted AUTHENTICATE command. n6mb331100127edd']. Data: HDFK2 AUTHENTICATE XOAUTH2

2017-05-01 08:26:31 INFO: Establishing connection to localhost:993 (gmaillocal)
2017-05-01 08:26:32 INFO: Syncing INBOX: Gmail -> MappedIMAP
2017-05-01 08:26:33 INFO: *** Finished account 'gmail' in 0:02


Just half an hour later (after the update) it was running with python3
and I got the errors. Strangely it is not running with python2 now
either. I'm pretty clueless what's going on here??
Thanks for the help so far and any further ideas are very welcome ;)




More information about the OfflineIMAP-project mailing list