Page 1 of 1

Can't find pyOpenSSL after debian upgrade : 7 to 8

Posted: May 4th, 2015, 11:58 am
by chrisemail
Hi O0

After a debian system upgrade (from debian wheezy to debian jessie), i have problem to start sabnzbd and activate SSL. SABNZBD can't find pyOpenSSL (package python-openssl is already installed)

Code: Select all

in logs :
ImportError: You must install pyOpenSSL to use HTTPS.

package reinstall :
root@serveur:/RAID1/SABNZBD/logs# apt purge python-openssl
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
  python-characteristic python-pyasn1-modules
Veuillez utiliser « apt-get autoremove » pour les supprimer.
Les paquets suivants seront ENLEVÉS :
  python-openssl*
0 mis à jour, 0 nouvellement installés, 1 à enlever et 1 non mis à jour.
Après cette opération, 377 ko d'espace disque seront libérés.
Souhaitez-vous continuer ? [O/n] O
(Lecture de la base de données... 106947 fichiers et répertoires déjà installés.)
Suppression de python-openssl (0.14-1) ...
root@serveur:/RAID1/SABNZBD/logs# apt install python-openssl
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
  python-characteristic python-pyasn1-modules
Veuillez utiliser « apt-get autoremove » pour les supprimer.
Paquets suggérés :
  python-openssl-doc python-openssl-dbg
Les NOUVEAUX paquets suivants seront installés :
  python-openssl
0 mis à jour, 1 nouvellement installés, 0 à enlever et 1 non mis à jour.
Il est nécessaire de prendre 0 o/81,1 ko dans les archives.
Après cette opération, 377 ko d'espace disque supplémentaires seront utilisés.
Sélection du paquet python-openssl précédemment désélectionné.
(Lecture de la base de données... 106927 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de .../python-openssl_0.14-1_all.deb ...
Dépaquetage de python-openssl (0.14-1) ...
Paramétrage de python-openssl (0.14-1) ...
(reverse-i-search)`list': apt ^Cst --upgradable
root@serveur:/RAID1/SABNZBD/logs# dpkg --listfiles python-openssl
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/python-openssl
/usr/share/doc/python-openssl/changelog.Debian.gz
/usr/share/doc/python-openssl/changelog.gz
/usr/share/doc/python-openssl/copyright
/usr/lib
/usr/lib/python2.7
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/pyOpenSSL-0.14.egg-info
/usr/lib/python2.7/dist-packages/pyOpenSSL-0.14.egg-info/dependency_links.txt
/usr/lib/python2.7/dist-packages/pyOpenSSL-0.14.egg-info/PKG-INFO
/usr/lib/python2.7/dist-packages/pyOpenSSL-0.14.egg-info/top_level.txt
/usr/lib/python2.7/dist-packages/pyOpenSSL-0.14.egg-info/requires.txt
/usr/lib/python2.7/dist-packages/OpenSSL
/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py
/usr/lib/python2.7/dist-packages/OpenSSL/tsafe.py
/usr/lib/python2.7/dist-packages/OpenSSL/rand.py
/usr/lib/python2.7/dist-packages/OpenSSL/crypto.py
/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py
/usr/lib/python2.7/dist-packages/OpenSSL/version.py
/usr/lib/python2.7/dist-packages/OpenSSL/test
/usr/lib/python2.7/dist-packages/OpenSSL/test/__init__.py
/usr/lib/python2.7/dist-packages/OpenSSL/test/util.py
/usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.py
/usr/lib/python2.7/dist-packages/OpenSSL/test/test_rand.py
/usr/lib/python2.7/dist-packages/OpenSSL/test/test_ssl.py
/usr/lib/python2.7/dist-packages/OpenSSL/_util.py

Any ideas ?
How sabnzbd check pyOpenSSL ?

Thanks a lot for your help

Re: Can't find pyOpenSSL after debian upgrade : 7 to 8

Posted: May 4th, 2015, 2:29 pm
by shypike
Often Linux installation have multiple versions of Python.
Check which version is the default.
Then start Python and type:

Code: Select all

from OpenSSL import SSL
want = SSL.WantReadError
If you get an error message, then PyOpenSSL is not installed for your python version.
Check how to start other versions.
They're usually called python25, python26, python27

Re: Can't find pyOpenSSL after debian upgrade : 7 to 8

Posted: May 4th, 2015, 4:10 pm
by jcfp
No more python 2.5 or 2.6 in the debian release, only 2.7 (and python3 of course, but that has its own python3-openssl package). That said, no clue what's going wrong for the topic starter; both sab and python-openssl work just fine in my testing vm. Let's see some tracebacks first Image

Re: Can't find pyOpenSSL after debian upgrade : 7 to 8

Posted: May 5th, 2015, 4:35 am
by chrisemail
Thanks for your replies ;D

Code: Select all

root@serveur:~# python
Python 2.7.9 (default, Mar  1 2015, 12:57:24)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from OpenSSL import SSL
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/rand.py", line 11, in <module>
    from OpenSSL._util import (
  File "/usr/lib/python2.7/dist-packages/OpenSSL/_util.py", line 4, in <module>
    binding = Binding()
  File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 89, in __init__
    self._ensure_ffi_initialized()
  File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/openssl/binding.py", line 113, in _ensure_ffi_initialized
    libraries=libraries,
  File "/usr/lib/python2.7/dist-packages/cryptography/hazmat/bindings/utils.py", line 39, in build_ffi
    ffi = cffi.FFI()
  File "/usr/local/lib/python2.7/dist-packages/cffi/api.py", line 56, in __init__
    import _cffi_backend as backend
ImportError: libffi.so.5: cannot open shared object file: No such file or directory
Looking for this lib :

Code: Select all

root@serveur:~# find /usr -name 'libffi.so.*'
/usr/lib/x86_64-linux-gnu/libffi.so.6
/usr/lib/x86_64-linux-gnu/libffi.so.6.0.2

root@serveur:~# apt search libffi
En train de trier... Fait
Recherche en texte intégral... Fait

libffi5/now 3.0.10-3 amd64 [configuration restante]
  (none)

libffi6/stable,now 3.1-2+b2 amd64  [installé]
  Bibliothèque d'exécution de l'interface de fonction étrangère (FFI)
So i made a link to the new lib :

Code: Select all

ln -s /usr/lib/x86_64-linux-gnu/libffi.so.6.0.2 /usr/lib/x86_64-linux-gnu/libffi.so.5
Everything works fine now with sabnzbd. But maybe the link is not a good option ?

Re: Can't find pyOpenSSL after debian upgrade : 7 to 8

Posted: May 5th, 2015, 2:28 pm
by jcfp
So it's nothing sab related. Might be some kind of issue with the upgrade from wheezy to jessie; glad you found a workaround.

Out of curiosity: did you have wheezy-backports enabled before the upgrade? And what happens if you rerun shypike's test after removing the symlink and reinstalling python-cffi:

Code: Select all

apt-get install --reinstall python-cffi