1

Starting with a PC happily running Ubuntu 18.04 desktop, I copied the entire drive as a backup, then tried to upgrade it to 22.04. Running do-release-upgrade brought it up to 20.04, and it seems happy running that. After a few reboots I tried upgrading it from 20.04 to 22.04. It always hangs in the same spot, right after:

Get:184 http://ports.ubuntu.com/ubuntu-ports jammy-backports/universe DEP-11 64x64 Icons [13.4 kB]
Get:185 http://ports.ubuntu.com/ubuntu-ports jammy-backports/universe amd64 c-n-f Metadata [480 B]
Get:186 http://ports.ubuntu.com/ubuntu-ports jammy-backports/multiverse amd64 c-n-f Metadata [116 B]
Fetched 504 MB in 6s (0 B/s)

The longest I've left it like that is at least a few hours. It's stuck. Control-C gets out of it, and the traceback is:

Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 27, in <module>
    col.create(db)
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 95, in create
    self._fill_commands(con)
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 140, in _fill_commands
    if sub.wait() != 0:
  File "/usr/lib/python3.8/subprocess.py", line 1083, in wait
    return self._wait(timeout=timeout)
  File "/usr/lib/python3.8/subprocess.py", line 1806, in _wait
    (pid, sts) = self._try_wait(0)
  File "/usr/lib/python3.8/subprocess.py", line 1764, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)

At work we have a VM that had the same problem, going from 20.04 to 22.04. In the end they wound up just making a fresh 22.04 VM. I do some work stuff on this PC, so it's possible some particular package is to blame and both systems had that package installed.

While it's in that state:

# tail -n 10 /var/log/dist-upgrade/main.log
2023-04-02 12:29:04,801 DEBUG url_downloadable: http://ports.ubuntu.com/ubuntu-ports//dists/jammy/Release
2023-04-02 12:29:04,801 DEBUG s='http' n='ports.ubuntu.com' p='/ubuntu-ports//dists/jammy/Release' q='' f=''
2023-04-02 12:29:04,980 DEBUG entry 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted universe multiverse' updated to new dist
2023-04-02 12:29:04,980 DEBUG examining: 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted universe multiverse'
2023-04-02 12:29:04,980 DEBUG entry 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted universe multiverse' updated to new dist
2023-04-02 12:29:04,980 DEBUG examining: 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-security main restricted universe multiverse'
2023-04-02 12:29:04,980 DEBUG entry 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted universe multiverse' updated to new dist
2023-04-02 12:29:04,981 DEBUG examining: 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted universe multiverse'
2023-04-02 12:29:04,981 DEBUG entry 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse' updated to new dist
2023-04-02 12:29:04,986 DEBUG running doUpdate() (showErrors=True)

I've tried a lot of different things suggested in other threads here. For example I moved all .list files from /etc/apt/ and /etc/apt/sources.list.d/ that had anything but "focal" listed (some had been "bionic"). And for example I can run these commands after a reboot, and I get the same issue:

apt-get clean
apt --fix-broken install
apt-get update
apt-get upgrade
apt-get clean
do-release-upgrade

dpkg --print-architecture and dpkg --print-foreign-architectures please edit your question for that.

scott@scott-XPS-8900:~$ dpkg --print-architecture
amd64
scott@scott-XPS-8900:~$ dpkg  --print-foreign-architectures
i386
arm64

The aforementioned work stuff involves compiling for arm64. I'm not sure why i386 is there (EDIT: "dpkg --list | grep i36" says "syslinux-legacy").

UPDATE: There are no longer any foreign architectures. I purged those packages and removed the i386 and arm64 architectures as described in How to remove all i386 packages from Ubuntu 64bit?. No improvement.

it looks for me something with python/python3 is broken. sudo apt update

Earlier on I tried:

sudo apt-get install --reinstall python3-apt

At the moment "apt update" is hanging. It wasn't doing that earlier:

scott@scott-XPS-8900:~$ sudo apt update
Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://ca.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://ca.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://ca.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports focal InRelease
Hit:6 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Hit:7 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
Hit:8 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease

(then it just sits there) After a few minutes, control-C:

Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 27, in <module>
    col.create(db)
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 95, in create
    self._fill_commands(con)
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 140, in _fill_commands
    if sub.wait() != 0:
  File "/usr/lib/python3.8/subprocess.py", line 1083, in wait
    return self._wait(timeout=timeout)
  File "/usr/lib/python3.8/subprocess.py", line 1806, in _wait
    (pid, sts) = self._try_wait(0)
  File "/usr/lib/python3.8/subprocess.py", line 1764, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)

