Autoremove errors

Ubuntu 22.04 on Dell Latitude E5570

Following an Ubuntu update I tried “sudo apt autoremove” to remove obsolete files, and got the output shown below. I would be grateful for help in resolving the issues shown.
Many thanks.
Keith


keith@E5570:~$ sudo apt autoremove
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up update-notifier-common (3.192.54.8) …
Traceback (most recent call last):

  • File “/usr/lib/update-notifier/package-data-downloader”, line 24, in *
  • import debian.deb822*
    ModuleNotFoundError: No module named ‘debian’
    dpkg: error processing package update-notifier-common (–configure):
  • installed update-notifier-common package post-installation script subprocess returned error exit status 1*
    dpkg: dependency problems prevent configuration of update-notifier:
  • update-notifier depends on update-notifier-common (= 3.192.54.8); however:*
  • Package update-notifier-common is not configured yet.*

dpkg: error processing package update-notifier (–configure):

  • dependency problems - leaving unconfigured*
    dpkg: dependency problems prevent configuration of ubuntu-desktop:
  • ubuntu-desktop depends on update-notifier; however:*
  • Package update-notifier is not configured yet.*

dpkg: error processing package ubuntu-desktop (–configure):

  • dependency problems - leaving unconfigured*
    dpkg: dependency problems prevent configuration of ubuntu-desktop-minimal:
  • ubuntu-desktop-minimal depends on update-notifier; however:*
  • Package update-notifier is not configured yet.*

dpkg: error processing package ubuntu-desktop-minimal (–configure):

  • dependency problems - leaving unconfigured*
    No apport report written because the error message indicates it’s a follow-up error from a previous failure.
  • No apport report written because the error message indicates it’s a follow-up error from a previous failure.*
    No apport report written because MaxReports has already been reached
    Errors were encountered while processing:
  • update-notifier-common*
  • update-notifier*
  • ubuntu-desktop*
  • ubuntu-desktop-minimal*
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    keith@E5570:~$

what happens if you do;

apt install -f

It sounds like there was an earlier installation problem (possibly with “update-notifier”) which is messing with further updates, so autoremove in itself is likely not the actualy problem.

Just watch out for the prompts it offers, in some rare circumstances it can think the solution is to uninstall your desktop … which may not be what you want (!)

The result is pretty much the same:

> keith@E5570:~$ sudo apt install -f
*> [sudo] password for keith: *
> Reading package lists… Done
> Building dependency tree… Done
> Reading state information… Done
> 0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
> 4 not fully installed or removed.
> After this operation, 0 B of additional disk space will be used.
> Setting up update-notifier-common (3.192.54.8) …
> Traceback (most recent call last):
> File “/usr/lib/update-notifier/package-data-downloader”, line 24, in
> import debian.deb822
> ModuleNotFoundError: No module named ‘debian’
> dpkg: error processing package update-notifier-common (–configure):
> installed update-notifier-common package post-installation script subprocess returned error exit status 1
> dpkg: dependency problems prevent configuration of update-notifier:
> update-notifier depends on update-notifier-common (= 3.192.54.8); however:
> Package update-notifier-common is not configured yet.
*> *
> dpkg: error processing package update-notifier (–configure):
> dependency problems - leaving unconfigured
> dpkg: dependency problems prevent configuration of ubuntu-desktop:
> ubuntu-desktop depends on update-notifier; however:
> Package update-notifier is not configured yet.
*> *
> dpkg: error processing package ubuntu-desktop (–configure):
> dependency problems - leaving unconfigured
> dpkg: dependency problems prevent configuration of ubuntu-desktop-minimal:
> ubuntu-desktop-minimal depends on update-notifier; however:
> Package update-notifier is not configured yet.
*> *
> dpkg: error processing package ubuntu-desktop-minimal (–configure):
> dependency problems - leaving unconfigured
> No apport report written because the error message indicates it’s a follow-up error from a previous failure.
> No apport report written because the error message indicates it’s a follow-up error from a previous failure.
> No apport report written because MaxReports has already been reached
> Errors were encountered while processing:
> update-notifier-common
> update-notifier
> ubuntu-desktop
> ubuntu-desktop-minimal
> E: Sub-process /usr/bin/dpkg returned an error code (1)
> keith@E5570:~$

Ok, how about;

sudo apt install python3-debian

