update-notifier-common: ModuleNotFoundError: No module named 'debian'

Bug #2003411 reported by Swiss Knight
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
update-notifier (Ubuntu)
Invalid
High
Unassigned

Bug Description

```
$ sudo apt install ca-certificates-java update-notifier update-notifier-common
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be upgraded:
  ca-certificates-java update-notifier update-notifier-common
3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 260 kB of archives.
After this operation, 342 kB of additional disk space will be used.
Get:1 http://ch.archive.ubuntu.com/ubuntu jammy-updates/main amd64 update-notifier amd64 3.192.54.3 [62.5 kB]
Get:2 http://ch.archive.ubuntu.com/ubuntu jammy-updates/main amd64 update-notifier-common all 3.192.54.3 [185 kB]
Get:3 http://ch.archive.ubuntu.com/ubuntu jammy-updates/main amd64 ca-certificates-java all 20190909ubuntu1.1 [12.0 kB]
Fetched 260 kB in 0s (2’170 kB/s)
(Reading database ... 466189 files and directories currently installed.)
Preparing to unpack .../update-notifier_3.192.54.3_amd64.deb ...
Unpacking update-notifier (3.192.54.3) over (3.192.54) ...
Preparing to unpack .../update-notifier-common_3.192.54.3_all.deb ...
Unpacking update-notifier-common (3.192.54.3) over (3.192.54) ...
Preparing to unpack .../ca-certificates-java_20190909ubuntu1.1_all.deb ...
Unpacking ca-certificates-java (20190909ubuntu1.1) over (20190909) ...
Setting up update-notifier-common (3.192.54.3) ...
Traceback (most recent call last):
  File "/usr/lib/update-notifier/package-data-downloader", line 24, in <module>
    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.3); however:
  Package update-notifier-common is not configured yet.

dpkg: error processing package update-notifier (--configure):
 dependency problems - leaving unconfigured
Setting up ca-certificates-java (20190909ubuntu1.1) ...
Installing new version of config file /etc/ca-certificates/update.d/jks-keystore ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Processing triggers for libglib2.0-0:amd64 (2.72.4-0ubuntu1) ...
Processing triggers for libglib2.0-0:i386 (2.72.4-0ubuntu1) ...
Processing triggers for ca-certificates (20211016ubuntu0.22.04.1) ...
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...

done.
done.
Processing triggers for hicolor-icon-theme (0.17-2) ...
Errors were encountered while processing:
 update-notifier-common
 update-notifier
E: Sub-process /usr/bin/dpkg returned an error code (1)
```

On Ubuntu 22.04.1 LTS (5.15.0-56-generic x86_64 GNU/Linux)

ProblemType: Package
DistroRelease: Ubuntu 22.04
Package: update-notifier-common 3.192.54.3
ProcVersionSignature: Ubuntu 5.15.0-56.62-generic 5.15.64
Uname: Linux 5.15.0-56-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.3
AptOrdering:
 update-notifier:amd64: Install
 update-notifier-common:amd64: Install
 ca-certificates-java:amd64: Install
 NULL: ConfigurePending
Architecture: amd64
CasperMD5CheckResult: pass
Date: Fri Jan 20 09:29:22 2023
ErrorMessage: installed update-notifier-common package post-installation script subprocess returned error exit status 1
InstallationDate: Installed on 2022-01-01 (383 days ago)
InstallationMedia: Ubuntu 22.04 LTS "Jammy Jellyfish" - Alpha amd64 (20211230)
PackageArchitecture: all
Python3Details: /usr/bin/python3.10, Python 3.10.6, python3-minimal, 3.10.6-1~22.04
PythonDetails: N/A
RebootRequiredPkgs: Error: path contained symlinks.
RelatedPackageVersions:
 dpkg 1.21.1ubuntu2.1
 apt 2.4.8
SourcePackage: update-notifier
Title: package update-notifier-common 3.192.54.3 failed to install/upgrade: installed update-notifier-common package post-installation script subprocess returned error exit status 1
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Swiss Knight (swiss-knight) wrote :
Revision history for this message
Swiss Knight (swiss-knight) wrote :

