Apt will not purge deinstalled/removed packages (unlike "dpkg -P")

Bug #244598 reported by Alexander Blinne
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apt (Debian)
Fix Released
Unknown
apt (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: apt

I wanted to purge a packages config-files after i had it removed already, apt won't do the job although dpkg does:

alex@cappuccino:/lib/firmware$ dpkg-query -W -f='${Status} ${Package}\n'|grep deinstall
deinstall ok config-files bcm43xx-fwcutter

alex@cappuccino:/lib/firmware$ sudo apt-get purge bcm43xx-fwcutter
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut
Reading state information... Fertig
Paket bcm43xx-fwcutter ist nicht installiert, wird also auch nicht entfernt (english: not installed, will not be removed)
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.

alex@cappuccino:/lib/firmware$ sudo dpkg --purge bcm43xx-fwcutter
(Lese Datenbank ... 87598 Dateien und Verzeichnisse sind derzeit installiert.)
Entferne bcm43xx-fwcutter ... (english: removing bcm...)
Lösche Konfigurationsdateien von bcm43xx-fwcutter ... (english: purge config files of bcm...)

Is this correct behaviour or a bug?

Hardy, amd64, proposed & backports-repositories

alex@cappuccino:/lib/firmware$ apt-get --version
apt 0.7.9ubuntu17 for amd64 compiled on Apr 22 2008 15:20:34

TESTCASE:
1. sudo apt-get install hello
2. sudo apt-get remove hello
3. sudo apt-get purge hello

Revision history for this message
In , Matt Zimmerman (mdz) wrote : Re: ...

# apt-get --purge remove vs. dpkg --purge
reassign 150831 apt
merge 150831 159182
thanks

--
 - mdz

Revision history for this message
In , Matt Zimmerman (mdz) wrote : Re: Processed: Re: ...

severity 159182 wishlist
merge 159182 150831
thanks

--
 - mdz

Revision history for this message
In , Ross Boylan (ross-biostat) wrote : maybe document this?

I just got bit by this too. I agree the behavior is unexpected.

Perhaps, pending changing the behavior, it could be documented--maybe in
the discussion of the --purge option: "Note this will not work if the
package has already been removed."
--
Ross Boylan wk: (415) 502-4031
530 Parnassus Avenue (Library) rm 115-4 <email address hidden>
Dept of Epidemiology and Biostatistics fax: (415) 476-9856
University of California, San Francisco
San Francisco, CA 94143-0840 hm: (415) 550-1062

Revision history for this message
In , Matt Zimmerman (mdz) wrote : Re: Bug#219567: "apt-get remove --purge" on deinstalled package

severity 219567 wishlist
merge 219567 150831
thanks

On Fri, Nov 07, 2003 at 11:49:06AM +0100, Dr. Andreas Krüger wrote:

> I've "apt-get remove leafnode" yesterday. Today, I'm having a problem with
> the leafnode config file /etc/cron.daily/leafnode. (I filed that problem as
> bug 219559). I decided to rid myself of both the problem and that leafnode
> config file, so I tried
>
> apt-get remove --purge leafnode
>
> However, apt-get did not remove all leafnode config files, as I had
> expected it to. It simply declined to do anything. The reason given was:
>
> Package leafnode is not installed, so not removed
>
> I fell back to "dpkg --purge leafnode". That one did what I had expected
> "apt-get remove --purge leafnode" to do: /etc/cron.daily/leafnode is now
> gone for good.

Duplicate, merging.

--
 - mdz

Revision history for this message
In , Matt Zimmerman (mdz) wrote : Re: Bug#305064: apt-get --purge does not purge, need to use dpkg --purge instead

severity 305064 wishlist
merge 150831 305064
thanks

On Sun, Apr 17, 2005 at 07:19:51PM +0100, J. Grant wrote:
> Package: apt
> Version: 0.5.28.1
>
> Hello,
>
> I am expencing a problem purging on my uptodate testing computer.
>
> I noticed that these commands do not scuessfully work:
>
> # apt-get --purge remove iamerican wamerican
> Reading Package Lists... Done
> Building Dependency Tree... Done
> Package iamerican is not installed, so not removed
> Package wamerican is not installed, so not removed
> 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
> now2g:/media/c# dpkg -l |grep american
> rc iamerican 3.1.20.0-4 An American English dictionary for ispell
> rc wamerican 5-4 American English dictionary words for
> /usr/s
> now2g:/media/c#
>
>
>
> The only way I can successfully purge them is to use:
>
> # dpkg --purge iamerican
> (Reading database ... 108977 files and directories currently installed.)
> Removing iamerican ...
> Purging configuration files for iamerican ...
> debconf: unable to initialize frontend: Kde
> debconf: (Can't locate Qt.pm in @INC (@INC contains: /etc/perl
> /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/lib/perl5
> /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8
> /usr/local/lib/site_perl .) at
> /usr/share/perl5/Debconf/FrontEnd/Kde/Wizard.pm line 7.)
> debconf: falling back to frontend: Dialog
> now2g:/media/c# dpkg -l |grep american
> rc wamerican 5-4 American English dictionary words for
> /usr/s
> now2g:/media/c# dpkg --purge wamerican
> (Reading database ... 108977 files and directories currently installed.)
> Removing wamerican ...
> Purging configuration files for wamerican ...
> debconf: unable to initialize frontend: Kde
> debconf: (Can't locate Qt.pm in @INC (@INC contains: /etc/perl
> /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/lib/perl5
> /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8
> /usr/local/lib/site_perl .) at
> /usr/share/perl5/Debconf/FrontEnd/Kde/Wizard.pm line 7.)
> debconf: falling back to frontend: Dialog
>
>
> # dpkg -l |grep american
>
> This does not show anything, so they have now been purged.
>
> N.B. Please include my email address in any replies.
>
> Kind regards
> JG
> --
> Homepage: http://jguk.org/
> Blog: http://jguk.org/blog.rss
> Radio: http://jguk.org/#radio
>
>
> --
> To UNSUBSCRIBE, email to <email address hidden>
> with a subject of "unsubscribe". Trouble? Contact
> <email address hidden>