And if it’s complains because it’s already installed;

sudo apt install --reinstall python3-debian

And if that does something, top it off with;

sudo apt install -f

Sounds like you’ve installed something that’s upset the Python dependency tree.

No - just the same (or similar) result:

keith@E5570:~$ sudo install python3-debian
[sudo] password for keith: *
install: missing destination file operand after ‘python3-debian’
Try ‘install --help’ for more information.
*
keith@E5570:~$ sudo apt install --reinstall python3-debian

Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
0 to upgrade, 0 to newly install, 1 reinstalled, 0 to remove and 0 not to upgrade.
4 not fully installed or removed.
Need to get 107 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 Index of /ubuntu jammy-updates/main amd64 python3-debian all 0.1.43ubuntu1.1 [107 kB]
*Fetched 107 kB in 0s (889 kB/s) *
(Reading database … 310157 files and directories currently installed.)
Preparing to unpack …/python3-debian_0.1.43ubuntu1.1_all.deb …
Unpacking python3-debian (0.1.43ubuntu1.1) over (0.1.43ubuntu1.1) …
Setting up python3-debian (0.1.43ubuntu1.1) …
Setting up update-notifier-common (3.192.54.8) …
Traceback (most recent call last):

  • File “/usr/lib/update-notifier/package-data-downloader”, line 24, in *
  • import debian.deb822*
  • File “/usr/lib/python3/dist-packages/debian/deb822.py”, line 240, in *
  • import chardet*
    ModuleNotFoundError: No module named ‘chardet’
    dpkg: error processing package update-notifier-common (–configure):
  • installed update-notifier-common package post-installation script subprocess returned error exit status 1*
    dpkg: dependency problems prevent configuration of update-notifier:
  • update-notifier depends on update-notifier-common (= 3.192.54.8); however:*
  • Package update-notifier-common is not configured yet.*

dpkg: error processing package update-notifier (–configure):

  • dependency problems - leaving unconfigured*
    dpkg: dependency problems prevent configuration of ubuntu-desktop:
  • ubuntu-desktop depends on update-notifier; however:*
  • Package update-notifier is not configured yet.*

dpkg: error processing package ubuntu-desktop (–configure):

  • dependency problems - leaving unconfigured*
    dpkg: dependency problems prevent configuration of ubuntu-desktop-minimal:
  • ubuntu-desktop-minimal depends on update-notifier; however:*
  • Package update-notifier is not configured yet.*

dpkg: error processing package ubuntu-desktop-minimal (–configure):

  • dependency problems - leaving unconfigured*
    No apport report written because the error message indicates it’s a follow-up error from a previous failure.
    No apport report written because the error message indicates it’s a follow-up error from a previous failure.
  • No apport report written because MaxReports has already been reached*
  • Errors were encountered while processing:*
  • update-notifier-common*
  • update-notifier*
  • ubuntu-desktop*
  • ubuntu-desktop-minimal*
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    keith@E5570:~$

I don’t remember having installed anything recently, but I have been having stability problems with the laptop.

sudo apt install python3-chardet

Its a dependency issue with the debian or ubuntu build of some of the python packages … typically caused by the use of pip.

You did try to help me last year by using pip for something, I can’t remember, so that might be the cause of my woes.
I originally bought this laptop for an old mate who then decided he didn’t want it! so I was lumbered with it and it has never really been good with Linux.
It’s beginning to look like I shall need to re-install Ubuntu. What do you think?

In the meantime, here is the output of your command (~ same as before):

keith@E5570:~$ sudo apt install python3-chardet
*[sudo] password for keith: *
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
python3-chardet is already the newest version (4.0.0-1).
python3-chardet set to manually installed.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up update-notifier-common (3.192.54.8) …
Traceback (most recent call last):

  • File “/usr/lib/update-notifier/package-data-downloader”, line 24, in *
  • import debian.deb822*
  • File “/usr/lib/python3/dist-packages/debian/deb822.py”, line 240, in *
  • import chardet*
    ModuleNotFoundError: No module named ‘chardet’
    dpkg: error processing package update-notifier-common (–configure):
  • installed update-notifier-common package post-installation script subprocess returned error exit status 1*
    dpkg: dependency problems prevent configuration of update-notifier:
  • update-notifier depends on update-notifier-common (= 3.192.54.8); however:*
  • Package update-notifier-common is not configured yet.*

