matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.79k stars 2.13k forks source link

ValueError: Invalid salt - cannot login after update to 0.22.1 #2345

Closed rubo77 closed 7 years ago

rubo77 commented 7 years ago

After the latest update from 0.19 to 0.22 and then to 0.22.1 some users cannot login to our postgres database any more, some can.

This is the error in homeserver.log:

[2017-07-07 22:29:06,131 - synapse.http.server - 139 - ERROR - POST-212698- Failed handle request synapse.http.server._async_render on <synapse.rest.
ClientRestResource object at 0x7fa6a5fc2550>: <SynapseRequest at 0x7fa674a384d0 method=POST uri=/_matrix/client/r0/login? clientproto=HTTP/1.1 site=
8008>                                                                                                                                               
Traceback (most recent call last):                                                                                                                  
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/synapse/http/server.py", line 116, in wrapped_request_handler                   
    yield request_handler(self, request, request_metrics)                 
 File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 393, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/synapse/http/server.py", line 255, in _async_render
    callback_return = yield callback(request, **kwargs)
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 393, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/synapse/rest/client/v1/login.py", line 140, in on_POST
    result = yield self.do_password_login(login_submission)
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 393, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/synapse/rest/client/v1/login.py", line 221, in do_password_login
    password=login_submission["password"],
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1384, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/twisted/python/failure.py", line 393, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/synapse/handlers/auth.py", line 523, in _check_password
    canonical_user_id = yield self._check_local_password(user_id, password)
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 1386, in _inlineCallbacks
    result = g.send(result)
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/synapse/handlers/auth.py", line 552, in _check_local_password
    result = self.validate_hash(password, password_hash)
  File "/home/irc-bridge/.synapse/local/lib/python2.7/site-packages/synapse/handlers/auth.py", line 654, in validate_hash
    stored_hash.encode('utf8')) == stored_hash
ValueError: Invalid salt
2017-07-07 22:29:06,132 - synapse.access.http.8008 - 91 - INFO - POST-212698- 10.77.77.254 - 8008 - {None} Processed request: 2ms (0ms, 0ms) (1ms/1) 67B 500 "POST /_matrix/client/r0/login? HTTP/1.1" "Mozilla/5.0 (X11; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0" ](url)
rubo77 commented 7 years ago

More info:

I upgraded libgcrypt20:amd64 (1.7.6-2, 1.7.6-2+deb9u1), but that didn't help

these are the versions installed:

rubo77 commented 7 years ago

I watched the homeserver.log for this error during the last two days and no more login 500 errors occur.

I can only create the error if i log n with one of the known two users.

it seems like only those two users on our server have this issue both created on the same computer at timestamp 1456866113 and 1491747697 but a user created in between at timestamp 1456870597 is working fine, so it cannot have anything to do with the version we used the time of user creation (all some time during 0.17.x or 0.18.x)

I'll try to analyse more of the difference between the userdata in the database, using this database structure visualisation to documentation

rubo77 commented 7 years ago

I think I found the error:

all users that cannot login have a password_hash that begins with

$2b$12$.....

all users that still can login start with this instead:

$2a$12$....

So you can fix the error with

psql -q --dbname="synapse" --command="update users set password_hash=replace(password_hash,'\$2b\$','\$2a\$') where password_hash like '\$2b%'"      
rubo77 commented 7 years ago

At first I had not installed py-bcrypt. now I installed it with

pip install py-bcrypt

see:

$ pip freeze|grep bcrypt                                                                                              
bcrypt==3.1.2
py-bcrypt==0.4

maybe that would also have been a solution

richvdh commented 7 years ago

some things worth noting about this problem:

  1. @rubo77 has bcrypt 3.1 installed in his virtualenv; synapse's python_dependencies.py requests py-bcrypt. These packages both provide implementations of the bcrypt module.
  2. The users with problems have password hashes starting $2b$. Those with hashes starting $2a$ do not cause a problem.
  3. $2a$ and $2b$ correspond to different implementations of the bcrypt algorithm. In practice, they are the same, except for long (>72 chars?) passwords.
  4. In my testing, bcrypt 3.1 generated $2b$ hashes, and supported decoding of both formats. py-bcrypt 0.4 only generated and supported $2a$ hashes.

