Error installing Ubuntu Ubuntu 16.04 "dpkg: error processing archive /var/cache/apt/archives/apport_2.20.1-0ubuntu2.15_all.deb"

2

I have an application made in Django that is now in production mode in ubuntu server 16.04 and I need to generate its SSL Certificate so that users can access through HTTPS, for this I have guided myself with this tutorial:

link

After following the steps indicated in the tutorial, the problem arose when trying to install certbot

sudo apt-get install python-certbot-nginx

I get this error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-certbot-nginx is already the newest version (0.19.0-1+ubuntu16.04.1+certbot+1).
The following packages were automatically installed and are no longer required:
  grub-pc-bin linux-headers-4.4.0-101 linux-headers-4.4.0-101-generic linux-headers-4.4.0-97 linux-headers-4.4.0-97-generic linux-headers-4.4.0-98
  linux-headers-4.4.0-98-generic linux-image-4.4.0-101-generic linux-image-4.4.0-97-generic linux-image-4.4.0-98-generic
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  apport-gtk | apport-kde
The following packages will be upgraded:
  apport
1 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
94 not fully installed or removed.
Need to get 0 B/121 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 174786 files and directories currently installed.)
Preparing to unpack .../apport_2.20.1-0ubuntu2.15_all.deb ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
  File "/usr/bin/pyclean", line 63
    except (IOError, OSError), e:
                             ^
SyntaxError: invalid syntax
dpkg: error processing archive /var/cache/apt/archives/apport_2.20.1-0ubuntu2.15_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 1
Traceback (most recent call last):
  File "/usr/bin/pycompile", line 35, in <module>
    from debpython.version import SUPPORTED, debsorted, vrepr, \
  File "/usr/share/python/debpython/version.py", line 24, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/apport_2.20.1-0ubuntu2.15_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

the truth I do not know why I get that error, I detail some tools and server settings:

  • My Server is only optimized by default for Python 3.5.2

  • as tools I am working with NGINX, Uwsgi, django1.11, to serve static, postgres like DB, virtualenv, correct domain response both by www and http ... etc

  • I suspect maybe python 2.7 is required, now I can not upgrade, apt-get -f install and sudo apt autoremove, and I get the same error

    Maybe I'm not following the documentation well? or what can be done to install python-certbot-nginx?

    NOTE: The errors I threw in lines up is already the third installation attempt. in some attempt of installation threw me this error:

    Reading package lists... 
    Done Building dependency tree Reading state information... 
    Done python-certbot-nginx is already the newest version (0.19.0-1+ubuntu16.04.1+certbot+1). 
    You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies: 
    apport : Depends: python3-apport (>= 2.20.1-0ubuntu2.15) but 2.20.1-0ubuntu2.14 is to be installed E: Unmet dependencies.
    Try 'apt-get -f install' with no packages (or specify a solution).
    
        
    asked by Alex Ancco Cahuana 04.01.2018 в 02:01
    source

    1 answer

    1

    To install Certbot, it is essential to have python 2.7.x as default, in my case it had python3.5 as the default, it could not be installed, it had to change the Python version in the whole system, in the terminal we wrote :

    update-alternatives --install / usr / bin / python python /usr/bin/python2.7 1
    
    update-alternatives --install / usr / bin / python python /usr/bin/python3.5 2
    

    when I check the versions:

    update-alternatives --list python
    
    /usr/bin/python2.7
    /usr/bin/python3.5
    

    Now I simply select any version of Python with:

    update-alternatives --config python
    

    will come out a version selector like:

      Selección   Ruta                Prioridad  Estado
    ------------------------------------------------------------
      0            /usr/bin/python3.5   2         modo automático
    * 1            /usr/bin/python2.7   1         modo manual
      2            /usr/bin/python3.5   2         modo manual
    
    Press <enter> to keep the current choice[*], or type selection number: 
    

    In my case I have selected option 1, python2.7, and proceed to install ...

        
    answered by 09.01.2018 / 20:04
    source