[HOME] [DOWNLOAD] [DOCS] [NEWS] [SUPPORT] [TIPS] [ISSUES] [DONATE]

UnicodeDecodeError when trying to update

Hey all,

Trying to update my workstation to the lastest version, but I am getting this error and not sure how to resolve it?
Thanks for any assistance in advance.

Traceback (most recent call last):
File “/usr/lib/cnf-update-db”, line 26, in
col.create(db)
File “/usr/share/command-not-found/CommandNotFound/db/creator.py”, line 94, in create
self._fill_commands(con)
File “/usr/share/command-not-found/CommandNotFound/db/creator.py”, line 132, in _fill_commands
self._parse_single_contents_file(con, f, fp.stdout)
File “/usr/share/command-not-found/CommandNotFound/db/creator.py”, line 228, in _parse_single_contents_file
l = l.decode(“utf-8”)
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xed in position 15: invalid continuation byte
Fetched 218 kB in 7s (31.2 kB/s)
Reading package lists…
E: Problem executing scripts APT::Update::Post-Invoke-Success ‘if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi’
E: Sub-process returned an error code

Hello and welcome!

This might help:

sudo rm /var/cache/command-not-found/*
sudo rm /var/lib/command-not-found/*
sudo update-command-not-found

Technical references for developers:

  • /etc/apt/apt.conf.d/50command-not-found

Thanks for the reply and the welcome Patrick :slight_smile:

Unfortunately though, when I run the update command I get the exact same error as above?

I got “No such file or directory” for the var/cache line, and nothing for the lib/cache.

Not sure if it assists at all, but this is the full echo from “sudo apt-get-update-plus dist-upgrade”

user@host:~$ sudo apt-get-update-plus dist-upgrade
Hit:1 http://uk.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://uk.archive.ubuntu.com/ubuntu xenial-security InRelease [109 kB]
Hit:3 tor+https://deb.whonix.org buster InRelease
Get:4 http://uk.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:5 http://uk.archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages [761 kB]
Get:8 http://uk.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [1,046 kB]
Get:6 tor+https://cdn-aws.deb.debian.org/debian-security buster/updates InRelease [39.1 kB]
Hit:7 tor+https://cdn-aws.deb.debian.org/debian buster InRelease
Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 26, in <module>
    col.create(db)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 94, in create
    self._fill_commands(con)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 132, in _fill_commands
    self._parse_single_contents_file(con, f, fp.stdout)
  File "/usr/share/command-not-found/CommandNotFound/db/creator.py", line 228, in _parse_single_contents_file
    l = l.decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 15: invalid continuation byte
Fetched 2,064 kB in 12s (170 kB/s)
Reading package lists...
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code

Mixing with third party repositories can break the system in various ways. That is mentioned here:

This might be done such event.

You could try to live without command-not-found in that VM.

sudo rm /etc/apt/apt.conf.d/50command-not-found

If that does not help, review other files in folder /etc/apt/apt.conf.d on subject of command-not-found.

Perfect, thanks @Patrick. Removed the ubuntu.list file and the update worked perfectly.

[Imprint] [Privacy Policy] [Cookie Policy] [Terms of Use] [E-Sign Consent] [DMCA] [Investors] [Priority Support] [Professional Support]