The above explains why @rubo77 has $2b$ hashes in his users table. It does not explain why those users can't log in.

I suspect what has happened is that the virtualenv has got into a confused state and is now actually using the py-bcrypt implementation, rather than the bcrypt implementation, despite the fact that pip freeze reports otherwise.

rubo77 commented 7 years ago

so what would be the fix, if someone else would go into this problem? The manual sais:

pip2.7 install py-bcrypt

so maybe I should uninstall python-bcrypt, but that seems difficult:

apt-get remove python-bcrypt
...
The following packages will be REMOVED:
matrix-synapse python-bcrypt
richvdh commented 7 years ago

The main fix would be not to mix up the debian package and virtualenv. Decide which you want to use and stick with it.

The manual sais:

pip2.7 install py-bcrypt

It only says that under the Arch linux section, as a solution to a specific problem. Don't cut and paste random commands unless you know what you're doing.

maxidorius commented 7 years ago

This also happens under a standard package install without any virtualenv when trying to reset a password using hash_password.

My system: Linux Mint 18.1 (ubuntu 16.04 based) matrix-synapse 0.22.1-1

$ python --version
Python 2.7.12

Any crypt related packages:

$ dpkg -l | grep crypt
ii  cryptsetup                                   2:1.6.6-5ubuntu2                           amd64        disk encryption support - startup scripts
ii  cryptsetup-bin                               2:1.6.6-5ubuntu2                           amd64        disk encryption support - command line tools
ii  duplicity                                    0.7.06-2ubuntu2                            amd64        encrypted bandwidth-efficient backup
ii  ecryptfs-utils                               111-0ubuntu1.1                             amd64        ecryptfs cryptographic filesystem (utilities)
ii  gcr                                          3.18.0-1ubuntu1                            amd64        GNOME crypto services (daemon and tools)
ii  gnupg-agent                                  2.1.11-6ubuntu2                            amd64        GNU privacy guard - cryptographic agent
ii  gskcrypt64                                   8.0-50.66                                  amd64        IBM GSKit Cryptography Runtime
ii  libcrypt-passwdmd5-perl                      1.3-10                                     all          interoperable MD5-based crypt() for perl
ii  libcrypto++9v5                               5.6.1-9                                    amd64        General purpose cryptographic library - shared library
ii  libcryptsetup4:amd64                         2:1.6.6-5ubuntu2                           amd64        disk encryption support - shared library
ii  libecryptfs1                                 111-0ubuntu1.1                             amd64        ecryptfs cryptographic filesystem (library)
ii  libfreerdp-crypto1.1:amd64                   1.1.0~git20140921.1.440916e+dfsg1-5ubuntu1 amd64        Free Remote Desktop Protocol library (freerdp-crypto library)
ii  libgcrypt20:amd64                            1.6.5-2ubuntu0.3                           amd64        LGPL Crypto library - runtime library
ii  libgcrypt20:i386                             1.6.5-2ubuntu0.3                           i386         LGPL Crypto library - runtime library
ii  libhcrypto4-heimdal:amd64                    1.7~git20150920+dfsg-4ubuntu1              amd64        Heimdal Kerberos - crypto library
ii  libhcrypto4-heimdal:i386                     1.7~git20150920+dfsg-4ubuntu1              i386         Heimdal Kerberos - crypto library
ii  libhogweed4:amd64                            3.2-1ubuntu0.16.04.1                       amd64        low level cryptographic library (public-key cryptos)
ii  libhogweed4:i386                             3.2-1ubuntu0.16.04.1                       i386         low level cryptographic library (public-key cryptos)
ii  libk5crypto3:amd64                           1.13.2+dfsg-5ubuntu2                       amd64        MIT Kerberos runtime libraries - Crypto Library
ii  libk5crypto3:i386                            1.13.2+dfsg-5ubuntu2                       i386         MIT Kerberos runtime libraries - Crypto Library
ii  libmhash2:amd64                              0.9.9.9-7                                  amd64        Library for cryptographic hashing and message authentication
ii  libnettle6:amd64                             3.2-1ubuntu0.16.04.1                       amd64        low level cryptographic library (symmetric and one-way cryptos)
ii  libnettle6:i386                              3.2-1ubuntu0.16.04.1                       i386         low level cryptographic library (symmetric and one-way cryptos)
ii  libsodium18:amd64                            1.0.8-5                                    amd64        Network communication, cryptography and signaturing library
ii  libssh-gcrypt-4:amd64                        0.6.3-4.3                                  amd64        tiny C SSH library (gcrypt flavor)
ii  openssl                                      1.0.2g-1ubuntu4.8                          amd64        Secure Sockets Layer toolkit - cryptographic utility
ii  python-bcrypt                                2.0.0-2build1                              amd64        password hashing library for Python
ii  python-crypto                                2.6.1-6ubuntu0.16.04.2                     amd64        cryptographic algorithms and protocols for Python
ii  python-cryptography                          1.3.4-1~bpo8+2                             amd64        Python library exposing cryptographic recipes and primitives (Python 2)
ii  python-ecdsa                                 0.13-2                                     all          ECDSA cryptographic signature library (Python 2)
ii  python3-crypto                               2.6.1-6ubuntu0.16.04.2                     amd64        cryptographic algorithms and protocols for Python 3
ii  python3-cryptography                         1.2.3-1ubuntu0.1                           amd64        Python library exposing cryptographic recipes and primitives (Python 3)