--
 - mdz

Revision history for this message
In , Lior Kaplan (kaplan) wrote : found 305064 in 0.7.3

# Automatically generated email from bts, devscripts version 2.10.6
found 305064 0.7.3

Revision history for this message
Alexander Blinne (sunday) wrote : won't purge deinstalled packages

Binary package hint: apt

I wanted to purge a packages config-files after i had it removed already, apt won't do the job although dpkg does:

alex@cappuccino:/lib/firmware$ dpkg-query -W -f='${Status} ${Package}\n'|grep deinstall
deinstall ok config-files bcm43xx-fwcutter

alex@cappuccino:/lib/firmware$ sudo apt-get purge bcm43xx-fwcutter
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut
Reading state information... Fertig
Paket bcm43xx-fwcutter ist nicht installiert, wird also auch nicht entfernt (english: not installed, will not be removed)
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.

alex@cappuccino:/lib/firmware$ sudo dpkg --purge bcm43xx-fwcutter
(Lese Datenbank ... 87598 Dateien und Verzeichnisse sind derzeit installiert.)
Entferne bcm43xx-fwcutter ... (english: removing bcm...)
Lösche Konfigurationsdateien von bcm43xx-fwcutter ... (english: purge config files of bcm...)

Is this correct behaviour or a bug?

Hardy, amd64, proposed & backports-repositories

alex@cappuccino:/lib/firmware$ apt-get --version
apt 0.7.9ubuntu17 for amd64 compiled on Apr 22 2008 15:20:34

Revision history for this message
Dimitrios Symeonidis (azimout) wrote :

Yes, it's the expected behaviour... You can also remove them by running:
dpkg --purge `dpkg --get-selections | grep deinstall | cut -f1`
as proposed here:
http://blog.moybella.net/2007/09/05/cleaning-up-after-aptget-remove/

Apart from the above, I agree with you that purge should remove the configuration files of a previously removed package...

Revision history for this message
Alexander Blinne (sunday) wrote :

I'm sorry if my original report was not clear, my question was solely about apt-get's behaviour. dpkg of course works as expected.

Changed in apt:
status: New → Confirmed
Revision history for this message
In , Eugene V. Lyubimkin (jackyf-devel) wrote : upgrading #150831

package apt
severity 150831 normal
thanks

Well, this a real bug, not wishlist.

--
Eugene V. Lyubimkin aka JackYF, Ukrainian C++ developer.

Revision history for this message
In , Eugene V. Lyubimkin (jackyf-devel) wrote : tagging 150831

tags 150831 + confirmed

Revision history for this message
Daniel Hahler (blueyed) wrote : Re: won't purge deinstalled packages

Still a problem in Lucid.
(apt 0.7.25.3ubuntu3)
Better workaround is just "dpkg -P <package>"

