0

I made a hoorible mistake because I removed pyth 2.7 of my ubuntu machine 18.04 as I wanted to keep only python3 but unfortunately there were some componenents who were installed using pip from the python 2.7 ( ansible for instance).

Now when I try to reinstall python I have the error below :

:~$ sudo apt install python
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies: python : PreDepends: python-minimal (= 2.7.12-1~16.04) but it is not going to be installed Depends: python2.7 (>= 2.7.12-1~) but it is not going to be installed E: Unable to correct problems, you have held broken packages.

When I check for residual config I see this :

:~$ apt list | grep residual-config

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

ansible/xenial-updates,xenial-updates,xenial-security,xenial-security 2.0.0.2-2ubuntu1.3 all [residual-config] aspell-en/xenial,xenial 7.1-0-1.1 all [residual-config] docker/xenial,now 1.5-1 amd64 [residual-config] docker.io/xenial-updates 18.09.7-0ubuntu1~16.04.7 amd64 [residual-config] initscripts/xenial,now 2.88dsf-59.3ubuntu2 amd64 [residual-config] insserv/xenial,now 1.14.0-5ubuntu3 amd64 [residual-config] libgdbm3/xenial,now 1.8.3-13.1 amd64 [residual-config] libiscsi2/xenial,now 1.12.0-2 amd64 [residual-config] libjson-c2/xenial-updates,xenial-security 0.11-4ubuntu2.6 amd64 [residual-config] libperl5.22/xenial-updates,xenial-security 5.22.1-9ubuntu0.9 amd64 [residual-config] libpython3.5-minimal/xenial-updates,xenial-security 3.5.2-2ubuntu0~16.04.13 amd64 [residual-config] libserf-1-1/xenial,now 1.3.8-1 amd64 [residual-config] libtxc-dxtn-s2tc0/xenial,now 0~git20131104-1.1 amd64 [residual-config] libunistring0/xenial,now 0.9.3-5.2ubuntu1 amd64 [residual-config] libustr-1.0-1/xenial,now 1.0.4-5 amd64 [residual-config] libv8-3.14.5/xenial,now 3.14.5.8-5ubuntu2 amd64 [residual-config] libxml-sax-perl/xenial,xenial,now 0.99+dfsg-2ubuntu1 all [residual-config] linux-image-4.4.0-112-generic/xenial-updates,xenial-security,now 4.4.0-112.135 amd64 [residual-config] linux-image-4.4.0-124-generic/xenial-updates,xenial-security,now 4.4.0-124.148 amd64 [residual-config] linux-image-4.4.0-148-generic/xenial-updates,xenial-security,now 4.4.0-148.174 amd64 [residual-config] linux-image-4.4.0-93-generic/xenial-updates,xenial-security,now 4.4.0-93.116 amd64 [residual-config] linux-image-extra-4.4.0-112-generic/xenial-updates,xenial-security,now 4.4.0-112.135 amd64 [residual-config] linux-image-extra-4.4.0-124-generic/xenial-updates,xenial-security,now 4.4.0-124.148 amd64 [residual-config] linux-image-extra-4.4.0-93-generic/xenial-updates,xenial-security,now 4.4.0-93.116 amd64 [residual-config] linux-modules-4.4.0-148-generic/xenial-updates,xenial-security,now 4.4.0-148.174 amd64 [residual-config] linux-modules-extra-4.4.0-148-generic/xenial-updates,xenial-security,now 4.4.0-148.174 amd64 [residual-config] lua-lpeg/xenial-updates 0.12.2-1ubuntu1 amd64 [residual-config] lxc-common/xenial-updates,now 2.0.11-0ubuntu1~16.04.3 amd64 [residual-config] mariadb-client-10.0/xenial-updates,xenial-security,now 10.0.38-0ubuntu0.16.04.1 amd64 [residual-config] mariadb-common/xenial-updates,xenial-updates,xenial-security,xenial-security,now 10.0.38-0ubuntu0.16.04.1 all [residual-config] monitoring-plugins-basic/xenial,now 2.1.2-2ubuntu2 amd64 [residual-config] mysql-server-5.7/xenial-updates,xenial-security 5.7.33-0ubuntu0.16.04.1 amd64 [residual-config] nginx-common/xenial-updates,xenial-updates,xenial-security,xenial-security 1.10.3-0ubuntu0.16.04.5 all [residual-config] ntp/xenial-updates,xenial-security 1:4.2.8p4+dfsg-3ubuntu5.10 amd64 [residual-config] ntpdate/xenial-updates,xenial-security 1:4.2.8p4+dfsg-3ubuntu5.10 amd64 [residual-config] openjdk-8-jre-headless/xenial-updates,xenial-security 8u282-b08-0ubuntu1~16.04 amd64 [residual-config] php-pear/bionic,bionic 1:1.10.8+submodules+notgz-1+ubuntu18.04.1+deb.sury.org+1 all [residual-config] php7.0-curl/bionic 7.0.33-29+ubuntu18.04.1+deb.sury.org+1 amd64 [residual-config] php7.0-gd/bionic 7.0.33-29+ubuntu18.04.1+deb.sury.org+1 amd64 [residual-config] php7.0-ldap/bionic 7.0.33-29+ubuntu18.04.1+deb.sury.org+1 amd64 [residual-config] php7.0-mysql/bionic 7.0.33-29+ubuntu18.04.1+deb.sury.org+1 amd64 [residual-config] php7.0-xmlrpc/bionic 7.0.33-29+ubuntu18.04.1+deb.sury.org+1 amd64 [residual-config] python/xenial-updates 2.7.12-1~16.04 amd64 [residual-config] python3.5-minimal/xenial-updates,xenial-security 3.5.2-2ubuntu0~16.04.13 amd64 [residual-config] resolvconf/xenial-updates,xenial-updates 1.78ubuntu7 all [residual-config] subversion/xenial-updates,xenial-security 1.9.3-2ubuntu1.3 amd64 [residual-config] sysv-rc/xenial,xenial,now 2.88dsf-59.3ubuntu2 all [residual-config] xterm/xenial-updates,xenial-security 322-1ubuntu1.2 amd64 [residual-config]

