[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#637853: apt: Why is the removal of an unknown package an error?



Package: apt
Version: 0.8.15.5
Severity: normal

Hi,

why does
  apt-get remove foobar
return an error and causes apt-get to abort? foobar is a package that
is not installed (and not config-files-remaining) and not available
from any package source.
For packages that are not installed, but available, apt-get reports a
diagnostic ("Package %s is not installed, so not removed") and
continues.
At least adding --ignore-missing should suppress this error. I also
didn't find any other --force/-y/... switch to suppress this.
dpkg and aptitude also emit a diagnostic and continue.
Why is this case so differently handled from an uninstalled available
package? At the end of the command the system is exactly in the
requested state: the package foobar is not installed (or is purged in
case of the purge command).
There are different ways to give this command by using suffixes:
  apt-get install foobar-   -> no error
  apt-get remove foobar+    -> error, we have to install
  ...

I stomped on this while hacking in the piuparts code and the unknown
package is a package not yet in the archive.
  apt-get purge <long list of removed packages with one offender>
is currently an unusable command for my desires.


Andreas

# apt-cache policy foobar ; echo $?
N: Unable to locate package foobar
0

# apt-get install foobar ; echo $?
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package foobar
100

# apt-get remove foobar ; echo $?
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package foobar
100

# apt-get purge foobar ; echo $?
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package foobar
100

# dpkg --remove foobar ; echo $?
dpkg: warning: ignoring request to remove foobar which isn't installed.
0

# dpkg --purge foobar ; echo $?
dpkg: warning: ignoring request to remove foobar which isn't installed.
0

# apt-get remove libaa1 ; echo $?
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libaa1 is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
0

# apt-get purge libaa1 ; echo $?
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libaa1 is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
0

# apt-get install libaa1-dev
....

# apt-get remove foobar libaa1-dev ; echo $?
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package foobar
100

# apt-get remove libaa1-dev foobar; echo $?
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package foobar
100

# dpkg --remove foobar libaa1-dev ; echo $?
dpkg: warning: ignoring request to remove foobar which isn't installed.
(Reading database ... 14751 files and directories currently installed.)
Removing libaa1-dev ...
Processing triggers for install-info ...
0

# apt-get remove libaa1-dev libaa1; echo $?
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libaa1-dev is not installed, so not removed
The following packages will be REMOVED:
....
0

# apt-get remove --ignore-missing foobar; echo $?
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package foobar
100

# aptitude remove foobar; echo $?
Couldn't find any package matching "foobar".  However, the following
packages contain "foobar" in their description:
  lxmusic man2html
Couldn't find any package matching "foobar".  However, the following
packages contain "foobar" in their description:
  lxmusic man2html
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

0



Reply to: