Re: custom package error: dpkg -P tries to remove /opt
Goswin von Brederlow wrote:
"Roberto C. Sanchez" <firstname.lastname@example.org> writes:
Mike Fogel wrote:
$ dpkg -P custom-package
... removal goes perfectly until this error/warning....
dpkg - warning: while removing custom-package, unable to remove
directory `/opt': Device or resource busy - directory may be a mount
This question is really more appropriate for debian-user. However, the
message you see from dpkg is just that, a warning. Whenever a Debian
package is removed and there are no packages left with files in a
particular directory, dpkg tries to remove the directory. Of course, it
doesn't do an rm -rf (thankfully), so directories that are still
populated can't be removed. You see this, for example when removing a
kernel-image package after you have added your own modules that are not
part of a package under the control of dpkg.
Anyhow, the warning is relatively harmless and can be safely ignored.
(I hope that all of this is correct. If I messed somethig up, someone
please let me know.)
You are more (theoreticaly) or less (practicaly) correct. Dpkg tries
to remove dirs when nothing in /var/lib/dpkg/info/*.list contains it
anymore. But dpkg also sometimes removes dirs from *.list on remove
(not purge) while the package still has conffiles in there (leading to
the 'dir not empty' warnings).
The bigger question is: Why is no package containing /opt? Shouldn't
that be in base-files like all the other core dirs?
Thanks for your help all, I think I'll work around the warning by
creating a "core-custom" package, which will hold the /opt, and be
required by all the other custom packages. I can also use that package
as a meta-package to install all the regular packages we like. Not
like the warning is a big deal, but the cleaner the better.