do-release-upgrade to switch from 16.04 to 18.04, something failed and machine was left in a "in between" state, with lots of broken dependencies issues. My package tree is a mess, I am desperate... ;-)
I tried lots of things (including
dpkg --configure -a, randomly removing packages with
dpkg --force depends -P <pkg-name>, plus other things), but I am kinda stuck at present.
So, when I try:
$ 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: (here 20 lines) The following additional packages will be installed: ... (here 5 lines) Suggested packages: ... more Recommended packages: ... more The following packages will be REMOVED: ... more The following NEW packages will be installed: ... more (10 lines) 28 upgraded, 6 newly installed, 1 to remove and 327 not upgraded. 228 not fully installed or removed. Need to get 0 B/13,3 MB of archives. After this operation, 2 771 kB of additional disk space will be used. Do you want to continue? [Y/n]
Up to here, nothing I am afraid of. But now, entering
Extracting templates from packages: 100% (Reading database ... 977800 files and directories currently installed.) Removing ubuntu-advantage-tools (27.0.2~18.04.1) ... Traceback (most recent call last): File "<string>", line 2, in <module> File "/usr/lib/python3/dist-packages/uaclient/apt.py", line 9, in <module> from uaclient import gpg File "/usr/lib/python3/dist-packages/uaclient/gpg.py", line 3, in <module> import shutil ModuleNotFoundError: No module named 'shutil' dpkg: error processing package ubuntu-advantage-tools (--remove): installed ubuntu-advantage-tools package pre-removal script subprocess returned error exit status 1 Errors were encountered while processing: ubuntu-advantage-tools E: Sub-process /usr/bin/dpkg returned an error code (1)
So this sounds like a Python error, from what I understand, it can't find
So I manually downloaded what I thought was the thing:
and installed manually with:
dpkg -i sudo dpkg -i python-backports-shutil-get-terminal-size_1.0.0-5_all.deb
apt --fix-broken install again ends up at the same point.
I have limited knowledge with Python, so I can't be sure this is the real issue, but any help is welcome. Else, next step will be probably reinstalling from scratch, but I'd really prefer to avoid that.
At present I am able to manually install packages (download from https://packages.ubuntu.com/ then
dpkg -i) but that's about it, everything else fails.
For example, if I try to install
$ sudo apt-get install libpython3.6-stdlib
libpython3.6-stdlib : Depends: libpython3.6-minimal (= 3.6.9-1~18.04ubuntu1.4) but 3.6.13-1+xenial2 is to be installed
which means that I still have packages from 16.04 (Xenial).
How can I manually remove all the 16.04 packages?
Additional info (machine now boots only with a console):
$ python --version=> Python 3.6.13
$ lsb_release -ais not available
$ uname -atells me its a 4.15 kernel (which seem consistent with 18.04)