3

Running mark2 to oversee my Minecraft server and my upgrade to Ubuntu 16 LTS has seemingly borked something and I'm unable to figure out how to fix it. Suffice it to say mark2 seems to need PyOpenSSL 0.13 and it appears that the upgrade has forced python's upgrade to its own dist-package of PyOpenSSL to 0.15.1.

The error given when using mark2 start is:

Traceback (most recent call last):
  File "/usr/local/bin/mark2", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2927, in <module>
    @_call_aside
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2913, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2940, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 637, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 650, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 829, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pyOpenSSL==0.13' distribution was not found and is required by mark2

Attempting to use pip to pip install pyopenssl==0.13 yields this horribleness:

Collecting pyopenssl==0.13
  Using cached pyOpenSSL-0.13.tar.gz
Building wheels for collected packages: pyopenssl
  Running setup.py bdist_wheel for pyopenssl ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Dt9RiD/pyopenssl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpsbnZGjpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/OpenSSL
  copying OpenSSL/__init__.py -> build/lib.linux-x86_64-2.7/OpenSSL
  copying OpenSSL/tsafe.py -> build/lib.linux-x86_64-2.7/OpenSSL
  copying OpenSSL/version.py -> build/lib.linux-x86_64-2.7/OpenSSL
  creating build/lib.linux-x86_64-2.7/OpenSSL/test
  copying OpenSSL/test/__init__.py -> build/lib.linux-x86_64-2.7/OpenSSL/test
  copying OpenSSL/test/util.py -> build/lib.linux-x86_64-2.7/OpenSSL/test
  copying OpenSSL/test/test_crypto.py -> build/lib.linux-x86_64-2.7/OpenSSL/test
  copying OpenSSL/test/test_rand.py -> build/lib.linux-x86_64-2.7/OpenSSL/test
  copying OpenSSL/test/test_ssl.py -> build/lib.linux-x86_64-2.7/OpenSSL/test
  running build_ext
  building 'OpenSSL.crypto' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/OpenSSL
  creating build/temp.linux-x86_64-2.7/OpenSSL/crypto
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/crypto.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/crypto.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/x509.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/x509.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/x509name.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/x509name.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/pkey.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/pkey.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/x509store.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/x509store.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/x509req.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/x509req.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/x509ext.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/x509ext.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/pkcs7.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/pkcs7.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/pkcs12.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/pkcs12.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/netscape_spki.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/netscape_spki.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/revoked.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/revoked.o
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/crl.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/crl.o
  OpenSSL/crypto/crl.c:6:23: error: static declaration of ‘X509_REVOKED_dup’ follows non-static declaration
   static X509_REVOKED * X509_REVOKED_dup(X509_REVOKED *orig) {
                         ^
  In file included from /usr/include/openssl/ssl.h:156:0,
                   from OpenSSL/crypto/x509.h:17,
                   from OpenSSL/crypto/crypto.h:30,
                   from OpenSSL/crypto/crl.c:3:
  /usr/include/openssl/x509.h:751:15: note: previous declaration of ‘X509_REVOKED_dup’ was here
   X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev);
                 ^
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for pyopenssl
  Running setup.py clean for pyopenssl
Failed to build pyopenssl
Installing collected packages: pyopenssl
  Running setup.py install for pyopenssl ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Dt9RiD/pyopenssl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-mnXvzL-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/OpenSSL
    copying OpenSSL/__init__.py -> build/lib.linux-x86_64-2.7/OpenSSL
    copying OpenSSL/tsafe.py -> build/lib.linux-x86_64-2.7/OpenSSL
    copying OpenSSL/version.py -> build/lib.linux-x86_64-2.7/OpenSSL
    creating build/lib.linux-x86_64-2.7/OpenSSL/test
    copying OpenSSL/test/__init__.py -> build/lib.linux-x86_64-2.7/OpenSSL/test
    copying OpenSSL/test/util.py -> build/lib.linux-x86_64-2.7/OpenSSL/test
    copying OpenSSL/test/test_crypto.py -> build/lib.linux-x86_64-2.7/OpenSSL/test
    copying OpenSSL/test/test_rand.py -> build/lib.linux-x86_64-2.7/OpenSSL/test
    copying OpenSSL/test/test_ssl.py -> build/lib.linux-x86_64-2.7/OpenSSL/test
    running build_ext
    building 'OpenSSL.crypto' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/OpenSSL
    creating build/temp.linux-x86_64-2.7/OpenSSL/crypto
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/crypto.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/crypto.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/x509.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/x509.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/x509name.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/x509name.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/pkey.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/pkey.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/x509store.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/x509store.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/x509req.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/x509req.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/x509ext.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/x509ext.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/pkcs7.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/pkcs7.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/pkcs12.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/pkcs12.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/netscape_spki.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/netscape_spki.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/revoked.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/revoked.o
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c OpenSSL/crypto/crl.c -o build/temp.linux-x86_64-2.7/OpenSSL/crypto/crl.o
    OpenSSL/crypto/crl.c:6:23: error: static declaration of ‘X509_REVOKED_dup’ follows non-static declaration
     static X509_REVOKED * X509_REVOKED_dup(X509_REVOKED *orig) {
                           ^
    In file included from /usr/include/openssl/ssl.h:156:0,
                     from OpenSSL/crypto/x509.h:17,
                     from OpenSSL/crypto/crypto.h:30,
                     from OpenSSL/crypto/crl.c:3:
    /usr/include/openssl/x509.h:751:15: note: previous declaration of ‘X509_REVOKED_dup’ was here
     X509_REVOKED *X509_REVOKED_dup(X509_REVOKED *rev);
                   ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Dt9RiD/pyopenssl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-mnXvzL-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-Dt9RiD/pyopenssl/
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

So at this point I'm at a loss because I'm unsure where to go from here. Upgrading pip also fails and sticks at 8.1.1, though I'm not convinced that's really my issue here. Any ideas?

Cryptite
  • 1,426
  • 2
  • 28
  • 50

1 Answers1

0

The following patch works fine for me (pyOpenSSL==0.12/0.13)

pip download pyOpenSSL==0.13
tar xzf pyOpenSSL-0.13.tar.gz
cd pyOpenSSL-0.13

wget https://gist.githubusercontent.com/brycepg/809501ae24e34e9fdb58a7932c12287b/raw/74e0165e73dadab8051a9041bcb8e657705a706b/fix.patch

patch OpenSSL/crypto/crl.c fix.patch
pip install --no-clean .

You could see more this at https://github.com/pyca/pyopenssl/issues/276

Serenity
  • 35,289
  • 20
  • 120
  • 115
Ninh
  • 1