dpkg: error processing package update-notifier (–configure):

  • dependency problems - leaving unconfigured*
    dpkg: dependency problems prevent configuration of ubuntu-desktop:
  • ubuntu-desktop depends on update-notifier; however:*
  • Package update-notifier is not configured yet.*

dpkg: error processing package ubuntu-desktop (–configure):

  • dependency problems - leaving unconfigured*
    dpkg: dependency problems prevent configuration of ubuntu-desktop-minimal:
  • ubuntu-desktop-minimal depends on update-notifier; however:*
  • Package update-notifier is not configured yet.*

dpkg: error processing package ubuntu-desktop-minimal (–configure):

  • dependency problems - leaving unconfigured*
    No apport report written because the error message indicates it’s a follow-up error from a previous failure. * No apport report written because the error message indicates it’s a follow-up error from a previous failure.
  • No apport report written because MaxReports has already been reached*
    Errors were encountered while processing:
  • update-notifier-common*
  • update-notifier*
  • ubuntu-desktop*
  • ubuntu-desktop-minimal*
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    keith@E5570:~$

Ok, so whatever happened broke “apt” … so it was probably the “last” thing you did with apt that caused a problem. If I had to guess, maybe “autoremove” didn’t spot that apt was dependent on chardet and removed it?

Your root problem looks like “update-notifier-common”, but it’s not. Try this;

$ python3
Python 3.12.7 (main, Oct  3 2024, 15:15:22) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import chardet

I’m expecting the import to give you a “module not found” error. In which case the problem is that “apt” can’t fix anything because one of the core libraries it uses has gotten itself uninstalled (somehow). You can fix this (warning: there be dragons here) relatively easily using pip (!)

pip3 install chardet --break-system-packages

Ironic eh?!
I’m kinda hoping that with this package installed (via a “different” package manager) apt will now run … now try

sudo apt install -f

again …

If that works (!) you can clean what we just did by;

# install the "proper "system level version of chardet
sudo apt install python3-chardet
# remove the chardet we installed with pip
pip3 uninstall chardet

Sorry for the delay - leaking roof.

Here’s the first part of the output:

> keith@E5570:~$ python3

