Re: emacs 19.29-2 purge failed due to assumption
Guido M. Witmond writes ("emacs 19.29-2 purge failed due to assumption"):
> [...]
> In order to preserve some space I did a dpkg --purge emacs to get rid
> of it. But it gave me these errors:
>
> +------
> | tommie root 10:46 /usr/local/archive/debian # dpkg --purge emacs
> | (Reading database ... 10251 files and directories currently installed.)
> | Removing emacs ...
> | dpkg - warning: while removing emacs, directory `/usr/local/lib' not empty so not removed.
> | dpkg: error processing emacs (--purge):
> | cannot remove `/usr/local': Operation not permitted
> | Errors were encountered while processing:
> | emacs
> | tommie root 10:46 /usr/local/archive/debian #
> +------
>
> There is rule in the remove script that assumes emacs is the only
> inhabitant of the /usr/local tree. Now I had a look if emacs was
> really gone:
This is not part of the Emacs removal script.
What is happening is that the Emacs package contains a directory
/usr/local/lib/emacs/site-lisp. This is (presumably) so that the
sysadmin will know that they can put things there if they want to and
have them found by load-library &c.
However, when you tried to remove Emacs dpkg spotted that Emacs was
the only thing *that dpkg knows about* which uses /usr/local, so it
decided to try to remove it.
Furthermore, it seems that /usr/local is a mountpoint, and that rmdir
on a mountpoint gives EPERM (Operation not permitted) rather than
EBUSY (Device or resource busy) or ENOTEMPTY (Directory not empty).
This meant that dpkg treated the failure to remove the /usr/local
directory as an error, because the cause wasn't in its list of
`approved' causes.
There are two problems here:
* Firstly, dpkg needs to be told that /usr/local and /usr/local/lib are
used by a package other than Emacs, so that it doesn't try to remove
them. This will stop dpkg from producing warnings when removing Emacs
(unless of course you've put things in /usr/local/lib/emacs, in which
case the warnings are in order). The best way to do this is, I think,
for the directories in /usr/local - which are provided by the system
installed by the base disks - to be recorded as part of a `real'
package. Bruce, can you arrange this please, if you haven't already
got it in hand ?
* Secondly, dpkg needs to recognise EPERM as an OK error code, so that
it produces a warning instead of an error. I shall take care of this.
> Also a word of thank. This purge-action did not try to wipe my entire
> 250Mb /usr/local partition. That's a good point to note. I still have
> trust in the debian package system.
dpkg *can* remove whole directory trees, but you have to have a very
pathological package to do it. When removing packages it certainly
won't remove any files it doesn't know about.
Ian.
Reply to: