0
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:        18.04
Codename:       bionic

Really struggling with finding a solution to my issue. I was trying to install mongoDB on wsl and received an error. I followed the instructions from the error and ran sudo apt --fix-broken-install but I also ran into trouble and received an error. As a result, I followed the advice from this post Broken APT on WSL 18.04 and ran:

sudo rm -rf /etc/apt/apt.conf.d/20snapd.conf

which seemed to fix it and moved me along. I ran sudo apt --fix-broken-install again and everything seemed to be working well until I received this error:

Preparing to unpack .../12-python3-lib2to3_3.8.10-0ubuntu1~20.04_all.deb ...
Unpacking python3-lib2to3 (3.8.10-0ubuntu1~20.04) over (3.6.9-1~18.04) ...
dpkg: error processing archive /tmp/apt-dpkg-install-WWYJAm/12-python3-lib2to3_3.8.10-0ubuntu1~20.04_all.deb (--unpack):
 trying to overwrite '/usr/lib/python3.9/lib2to3/Grammar.txt', which is also in package python3.9-lib2to3 3.9.11-1+bionic1
Preparing to unpack .../13-python3-distutils_3.8.10-0ubuntu1~20.04_all.deb ...
Unpacking python3-distutils (3.8.10-0ubuntu1~20.04) over (3.6.9-1~18.04) ...
dpkg: error processing archive /tmp/apt-dpkg-install-WWYJAm/13-python3-distutils_3.8.10-0ubuntu1~20.04_all.deb (--unpack):
 trying to overwrite '/usr/lib/python3.9/distutils/README', which is also in package python3.9-distutils 3.9.11-1+bionic1
Preparing to unpack .../14-libgirepository-1.0-1_1.64.1-1~ubuntu20.04.1_amd64.deb ...
Unpacking libgirepository-1.0-1:amd64 (1.64.1-1~ubuntu20.04.1) over (1.56.1-1) ...
Preparing to unpack .../15-libglib2.0-0_2.64.6-1~ubuntu20.04.4_amd64.deb ...
Unpacking libglib2.0-0:amd64 (2.64.6-1~ubuntu20.04.4) over (2.56.4-0ubuntu0.18.04.9) ...
Preparing to unpack .../16-libnewt0.52_0.52.21-4ubuntu2_amd64.deb ...
Unpacking libnewt0.52:amd64 (0.52.21-4ubuntu2) over (0.52.20-1ubuntu1) ...
Preparing to unpack .../17-libstdc++6_10.3.0-1ubuntu1~20.04_amd64.deb ...
Unpacking libstdc++6:amd64 (10.3.0-1ubuntu1~20.04) over (8.4.0-1ubuntu1~18.04) ...
Errors were encountered while processing:
 /tmp/apt-dpkg-install-WWYJAm/12-python3-lib2to3_3.8.10-0ubuntu1~20.04_all.deb
 /tmp/apt-dpkg-install-WWYJAm/13-python3-distutils_3.8.10-0ubuntu1~20.04_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I then tried to run sudo apt --fix-broken-install again to see what would happen and received:

sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  dh-python libpython3.6-dev python3.6 python3.6-dev python3.6-minimal
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  apt apt-utils libapt-pkg6.0 libgnutls30 libhogweed5 libnettle7 libp11-kit0 libpython3-stdlib libtasn1-6 python3-distutils python3-lib2to3
Suggested packages:
  apt-doc aptitude | synaptic | wajig gnutls-bin
The following NEW packages will be installed:
  libapt-pkg6.0 libhogweed5 libnettle7
The following packages will be upgraded:
  apt apt-utils libgnutls30 libp11-kit0 libpython3-stdlib libtasn1-6 python3-distutils python3-lib2to3
8 upgraded, 3 newly installed, 0 to remove and 665 not upgraded.
31 not fully installed or removed.
Need to get 0 B/3,879 kB of archives.
After this operation, 3,932 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up libffi7:amd64 (3.3-4) ...
(Reading database ... 60412 files and directories currently installed.)
Preparing to unpack .../libpython3-stdlib_3.8.2-0ubuntu2_amd64.deb ...
Unpacking libpython3-stdlib:amd64 (3.8.2-0ubuntu2) over (3.6.7-1~18.04) ...
Setting up libstdc++6:amd64 (10.3.0-1ubuntu1~20.04) ...
Selecting previously unselected package libapt-pkg6.0:amd64.
(Reading database ... 60412 files and directories currently installed.)
Preparing to unpack .../libapt-pkg6.0_2.0.6_amd64.deb ...
Unpacking libapt-pkg6.0:amd64 (2.0.6) ...
Setting up libapt-pkg6.0:amd64 (2.0.6) ...
(Reading database ... 60461 files and directories currently installed.)
Preparing to unpack .../python3-lib2to3_3.8.10-0ubuntu1~20.04_all.deb ...
Unpacking python3-lib2to3 (3.8.10-0ubuntu1~20.04) over (3.6.9-1~18.04) ...
dpkg: error processing archive /var/cache/apt/archives/python3-lib2to3_3.8.10-0ubuntu1~20.04_all.deb (--unpack):
 trying to overwrite '/usr/lib/python3.9/lib2to3/Grammar.txt', which is also in package python3.9-lib2to3 3.9.11-1+bionic1
