Fails to remove /var/lib/command-not-found/ when package is purged

Bug #1877650 reported by Daniel Richard G.
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
command-not-found (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

This concerns command-not-found 20.04.2 in Ubuntu focal.

The apt-get invocation largely tells the story:

# apt-get --purge --autoremove remove command-not-found
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  command-not-found*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 35.8 kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 95222 files and directories currently installed.)
Removing command-not-found (20.04.2) ...
(Reading database ... 95216 files and directories currently installed.)
Purging configuration files for command-not-found (20.04.2) ...
dpkg: warning: while removing command-not-found, directory '/var/lib/command-not-found' not empty so not removed

# ls -l /var/lib/command-not-found/
total 3020
-rw-r--r-- 1 root root 3084288 May 8 14:54 commands.db
-rw-r--r-- 1 root root 2442 May 8 14:54 commands.db.metadata

I'm purging the package, these files clearly belong to it, that directory should be gone.

(Side note: apt-get should be reporting "python3-commandnotfound is no longer needed," since command-not-found is the only package that depends on it, but for some reason this isn't happening. That's why I had specified the --autoremove; I was expecting to remove two packages.)

Tags: focal groovy
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Thanks for reporting.

I get the same warning when running `sudo apt purge command-not-found` on Ubuntu Groovy. I suppose these files are generated, but not marked as part of command-not-found.

`dpkg -S /var/lib/command-not-found` correctly identifies that the directory is part of `command-not-found` (when the package is installed), but is unable to find matches for the files contained within.

Changed in command-not-found (Ubuntu):
status: New → Confirmed
tags: added: groovy
Revision history for this message
Daniel Richard G. (skunk) wrote :

I wouldn't expect dpkg to know about the database files, but they should at least be deleted by a package script (prerm?) when the package is removed/purged.

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.