Why are the ports.ubuntu.com repo still active?

It seems they're left over from when I previously had foreign architectures (i386, arm64) enabled. I commented them out in /etc/apt/sources.list and ran apt update again. It still hangs.

Then I tried:

sudo pkill cnf-update-db
sudo rm -rf /var/lib/apt/lists/*
sudo apt update``

Again it hangs, and control-C produces the same stack trace as above.

After much digging through the Python code in the control-C backtrace and doing a bunch of searches, I found: CommandNotFound.db.creator import DbCreator on ubuntu

That got apt-get update going:

sudo apt-get remove --purge python3-apt
sudo apt autoremove
apt-get install python3-apt
# Probably most of the next few commands weren't needed
sudo rm -rf /var/lib/apt/lists/*
sudo apt-get clean
sudo apt-get check
sudo apt --fix-broken install
sudo apt-get update

I'll reboot and try do-release-upgrade again, and report back.(UPDATE: it worked -- see my posted solution)

5
  • 1
    dpkg --print-architecture and dpkg --print-foreign-architectures please edit your question for that.
    – nobody
    Apr 2, 2023 at 17:16
  • Please addapt this to your situation for arm64 packages askubuntu.com/questions/113301/…
    – nobody
    Apr 2, 2023 at 17:32
  • 2
    it looks for me something with python/python3 is broken. sudo apt update please edit your question for output not as comment.
    – nobody
    Apr 3, 2023 at 11:07
  • Why are the ports.ubuntu.com repo still active?
    – nobody
    Apr 3, 2023 at 13:41
  • 1
    Please remove the solution from the question and add it as an answer.
    – Bruni
    Apr 6, 2023 at 14:02

1 Answer 1

1

After the large number of things I tried (listed in the question), do-release-upgrade finally ran without hanging. My PC is now running Ubuntu 22.04.

My suspicion is that the purge and install of python-apt (which I got from CommandNotFound.db.creator import DbCreator on ubuntu) was the most important step, but it may have just been the last important step:

sudo apt-get remove --purge python3-apt
sudo apt autoremove
apt-get install python3-apt

My original issue was solved, but do-release-upgrade reported some errors. I would suggest to anyone with the same problem I had that you do the python3-apt purge/install, then try do-release-upgrade, doing the other things I tried only if that doesn't work.

Errors were encountered while processing:
 openmpi-bin
 mpi-default-bin
 libcoarrays-openmpi-dev:amd64
 libopenmpi-dev:amd64
 libboost-mpi-python1.74.0
 libboost-mpi-python1.74-dev
 libboost-mpi-python-dev
 libboost-all-dev
 mpi-default-dev
 libboost-mpi1.74-dev
 libboost-mpi-dev

Upgrade complete

The upgrade has completed but there were errors during the upgrade
process.

I resolved those thus (mainly based on Problem with package installation - linux-image-server):

dpkg --remove --force-remove-reinstreq  openmpi-bin
dpkg --remove --force-remove-reinstreq  mpi-default-bin
dpkg --remove --force-remove-reinstreq  libcoarrays-openmpi-dev:amd64
dpkg --remove --force-remove-reinstreq  libopenmpi-dev:amd64
dpkg --remove --force-remove-reinstreq  libboost-mpi-python1.74.0
dpkg --remove --force-remove-reinstreq  libboost-mpi-python1.74-dev
dpkg --remove --force-remove-reinstreq  libboost-mpi-python-dev
dpkg --remove --force-remove-reinstreq  libboost-all-dev
dpkg --remove --force-remove-reinstreq  mpi-default-dev
dpkg --remove --force-remove-reinstreq  libboost-mpi1.74-dev
dpkg --remove --force-remove-reinstreq  libboost-mpi-dev

# ... but one package was more stubborn, indicating:
# update-alternatives: error: /var/lib/dpkg/alternatives/mpi corrupt: slave link same as main link /usr/bin/mpicc
# Fixed with:
sudo update-alternatives --remove-all mpi
sudo rm /var/lib/dpkg/alternatives/mpi
sudo dpkg --remove --force-remove-reinstreq openmpi-bin

# then checking for errors:
apt autoremove
apt upgrade

All good now.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .