When I try to upgrade by running the following command:
sudo apt-get upgrade
I get an error and the following output:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up software-properties-common (0.99.9.8) ...
/var/lib/dpkg/info/software-properties-common.postinst: 6:
py3compile: not found
dpkg: error processing package software-properties-common (--configure):
installed software-properties-common package post-installation script subprocess returned error exit status 127
Setting up python3-minimal (3.8.2-0ubuntu2) ...
/var/lib/dpkg/info/python3-minimal.postinst: 5: py3compile: not found
dpkg: error processing package python3-minimal (--configure):
installed python3-minimal package post-installation script subprocess returned error exit status 127
dpkg: dependency problems prevent configuration of software-properties-gtk:
software-properties-gtk depends on software-properties-common; however:
Package software-properties-common is not configured yet.
dpkg: error processing package software-properties-gtk (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
software-properties-common
python3-minimal
software-properties-gtk
E: Sub-process /usr/bin/dpkg returned an error code (1)
The output of which python python3
is:
/usr/bin/python
The output of ls -l /usr/bin/python*
is:
lrwxrwxrwx 1 root root 7 Apr 15 2020 /usr/bin/python -> python2
lrwxrwxrwx 1 root root 9 Mar 13 2020 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3674216 Mar 8 2021 /usr/bin/python2.7
lrwxrwxrwx 1 root root 9 Jul 1 10:56 /usr/bin/python3 -> python3.8
lrwxrwxrwx 1 root root 33 Mar 15 17:52 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config
lrwxrwxrwx 1 root root 16 Mar 13 2020 /usr/bin/python3-config -> python3.8-config
The output of sudo apt install python-is-python3
is:
Package python-is-python3 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: python-is-python2
E: Package 'python-is-python3' has no installation candidate
I then followed the steps to revert to original repositories in this answer and ran again sudo apt install python-is-python3
Which gave the following output:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib linux-headers-5.13.0-48-generic linux-hwe-5.13-headers-5.13.0-48 linux-image-5.13.0-48-generic linux-modules-5.13.0-48-generic
linux-modules-extra-5.13.0-48-generic python2 python2-minimal python2.7 python2.7-minimal
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
ubuntu-advantage-tools
The following packages will be REMOVED:
python-is-python2
The following NEW packages will be installed:
python-is-python3
The following packages will be upgraded:
ubuntu-advantage-tools
1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
4 not fully installed or removed.
Need to get 879 kB of archives.
After this operation, 21.5 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 ubuntu-advantage-tools amd64 27.9~20.04.1 [876 kB]
Get:2 http://archive.ubuntu.com/ubuntu foca
l/main amd64 python-is-python3 all 3.8.2-4 [2,364 B]
Fetched 879 kB in 2s (361 kB/s)
Preconfiguring packages ...
dpkg: warning: files list file for package 'python3-commandnotfound' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'apturl-common' missing; assuming package has no files currently installed
(Reading database ... 220697 files and directories currently installed.)
Preparing to unpack .../ubuntu-advantage-tools_27.9~20.04.1_amd64.deb ...
/var/lib/dpkg/info/ubuntu-advantage-tools.prerm: 48: py3clean: not found...................................................................................................................................................]
dpkg: warning: old ubuntu-advantage-tools package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
Failed to stop ubuntu-advantage.service: Unit ubuntu-advantage.service not loaded.
/var/lib/dpkg/tmp.ci/prerm: 48: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/ubuntu-advantage-tools_27.9~20.04.1_amd64.deb (--unpack):
new ubuntu-advantage-tools package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/ubuntu-advantage-tools.postinst: 451: py3compile: not found
dpkg: error while cleaning up:
installed ubuntu-advantage-tools package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
/var/cache/apt/archives/ubuntu-advantage-tools_27.9~20.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
prajesh@revyz-113:~$ sudo apt autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
ubuntu-advantage-tools
The following packages will be REMOVED:
linux-headers-5.13.0-48-generic linux-hwe-5.13-headers-5.13.0-48 linux-image-5.13.0-48-generic linux-modules-5.13.0-48-generic linux-modules-extra-5.13.0-48-generic
The following packages will be upgraded:
ubuntu-advantage-tools
1 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
4 not fully installed or removed.
Need to get 0 B/876 kB of archives.
After this operation, 508 MB disk space will be freed.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
dpkg: warning: files list file for package 'python3-commandnotfound' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'apturl-common' missing; assuming package has no files currently installed
(Reading database ... 220697 files and directories currently installed.)
Preparing to unpack .../ubuntu-advantage-tools_27.9~20.04.1_amd64.deb ...
/var/lib/dpkg/info/ubuntu-advantage-tools.prerm: 48: py3clean: not found...................................................................................................................................................]
dpkg: warning: old ubuntu-advantage-tools package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
Failed to stop ubuntu-advantage.service: Unit ubuntu-advantage.service not loaded.
/var/lib/dpkg/tmp.ci/prerm: 48: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/ubuntu-advantage-tools_27.9~20.04.1_amd64.deb (--unpack):
new ubuntu-advantage-tools package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/ubuntu-advantage-tools.postinst: 451: py3compile: not found
dpkg: error while cleaning up:
installed ubuntu-advantage-tools package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
/var/cache/apt/archives/ubuntu-advantage-tools_27.9~20.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)