2

I am trying to upgrade from 16.04.6 LTS to 18.04.3 LTS. apt-get update. upgrade, and dist-upgrade work without issue. But when I try to run do-release-upgrade it fails with the following error:

$ sudo do-release-upgrade
[sudo] password for punknubbins:
Traceback (most recent call last):
  File "/usr/bin/do-release-upgrade", line 11, in <module>
    from UpdateManager.Core.MetaRelease import MetaReleaseCore
  File "/usr/lib/python3/dist-packages/UpdateManager/Core/MetaRelease.py", line 25, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

I have looked online and tried everything I found. From reinstalling python3, to creating a link to point /usr/lib/python3/dist-packages/apt_pkg.cpython-34m-i386-linux-gnu.so to /usr/lib/python3/dist-packages/apt_pkg.cpython-35m-i386-linux-gnu.so, and finally to setting my default python3 to 3.4/3.5/3.6. None of which worked.

Now, this is a headless server running in a closet in an office across town so driving over, hooking up a monitor and keyboard, and upgrading from external media is frustratingly manual. Is there a way to just download the install ISO to this device and update it from that source? If not, what are we supposed to do when the automatic upgrade process doesn't work?

Zanna
  • 70,465

1 Answers1

1

Try the following command:

$ sudo apt install --reinstall python3 python python3-minimal
$ sudo apt --fix-broken install

Followed by:

$ sudo apt update && sudo apt upgrade
$ sudo do-release-upgrade

Reboot:

$ sudo reboot     
Error404
  • 7,440