Changed in apt (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Triaged
summary: - won't purge deinstalled packages
+ Apt will not purge deinstalled/removed packages
description: updated
summary: - Apt will not purge deinstalled/removed packages
+ Apt will not purge deinstalled/removed packages (like "dpkg -P")
summary: - Apt will not purge deinstalled/removed packages (like "dpkg -P")
+ Apt will not purge deinstalled/removed packages (unlike "dpkg -P")
Changed in apt (Debian):
status: Unknown → Confirmed
Revision history for this message
Reuben Thomas (rrt) wrote :

This bug was fixed in apt 0.8.0 (see the linked debbug), but has reappeared in natty.

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

A fix has been committed to the debian-sid repository

------------------------------------------------------------
revno: 2120
revision-id: <email address hidden>
parent: <email address hidden>
fixes bug(s): http://bugs.debian.org/150831 https://launchpad.net/bugs/244598
committer: Julian Andres Klode <email address hidden>
branch nick: debian-sid
timestamp: Thu 2011-04-21 12:18:05 +0200
message:
  Make purge work again for config-files (LP: #244598) (Closes: #150831)
diff:
=== modified file 'apt-pkg/depcache.cc'
--- apt-pkg/depcache.cc 2011-04-18 08:56:37 +0000
+++ apt-pkg/depcache.cc 2011-04-21 10:18:05 +0000
@@ -550,7 +550,7 @@
    if (Pkg->CurrentVer == 0)
    {
       if (State.Mode == ModeDelete &&
- (State.iFlags | Purge) == Purge && Pkg.Purge() == false)
+ (State.iFlags & Purge) == Purge && Pkg.Purge() == false)
   iDelCount += Add;

       if (State.Mode == ModeInstall)

=== modified file 'debian/changelog'
--- debian/changelog 2011-04-21 09:25:52 +0000
+++ debian/changelog 2011-04-21 10:18:05 +0000
@@ -2,6 +2,7 @@

   * apt-pkg/depcache.cc:
     - Really release action groups only once (Closes: #622744)
+ - Make purge work again for config-files (LP: #244598) (Closes: #150831)
   * debian/apt.cron.daily:
     - Check power after wait, patch by manuel-soto (LP: #705269)
   * doc/apt-key.8.xml:

Changed in apt (Ubuntu):
status: Triaged → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apt - 0.8.14.1ubuntu1

---------------
apt (0.8.14.1ubuntu1) oneiric; urgency=low

  [ Michael Vogt ]
  * merged from the debian-sid bzr branch

  [ Julian Andres Klode ]
  * apt-pkg/depcache.cc:
    - Really release action groups only once (Closes: #622744)
    - Make purge work again for config-files (LP: #244598) (Closes: #150831)
  * debian/apt.cron.daily:
    - Check power after wait, patch by manuel-soto (LP: #705269)
  * debian/control:
    - Move ${shlibs:Depends} to Pre-Depends, as we do not want APT
      unpacked if a library is too old and thus break upgrades
  * doc/apt-key.8.xml:
    - Document apt-key net-update (LP: #192810)

apt (0.8.14.1) unstable; urgency=low

  * apt-pkg/acquire-item.cc:
    - Only try to rename existing Release files (Closes: #622912)

apt (0.8.14) unstable; urgency=low

  [ Julian Andres Klode ]
  * apt-pkg/indexcopy.cc:
    - Use RealFileExists() instead of FileExists(), allows amongst other
      things a directory named Sources to exist on a CD-ROM (LP: #750694).
  * apt-pkg/acquire-item.cc:
    - Use Release files even if they cannot be verified (LP: #704595)
  * cmdline/apt-get.cc:
    - Do not install recommends for build-dep (Closes: #454479) (LP: #245273)
  * apt-pkg/deb/deblistparser.cc:
    - Handle no space before "[" in build-dependencies (LP: #72344)
  * apt-pkg/policy.cc:
    - Allow pinning by glob() expressions, and regular expressions
      surrounded by slashes (the "/" character) (LP: #399474)
      (Closes: #121132)
  * debian/control:
    - Set Standards-Version to 3.9.2

  [ Michael Vogt ]
  * mirror method:
    - do not crash if the mirror file fails to download
  * apt-pkg/aptconfiguration.cc:
    - fix comparing for a empty string
  * debian/apt.cron.daily:
    - run unattended-upgrades even if there was a error during
      the apt-get update (LP: #676295)

  [ David Kalnischkies ]
  * apt-pkg/pkgcache.cc:
    - use the native Architecture stored in the cache header instead of
      loading it from configuration as suggested by Julian Andres Klode
 -- Michael Vogt <email address hidden> Fri, 29 Apr 2011 17:55:20 +0200

Changed in apt (Ubuntu):
status: In Progress → Fix Released
Changed in apt (Debian):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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