And when I check for held packages using dpkg nothing appears :

~$ dpkg --get-selections | grep hold

My OS version is :

~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.3 LTS"

I know that I've caused damage and I learnt it the hard way,Now what is the appropriate way to reinstall python 2.7.12 ?

Any help, hint or advice will be more than appreciated.

  • Is your system bionic or 18.04? Why would you see python-minimal (= 2.7.12-1~16.04) as a bionic system should need python-minimal | 2.7.15~rc1-1 | bionic | amd64, arm64, armhf, i386, ppc64el, s390x, (what you get fits the python-minimal | 2.7.11-1 | xenial or 16.04) and an updated bionic system would report itself as 18.04.5 (not .3). Your system I suspect is a frakensystem & not a pure Ubuntu (ie. check your sources; ubuntu-support-status maybe helpful). – guiverc Mar 21 '21 at 23:10
  • @guiverc what does frakensystem mean ? – Jinja_dude Mar 22 '21 at 07:36
  • @Raffa I Tried both methods nothing is working to reinstall it, when I try to use aptitude I have this message E: Invalid operation aptitude – Jinja_dude Mar 22 '21 at 08:52
  • You need to install aptitude first. Did you do sudo wget http://mirrors.kernel.org/ubuntu/pool/main/a/aptitude/aptitude_0.8.10-6ubuntu1_amd64.deb then sudo dpkg -i aptitude_0.8.10-6ubuntu1_amd64.deb from the live session. After that you can use it to install like so sudo aptitude install python2.7 or sudo aptitude install python-minimal – Raffa Mar 22 '21 at 09:09
  • @Raffa and guiverc I uugraded the whole OS now everything is in order thank you both for your help and time – Jinja_dude Mar 22 '21 at 13:21

1 Answers1

0

I uugraded the whole OS now everything is in order thank you for your help and time