python packages:

$ dpkg -l | grep python
ii  dh-python                                    2.20151103ubuntu1.1                        all          Debian helper tools for packaging Python libraries and applications
ii  libboost-python1.58.0                        1.58.0+dfsg-5ubuntu3.1                     amd64        Boost.Python Library
ii  libpeas-1.0-0-python2loader                  1.16.0-1ubuntu2                            amd64        Application plugin library
ii  libpython-stdlib:amd64                       2.7.11-1                                   amd64        interactive high-level object-oriented language (default python version)
ii  libpython2.7:amd64                           2.7.12-1ubuntu0~16.04.1                    amd64        Shared Python runtime library (version 2.7)
ii  libpython2.7-minimal:amd64                   2.7.12-1ubuntu0~16.04.1                    amd64        Minimal subset of the Python language (version 2.7)
ii  libpython2.7-stdlib:amd64                    2.7.12-1ubuntu0~16.04.1                    amd64        Interactive high-level object-oriented language (standard library, version 2.7)
ii  libpython3-stdlib:amd64                      3.5.1-3                                    amd64        interactive high-level object-oriented language (default python3 version)
ii  libpython3.5:amd64                           3.5.2-2ubuntu0~16.04.1                     amd64        Shared Python runtime library (version 3.5)
ii  libpython3.5-minimal:amd64                   3.5.2-2ubuntu0~16.04.1                     amd64        Minimal subset of the Python language (version 3.5)
ii  libpython3.5-stdlib:amd64                    3.5.2-2ubuntu0~16.04.1                     amd64        Interactive high-level object-oriented language (standard library, version 3.5)
ii  python                                       2.7.11-1                                   amd64        interactive high-level object-oriented language (default version)
ii  python-apt                                   1.1.0~beta1build1                          amd64        Python interface to libapt-pkg
ii  python-apt-common                            1.1.0~beta1build1                          all          Python interface to libapt-pkg (locales)
ii  python-aptdaemon                             1.1.1+bzr982-0ubuntu14                     all          Python 2 module for the server and client of aptdaemon
ii  python-aptdaemon.gtk3widgets                 1.1.1+bzr982-0ubuntu14                     all          Python 2 GTK+ 3 widgets to run an aptdaemon client
ii  python-attr                                  15.2.0-1                                   all          Attributes without boilerplate (Python 2)
ii  python-bcrypt                                2.0.0-2build1                              amd64        password hashing library for Python
ii  python-beautifulsoup                         3.2.1-1                                    all          error-tolerant HTML parser for Python
ii  python-blinker                               1.3.dfsg2-1build1                          all          Fast, simple object-to-object and broadcast signaling library
ii  python-blist                                 1.3.6-4build2                              amd64        List-like type for Python with better asymptotic performance
ii  python-cairo                                 1.8.8-2                                    amd64        Python bindings for the Cairo vector graphics library
ii  python-canonicaljson                         1.0.0-1                                    all          Canonical JSON
ii  python-cffi                                  1.5.2-1ubuntu1                             all          Foreign Function Interface for Python calling C code
ii  python-cffi-backend                          1.5.2-1ubuntu1                             amd64        Foreign Function Interface for Python calling C code - backend
ii  python-chardet                               2.3.0-2                                    all          universal character encoding detector for Python2
ii  python-configglue                            1.1.2-0ubuntu3                             all          Glues together optparse.OptionParser and ConfigParser.ConfigParser
ii  python-configobj                             5.0.6-2                                    all          simple but powerful config file reader and writer for Python 2
ii  python-crypto                                2.6.1-6ubuntu0.16.04.2                     amd64        cryptographic algorithms and protocols for Python
ii  python-cryptography                          1.3.4-1~bpo8+2                             amd64        Python library exposing cryptographic recipes and primitives (Python 2)
ii  python-cups                                  1.9.73-0ubuntu2                            amd64        Python bindings for CUPS
ii  python-daemonize                             2.3.1-1                                    all          enable your code to run as a daemon process - Python 2.x
ii  python-dateutil                              2.4.2-1                                    all          powerful extensions to the standard datetime module
ii  python-dbus                                  1.2.0-3                                    amd64        simple interprocess messaging system (Python interface)
ii  python-dbus-dev                              1.2.0-3                                    all          main loop integration development files for python-dbus
ii  python-debian                                0.1.27ubuntu2                              all          Python modules to work with Debian-related data formats
ii  python-debtagshw                             2.0.1ubuntu6                               all          Match debtags hardware:: tags against the actual hardware
ii  python-decorator                             4.0.6-1                                    all          simplify usage of Python decorators by programmers
ii  python-defer                                 1.0.6-2build1                              all          Small framework for asynchronous programming (Python 2)
ii  python-dirspec                               13.10-1ubuntu1                             all          Python User Folders Specification Library
ii  python-dnspython                             1.12.0-1                                   all          DNS toolkit for Python
ii  python-ecdsa                                 0.13-2                                     all          ECDSA cryptographic signature library (Python 2)
ii  python-enum34                                1.1.2-1                                    all          backport of Python 3.4's enum package
ii  python-feedparser                            5.1.3-3build1                              all          Universal Feed Parser for Python
ii  python-formencode                            1.3.0-0ubuntu5                             all          validation and form generation Python package
ii  python-frozendict                            0.5-1                                      all          immutable dictionary - Python 2.7
ii  python-funcsigs                              0.4-2                                      all          function signatures from PEP362 - Python 2.7
ii  python-functools32                           3.2.3.2-2                                  all          Backport of the functools module from Python 3.2.3 to Python 2.7
ii  python-gconf                                 2.28.1+dfsg-1.1                            amd64        Python bindings for the GConf configuration database system
ii  python-gi                                    3.20.0-0ubuntu1                            amd64        Python 2.x bindings for gobject-introspection libraries
ii  python-gi-cairo                              3.20.0-0ubuntu1                            amd64        Python Cairo bindings for the GObject library
ii  python-glade2                                2.24.0-4ubuntu1                            amd64        GTK+ bindings: Glade support
ii  python-gnomekeyring                          2.32.0+dfsg-3                              amd64        Python bindings for the GNOME keyring library
ii  python-gobject                               3.20.0-0ubuntu1                            all          Python 2.x bindings for GObject - transitional package
ii  python-gobject-2                             2.28.6-12ubuntu1                           amd64        deprecated static Python bindings for the GObject library
ii  python-gtk2                                  2.24.0-4ubuntu1                            amd64        Python bindings for the GTK+ widget set
ii  python-gtksourceview2                        2.10.1-2build1                             amd64        Python bindings for the GtkSourceView widget
ii  python-httplib2                              0.9.1+dfsg-1                               all          comprehensive HTTP client library written for Python
ii  python-idna                                  2.0-3                                      all          Python IDNA2008 (RFC 5891) handling (Python 2)
ii  python-imaging                               3.1.2-0ubuntu1.1                           all          Python Imaging Library compatibility layer
ii  python-ipaddress                             1.0.16-1                                   all          Backport of Python 3 ipaddress module (Python 2)
ii  python-jsonschema                            2.5.1-4                                    all          An(other) implementation of JSON Schema (Draft 3) - Python 2.7
ii  python-jwt                                   1.3.0-1                                    all          Python implementation of JSON Web Token
ii  python-ldb                                   2:1.1.24-1ubuntu3                          amd64        Python bindings for LDB
ii  python-libtorrent                            1.0.7-1build1                              amd64        Python bindings for libtorrent-rasterbar
ii  python-libxml2                               2.9.3+dfsg1-1ubuntu0.2                     amd64        Python bindings for the GNOME XML library
ii  python-lockfile                              1:0.12.2-1                                 all          file locking library for Python — Python 2 library
ii  python-lxml                                  3.5.0-1build1                              amd64        pythonic binding for the libxml2 and libxslt libraries
ii  python-mako                                  1.0.3+ds1-1ubuntu1                         all          fast and lightweight templating for the Python platform
ii  python-markupsafe                            0.23-2build2                               amd64        HTML/XHTML/XML string library for Python
ii  python-memcache                              1.57-1                                     all          pure Python memcached client
ii  python-minimal                               2.7.11-1                                   amd64        minimal subset of the Python language (default version)
ii  python-mock                                  1.3.0-2.1ubuntu1                           all          Mocking and Testing Library
ii  python-msgpack                               0.4.6-1build1                              amd64        Python implementation of MessagePack format
ii  python-nacl                                  1.0.1-1build1                              amd64        Python bindings to libsodium (Python 2)
ii  python-nemo                                  3.0.0+sarah                                amd64        Python binding for Nemo components
ii  python-netaddr                               0.7.18-1                                   all          manipulation of various common network address notations (Python 2)
ii  python-netifaces                             0.10.4-0.1build2                           amd64        portable network interface information - Python 2.x
ii  python-notify                                0.1.1-4                                    amd64        Python bindings for libnotify
ii  python-oauthlib                              1.0.3-1                                    all          generic, spec-compliant implementation of OAuth for Python
ii  python-oneconf                               0.3.9                                      all          synchronize your configuration data over the network (Python 2)
ii  python-openssl                               16.0.0-1~bpo8+1                            all          Python 2 wrapper around the OpenSSL library
ii  python-pam                                   0.4.2-13.2ubuntu2                          amd64        Python interface to the PAM library
ii  python-paramiko                              1.16.0-1                                   all          Make ssh v2 connections with Python (Python 2)
ii  python-parted                                3.10.7-2build1                             amd64        Python interface for libparted
ii  python-paste                                 1.7.5.1-6ubuntu3                           all          tools for using a Web Server Gateway Interface stack
ii  python-pbr                                   1.8.0-4ubuntu1                             all          inject useful and sensible default behaviors into setuptools - Python 2.x
ii  python-pexpect                               4.0.1-1                                    all          Python module for automating interactive applications
ii  python-phonenumbers                          8.4.0~matrix~jessie1                       all          Python port of Google libphonenumber
ii  python-pil:amd64                             3.1.2-0ubuntu1.1                           amd64        Python Imaging Library (Pillow fork)
ii  python-piston-mini-client                    0.7.5-0ubuntu2                             all          library for writing clients for Django's Piston REST APIs
ii  python-pkg-resources                         20.10.1-1.1~bpo8+1                         all          Package Discovery and Resource Access using pkg_resources
ii  python-ply                                   3.7-1                                      all          Lex and Yacc implementation for Python2
ii  python-protobuf                              2.6.1-1.3                                  amd64        Python bindings for protocol buffers
ii  python-psutil                                3.4.2-1                                    amd64        module providing convenience functions for managing processes
ii  python-ptyprocess                            0.5-1                                      all          Run a subprocess in a pseudo terminal from Python 2
ii  python-pyasn1                                0.1.9-1                                    all          ASN.1 library for Python (Python 2 module)
ii  python-pyasn1-modules                        0.0.7-0.1                                  all          Collection of protocols modules written in ASN.1 language
ii  python-pyatspi                               2.18.0+dfsg-3                              all          Assistive Technology Service Provider Interface - Python bindings
ii  python-pyatspi2                              2.18.0+dfsg-3                              all          Transitional package for assistive technology Python bindings
ii  python-pycparser                             2.14+dfsg-2build1                          all          C parser in Python
ii  python-pycurl                                7.43.0-1ubuntu1                            amd64        Python bindings to libcurl
ii  python-pydenticon                            0.2-0matrix1                               all          Library for generating identicons. Port of Sigil
ii  python-pygments                              2.1+dfsg-1                                 all          syntax highlighting package written in Python
ii  python-pyinotify                             0.9.6-0fakesync1                           all          simple Linux inotify Python bindings
ii  python-pymacaroons-pynacl                    0.9.3-1                                    all          Macaroon library for Python
ii  python-pyorbit                               2.24.0-7.1                                 amd64        A Python language binding for the ORBit2 CORBA implementation
ii  python-pysaml2                               3.0.0-3ubuntu1                             all          SAML Version 2 to be used in a WSGI environment - Python 2.x
ii  python-qt4                                   4.11.4+dfsg-1build4                        amd64        Python bindings for Qt4
ii  python-qt4-dbus                              4.11.4+dfsg-1build4                        amd64        D-Bus Support for PyQt4
ii  python-renderpm:amd64                        3.3.0-1                                    amd64        python low level render interface
ii  python-reportlab                             3.3.0-1                                    all          ReportLab library to create PDF documents using Python
ii  python-reportlab-accel:amd64                 3.3.0-1                                    amd64        C coded extension accelerator for the ReportLab Toolkit
ii  python-requests                              2.9.1-3                                    all          elegant and simple HTTP library for Python2, built for human beings
ii  python-samba                                 2:4.3.11+dfsg-0ubuntu0.16.04.8             amd64        Python bindings for Samba
ii  python-serial                                3.0.1-1                                    all          pyserial - module encapsulating access for the serial port
ii  python-service-identity                      16.0.0-2                                   all          Service identity verification for pyOpenSSL (Python 2 module)
ii  python-setuptools                            20.10.1-1.1~bpo8+1                         all          Python Distutils Enhancements
ii  python-sexy                                  0.1.9-1ubuntu3-1mint3                      amd64        python language bindings for libsexy
ii  python-signedjson                            1.0.0-1                                    all          Sign JSON with Ed25519 signatures
ii  python-simplejson                            3.8.1-1ubuntu2                             amd64        simple, fast, extensible JSON encoder/decoder for Python
ii  python-sip                                   4.17+dfsg-1build1                          amd64        Python/C++ bindings generator runtime library
ii  python-six                                   1.10.0-3                                   all          Python 2 and 3 compatibility library (Python 2 interface)
ii  python-smbc                                  1.0.15.5-1                                 amd64        Python 2 bindings for the Samba client library
ii  python-talloc                                2.1.5-2                                    amd64        hierarchical pool based memory allocator - Python bindings
ii  python-tdb                                   1.3.8-2                                    amd64        Python bindings for TDB
ii  python-tempita                               0.5.2-1build1                              all          very small text templating language
ii  python-twisted                               16.0.0-1                                   all          Event-based framework for internet applications (dependency package)
ii  python-twisted-bin                           16.2.0-1~bpo8+1                            amd64        Event-based framework for internet applications
ii  python-twisted-core                          16.2.0-1~bpo8+1                            all          Event-based framework for internet applications
ii  python-twisted-names                         16.2.0-1~bpo8+1                            all          twisted package for DNS protocol implementation
ii  python-twisted-web                           16.2.0-1~bpo8+1                            all          twisted dummy package for HTTP protocol implementation
ii  python-tz                                    2014.10~dfsg1-0ubuntu2                     all          Python version of the Olson timezone database
ii  python-ubuntu-sso-client                     13.10-0ubuntu11                            all          Ubuntu Single Sign-On client - Python library
ii  python-ujson                                 1.33-1build1                               amd64        ultra fast JSON encoder and decoder for Python 2
ii  python-unpaddedbase64                        1.1.0-1                                    all          Unpadded Base64
ii  python-urllib3                               1.13.1-2ubuntu0.16.04.1                    all          HTTP library with thread-safe connection pooling for Python
ii  python-utidylib                              0.2-9build1                                all          Python wrapper for TidyLib
ii  python-vte                                   1:0.28.2-5ubuntu3                          amd64        Python bindings for the VTE widget set
ii  python-webkit                                1.1.8-3.1                                  amd64        WebKit/Gtk Python bindings
ii  python-xapian                                1.2.22-2build1                             amd64        Xapian search engine interface for Python
ii  python-xdg                                   0.25-4                                     all          Python 2 library to access freedesktop.org standards
ii  python-yaml                                  3.11-3build1                               amd64        YAML parser and emitter for Python
ii  python-zope.interface                        4.1.3-1build1                              amd64        Interfaces for Python
ii  python2.7                                    2.7.12-1ubuntu0~16.04.1                    amd64        Interactive high-level object-oriented language (version 2.7)
ii  python2.7-minimal                            2.7.12-1ubuntu0~16.04.1                    amd64        Minimal subset of the Python language (version 2.7)
ii  python3                                      3.5.1-3                                    amd64        interactive high-level object-oriented language (default python3 version)
ii  python3-apt                                  1.1.0~beta1build1                          amd64        Python 3 interface to libapt-pkg
ii  python3-aptdaemon                            1.1.1+bzr982-0ubuntu14                     all          Python 3 module for the server and client of aptdaemon
ii  python3-aptdaemon.gtk3widgets                1.1.1+bzr982-0ubuntu14                     all          Python 3 GTK+ 3 widgets to run an aptdaemon client
ii  python3-aptdaemon.pkcompat                   1.1.1+bzr982-0ubuntu14                     all          PackageKit compatibilty for AptDaemon
ii  python3-blinker                              1.3.dfsg2-1build1                          all          fast, simple object-to-object and broadcast signaling library
ii  python3-brlapi                               5.3.1-2ubuntu2.1                           amd64        Braille display access via BRLTTY - Python3 bindings
ii  python3-cairo                                1.10.0+dfsg-5build1                        amd64        Python 3 bindings for the Cairo vector graphics library
ii  python3-cffi-backend                         1.5.2-1ubuntu1                             amd64        Foreign Function Interface for Python 3 calling C code - runtime
ii  python3-chardet                              2.3.0-2                                    all          universal character encoding detector for Python3
ii  python3-commandnotfound                      0.3ubuntu16.04.2                           all          Python 3 bindings for command-not-found.
ii  python3-crypto                               2.6.1-6ubuntu0.16.04.2                     amd64        cryptographic algorithms and protocols for Python 3
ii  python3-cryptography                         1.2.3-1ubuntu0.1                           amd64        Python library exposing cryptographic recipes and primitives (Python 3)
ii  python3-cups                                 1.9.73-0ubuntu2                            amd64        Python3 bindings for CUPS
ii  python3-cupshelpers                          1.5.7+20160212-0ubuntu2                    all          Python modules for printer configuration with CUPS
ii  python3-dbus                                 1.2.0-3                                    amd64        simple interprocess messaging system (Python 3 interface)
ii  python3-debian                               0.1.27ubuntu2                              all          Python 3 modules to work with Debian-related data formats
ii  python3-defer                                1.0.6-2build1                              all          Small framework for asynchronous programming (Python 3)
ii  python3-dirspec                              13.10-1ubuntu1                             all          Python User Folders Specification Library
ii  python3-distupgrade                          1:16.04.21                                 all          manage release upgrades
ii  python3-gdbm:amd64                           3.5.1-1                                    amd64        GNU dbm database support for Python 3.x
ii  python3-gi                                   3.20.0-0ubuntu1                            amd64        Python 3 bindings for gobject-introspection libraries
ii  python3-gi-cairo                             3.20.0-0ubuntu1                            amd64        Python 3 Cairo bindings for the GObject library
ii  python3-httplib2                             0.9.1+dfsg-1                               all          comprehensive HTTP client library written for Python3
ii  python3-icu                                  1.9.2-2build1                              amd64        Python 3 extension wrapping the ICU C++ API
ii  python3-idna                                 2.0-3                                      all          Python IDNA2008 (RFC 5891) handling (Python 3)
ii  python3-jwt                                  1.3.0-1                                    all          Python 3 implementation of JSON Web Token
ii  python3-louis                                2.6.4-2                                    all          Python bindings for liblouis
ii  python3-lxml                                 3.5.0-1build1                              amd64        pythonic binding for the libxml2 and libxslt libraries
ii  python3-minimal                              3.5.1-3                                    amd64        minimal subset of the Python language (default python3 version)
ii  python3-oauthlib                             1.0.3-1                                    all          generic, spec-compliant implementation of OAuth for Python3
ii  python3-oneconf                              0.3.9                                      all          synchronize your configuration data over the network (Python 3)
ii  python3-pexpect                              4.0.1-1                                    all          Python 3 module for automating interactive applications
ii  python3-pil:amd64                            3.1.2-0ubuntu1.1                           amd64        Python Imaging Library (Python3)
ii  python3-piston-mini-client                   0.7.5-0ubuntu2                             all          library for writing clients for Django's Piston REST APIs
ii  python3-pkg-resources                        20.7.0-1                                   all          Package Discovery and Resource Access using pkg_resources
ii  python3-ptyprocess                           0.5-1                                      all          Run a subprocess in a pseudo terminal from Python 3
ii  python3-pyasn1                               0.1.9-1                                    all          ASN.1 library for Python (Python 3 module)
ii  python3-pyatspi                              2.18.0+dfsg-3                              all          Assistive Technology Service Provider Interface - Python3 bindings
ii  python3-pycurl                               7.43.0-1ubuntu1                            amd64        Python bindings to libcurl (Python 3)
ii  python3-reportlab                            3.3.0-1                                    all          ReportLab library to create PDF documents using Python3
ii  python3-reportlab-accel:amd64                3.3.0-1                                    amd64        C coded extension accelerator for the ReportLab Toolkit
ii  python3-requests                             2.9.1-3                                    all          elegant and simple HTTP library for Python3, built for human beings
ii  python3-six                                  1.10.0-3                                   all          Python 2 and 3 compatibility library (Python 3 interface)
ii  python3-speechd                              0.8.3-1ubuntu3                             all          Python interface to Speech Dispatcher
ii  python3-uno                                  1:5.1.6~rc2-0ubuntu1~xenial2               amd64        Python-UNO bridge
ii  python3-update-manager                       1:16.04.6                                  all          python 3.x module for update-manager
ii  python3-urllib3                              1.13.1-2ubuntu0.16.04.1                    all          HTTP library with thread-safe connection pooling for Python3
ii  python3-virtkey                              0.63.0-0ubuntu5                            amd64        Library to emulate keyboard keypresses.
ii  python3-xapian1.3                            1.3.4-0ubuntu1                             amd64        Xapian search engine interface for Python3
ii  python3-xdg                                  0.25-4                                     all          Python 3 library to access freedesktop.org standards
ii  python3-xkit                                 0.5.0ubuntu2                               all          library for the manipulation of xorg.conf files (Python 3)
ii  python3.5                                    3.5.2-2ubuntu0~16.04.1                     amd64        Interactive high-level object-oriented language (version 3.5)
ii  python3.5-minimal                            3.5.2-2ubuntu0~16.04.1                     amd64        Minimal subset of the Python language (version 3.5)