/usr/lib/cnf-update-db: ModuleNotFoundError: No module named 'CommandNotFound' when doing "sudo apt update"

Solution 1:

In all currently supported versions of Ubuntu open the terminal and type:

apt download python3-minimal
sudo apt install --reinstall ./python3-minimal_*.deb
sudo apt install -f

If that doesn't work a simple reboot will sometimes solve this problem.

Solution 2:

This solved my same/similar issue:

cd /usr/lib/python3/dist-packages
ls -la /usr/lib/python3/dist-packages
sudo cp apt_pkg.cpython-36m-x86_64-linux-gnu.so apt_pkg.so

Source: Linux Question

Solution 3:

Package libdvdcss2-1.4.2-1 was removed, stop processing...

was plaguing my system too ... and for a newbie fuller explanation of the above method - THAT WORKED - WOOHOO! ... here is what I did!

Codes are used inside of terminal of course ...

sudo find / -name 'CommandNotFound'

resulted in this, showing this obscure path

[sudo] password for ack: find: ‘/run/user/1000/gvfs’: Permission denied

/usr/lib/python3/dist-packages/CommandNotFound

So the unobvious part of the above method quoted here ...

sudo cp -r /path/of/CommandNotFound /usr/lib/

resulted in an error, obviously as it is "Generic" so to speak

but this altered version with this file path found in the first command solved the problem ... "/usr/lib/python3/dist-packages/CommandNotFound"

$ sudo cp -r /usr/lib/python3/dist-packages/CommandNotFound /usr/lib/

and the problem is gone

I hope this helps, Mark