Preparing to unpack .../python3-distutils_3.8.10-0ubuntu1~20.04_all.deb ...
Unpacking python3-distutils (3.8.10-0ubuntu1~20.04) over (3.6.9-1~18.04) ...
dpkg: error processing archive /var/cache/apt/archives/python3-distutils_3.8.10-0ubuntu1~20.04_all.deb (--unpack):
 trying to overwrite '/usr/lib/python3.9/distutils/README', which is also in package python3.9-distutils 3.9.11-1+bionic1
Selecting previously unselected package libnettle7:amd64.
Preparing to unpack .../libnettle7_3.5.1+really3.5.1-2ubuntu0.2_amd64.deb ...
Unpacking libnettle7:amd64 (3.5.1+really3.5.1-2ubuntu0.2) ...
Errors were encountered while processing:
 /var/cache/apt/archives/python3-lib2to3_3.8.10-0ubuntu1~20.04_all.deb
 /var/cache/apt/archives/python3-distutils_3.8.10-0ubuntu1~20.04_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I've tried a few approaches which I found from this post https://github.com/deadsnakes/issues/issues/98 , which consisted of running:

sudo dpkg --install --force all /var/cache/apt/archives/python3-lib2to3_3.6.9-1~18.04_all.deb
sudo dpkg --install --force all /var/cache/apt/archives/python3-distutils_3.6.9-1~18.04_all.deb

and

sudo apt purge python3.8-distutils python3.8-lib2to3

But neither of them worked and I'm still getting the same error. Something else confuses me. If I'm running ubuntu 18.04, why are packages from 20.04 being unpacked? I recently tried upgrading to 20.04 but I had a lot of issues so I decided to hold off. Could that have something to do with it?

Apologies if I sound foolish, but this is all very new to me. My bootcamp set me up with a wsl dev environment and I'm pretty lost when it comes to solving any issues with it. It brings me such anxiety and I'm scared to run any commands, tbh. If anyone can help, that'd be fantastic.

Nmath
  • 12,333
Nunchuk
  • 101
  • Indeed, why are packages from 20.04 being unpacked? You should check your software sources and meanwhile do NOT mess with python versions, probably the #1 cause of broken systems around here. – ChanganAuto Apr 23 '22 at 22:50
  • WSL is not appropriate for all tasks and running a database is one of those tasks. See: https://docs.microsoft.com/en-us/windows/wsl/faq and https://stackoverflow.com/q/62495999 – Nmath Apr 23 '22 at 22:58
  • Hi, @ChanganAuto. Thanks for replying. Having different python versions definitely gave me issues when trying to upgrade to 20.04. It was the reason I held off on the upgrade. I ended up reverting back to python 2.7.17 because I guess 18.04 has it as it's default version, but I'm not sure. Besdies python, what other software sources should I check? – Nunchuk Apr 23 '22 at 22:59
  • You should check the software sources. Easy way is by opening Software & Updates > other software and check the PPAs you might have added. – ChanganAuto Apr 23 '22 at 23:03
  • @Nmath Thanks for the links. I just read through them. I wasn't aware of these issues. I was following these instructions (https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-database#install-mongodb) for installation, but now I wish I spent more time researching before beginning. – Nunchuk Apr 23 '22 at 23:05
  • WSL is still a work in progress. Things may have changed recently, so the problem may be that the instructions you were following are for 20.04, not for 18.04. Installing specific versions of packages can break a "regular" Ubuntu installation if you specify packages that aren't compatible with other packages and dependices for your version or distribution. Doing so on the wrong version can definitely cause the problems you are experiencing. Linux/Ubuntu is very different from Windows in how it handles dependencies. – Nmath Apr 23 '22 at 23:13
  • I see. I'm discovering that it can be quite difficult to navigate the dev world while using WSL. Thanks for your responses. I'll keep trying to find a way to solve this. – Nunchuk Apr 23 '22 at 23:23
  • @ChanganAuto my bad. Learning as I go. I found this post https://askubuntu.com/questions/148932/how-can-i-get-a-list-of-all-repositories-and-ppas-from-the-command-line-into-an and ran ls /etc/apt/sources.list.d which had an output of deadsnakes-ubuntu-ppa-bionic.list deadsnakes-ubuntu-ppa-bionic.list.distUpgrade mongodb-org-5.0.list. I wasn't expecting to find mongo in there. – Nunchuk Apr 23 '22 at 23:26

0 Answers0