Python 3.10.12 (main, Sep 11 2024, 15:47:36) [GCC 11.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import chardet
Traceback (most recent call last):

  • File “”, line 1, in *
    ModuleNotFoundError: No module named ‘chardet’
    >>> pip3 install chardet --break-system-packages
  • File “”, line 1*
  • pip3 install chardet --break-system-packages*
  •     ^^^^^^^*
    

SyntaxError: invalid syntax
*>>> *
Ctrl+z
[1]+ Stopped python3
keith@E5570:~$

So I tried:

keith@E5570:~$ pip3 install **python3-**chardet --break-system-packages

Usage:
pip3 install [options] [package-index-options] …
pip3 install [options] -r [package-index-options] …
pip3 install [options] [-e] …
pip3 install [options] [-e] …
pip3 install [options] <archive url/path> …

no such option: --break-system-packages
keith@E5570:~$

Could you have mistyped the instruction? Sorry to be a pain.

Yesh, sorry, it was python3-chardet , the break-system-packages is a newer option, if you have an older distro, try it without. (that option is just to “make” it work, if it works without, that’s fine)

Yes, I guessed that might be the case and tried it as shown and got:

keith@E5570:~$ pip3 install python3-chardet --break-system-packages

Usage:
pip3 install [options] [package-index-options] …
pip3 install [options] -r [package-index-options] …
pip3 install [options] [-e] …
pip3 install [options] [-e] …
pip3 install [options] <archive url/path> …

no such option: --break-system-packages
keith@E5570:~$

…Unless I have misunderstood.

And without “–break-system-packages” ?

Also, what do you get from;

type pip3

And;

pip3 --version

?

keith@E5570:~$ pip3 install python3-chardet
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement python3-chardet (from versions: none)
ERROR: No matching distribution found for python3-chardet
keith@E5570:~$ type pip3
pip3 is hashed (/usr/bin/pip3)
keith@E5570:~$ pip3 --version
pip 22.0.2 from /usr/lib/python3/dist-packages/pip (python 3.10)
keith@E5570:~$

sudo pip3 install chardet

(pip is the python package manager, so the python3 prefix is superfluous)

keith@E5570:~$ sudo pip3 install chardet
[sudo] password for keith:
Collecting chardet
Downloading chardet-5.2.0-py3-none-any.whl (199 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 199.4/199.4 KB 2.6 MB/s eta 0:00:00
Installing collected packages: chardet
Successfully installed chardet-5.2.0
WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: 12. Virtual Environments and Packages — Python 3.13.0 documentation
keith@E5570:~$

…which looks promising.
Then a manual update/upgrade gives:

keith@E5570:~$ sudo apt update
Hit:1 Index of /ubuntu jammy InRelease
Hit:2 Index of /ubuntu jammy-updates InRelease
Hit:3 Index of /ubuntu jammy-backports InRelease
Hit:4 https://brave-browser-apt-release.s3.brave.com stable InRelease
Hit:5 https://linux.teamviewer.com/deb stable InRelease
Hit:6 Index of /ubuntu jammy-security InRelease
Hit:7 Index of /debian/ stable InRelease
Get:8 https://mega.nz/linux/repo/xUbuntu_22.04 ./ InRelease [2,961 B]
Hit:9 Index of /ubuntu/ jammy InRelease
Ign:10 Index of /ubuntu/ disco InRelease
Hit:11 Index of /ubuntu/ disco Release
Fetched 2,961 B in 1s (2,376 B/s)
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
1 package can be upgraded. Run ‘apt list --upgradable’ to see it.
N: Skipping acquisition of configured file ‘main/binary-i386/Packages’, as repository ‘https://brave-browser-apt-release.s3.brave.com stable InRelease’ doesn’t support architecture ‘i386’
W: http://linux.dropbox.com/ubuntu/dists/disco/Release.gpg: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

keith@E5570:~$ sudo apt upgrade
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Calculating upgrade… Done
Get more security updates through Ubuntu Pro with ‘esm-apps’ enabled:
libmagickcore-6.q16-dev libvlc5 libgsl-dbg libimage-magick-perl vlc-data
gsasl-common libvlccore9 libmagickwand-dev libheif1 imagemagick
libopenexr-dev libavdevice58 ffmpeg libopenexr25 libmagick+±6.q16-8
libpostproc55 libmagickcore-6.q16-6-extra libgsasl7 libavcodec58
libimage-magick-q16-perl libmagickwand-6.q16-6 libavutil56 imagemagick-6.q16
libswscale5 libeditorconfig0 libmagickcore-6.q16-6 libgsl27 libswresample3
imagemagick-6-common vlc-plugin-video-output libmagickcore-6-arch-config
libavformat58 libmagickwand-6-headers libgslcblas0 libde265-0 libpmix2
libmagickwand-6.q16-dev libmagickcore-6-headers libvlc-bin vlc-plugin-base
libavfilter7
Learn more about Ubuntu Pro at Ubuntu Pro | Ubuntu
The following packages have been kept back:
distro-info-data
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up update-notifier-common (3.192.54.8) …
update-notifier-download.service is a disabled or a static unit not running, not starting it.
> update-notifier-motd.service is a disabled or a static unit not running, not starting it.
Setting up update-notifier (3.192.54.8) …
Setting up ubuntu-desktop-minimal (1.481.4) …
Setting up ubuntu-desktop (1.481.4) …
keith@E5570:~$

…which doesn’t look promising. I wonder if any upgrade has in fact occurred.

Also:

keith@E5570:~$ apt -a list --upgradable
Listing… Done
distro-info-data/jammy-updates,jammy-updates 0.52ubuntu0.8 all [upgradable from: 0.52ubuntu0.7]
distro-info-data/jammy-security,jammy-security,now 0.52ubuntu0.7 all [installed,upgradable to: 0.52ubuntu0.8]
distro-info-data/jammy,jammy 0.52 all
keith@E5570:~$

One wonders if they are upgradable, they weren’t actually upgraded.
Sorry to give you so much hassle.

Erm, that looks to be working to me … not errors at least.

You could try;

sudo apt install -f

You’ll probably find any odd messages like that iron out when the next update / apt upgrade happens …

keith@E5570:~$ sudo apt install -f
[sudo] password for keith:
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
keith@E5570:~$

Which is encouraging. I await the next update instalment with bated breath!
Very many thanks for your patience.

1 Like