I had to manually move those following files into a temporary folder before updating and upgrading the system again with apt in order for this error to disappear (it's blocking for apt):

```
$ sudo ls -l /var/lib/dpkg/info | grep -i update-notifier
-rw-r--r-- 1 root root 279 déc 13 20:43 update-notifier-common.conffiles
-rw-r--r-- 1 root root 16498 jan 20 09:29 update-notifier-common.list
-rw-r--r-- 1 root root 13304 déc 13 20:43 update-notifier-common.md5sums
-rwxr-xr-x 1 root root 3597 déc 13 20:43 update-notifier-common.postinst
-rwxr-xr-x 1 root root 1166 déc 13 20:43 update-notifier-common.postrm
-rwxr-xr-x 1 root root 384 déc 13 20:43 update-notifier-common.preinst
-rwxr-xr-x 1 root root 733 déc 13 20:43 update-notifier-common.prerm
-rw-r--r-- 1 root root 51 déc 13 20:43 update-notifier-common.triggers
-rw-r--r-- 1 root root 100 déc 13 20:43 update-notifier.conffiles
-rw-r--r-- 1 root root 3467 jan 20 09:29 update-notifier.list
-rw-r--r-- 1 root root 3778 déc 13 20:43 update-notifier.md5sums
-rwxr-xr-x 1 root root 110 déc 13 20:43 update-notifier.postinst
-rwxr-xr-x 1 root root 121 déc 13 20:43 update-notifier.postrm
-rwxr-xr-x 1 root root 318 déc 13 20:43 update-notifier.preinst

$ sudo mv /var/lib/dpkg/info/update-notifier.* /tmp/update-notifier/

$ sudo apt update
(...)

$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
#
# News about significant security updates, features and services will
# appear here to raise awareness and perhaps tease /r/Linux ;)
# Use 'pro config set apt_news=false' to hide this and future APT news.
#
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 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.3) ...
Setting up update-notifier (3.192.54.3) ...
Installing new version of config file /etc/xdg/autostart/ubuntu-advantage-notification.desktop ...
Installing new version of config file /etc/xdg/autostart/update-notifier.desktop ...

```

description: updated
Revision history for this message
Julian Andres Klode (juliank) wrote :

It seems you have messed up your system, have you replaced /usr/bin/python3 with something else, or installed a /usr/local/bin/python3?

update-notifier-common depends on python3-debian, so the debian module should be available at this point.

summary: - package update-notifier-common 3.192.54.3 failed to install/upgrade:
- installed update-notifier-common package post-installation script
- subprocess returned error exit status 1
+ update-notifier-common: ModuleNotFoundError: No module named 'debian'
Changed in update-notifier (Ubuntu):
status: New → Triaged
importance: Undecided → High
tags: added: foundations-todo
Changed in update-notifier (Ubuntu):
status: Triaged → Invalid
Revision history for this message
Swiss Knight (swiss-knight) wrote :

Hmm, interesting...

But I didn't remember changing Python3 itself:

```
$ ls -l /usr/local/bin/python*
ls: cannot access '/usr/local/bin/python*': No such file or directory
```

and:
```
$ ls -l /usr/bin/python*
lrwxrwxrwx 1 root root 10 aug 18 12:39 /usr/bin/python3 -> python3.10
-rwxr-xr-x 1 root root 5921160 nov 14 17:10 /usr/bin/python3.10
lrwxrwxrwx 1 root root 34 nov 14 17:10 /usr/bin/python3.10-config -> x86_64-linux-gnu-python3.10-config
lrwxrwxrwx 1 root root 17 aug 18 12:39 /usr/bin/python3-config -> python3.10-config
-rwxr-xr-x 1 root root 960 dec 23 2020 /usr/bin/python3-futurize
-rwxr-xr-x 1 root root 964 dec 23 2020 /usr/bin/python3-pasteurize
-rwxr-xr-x 1 root root 977 dec 24 2021 /usr/bin/python-dotenv
```

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.