I built and installed a debian package from the following folder structure:
... using the following commands:
dpkg -b myprog/ myprog.deb && dpkg -i myprog.deb
When i now remove the package by typing:
dpkg -r myprog
.. I got the following warning:
dpkg: warning: while removing myprog, directory '/usr/local' not empty so not removed.
As I think this is an every day scenario, how can I avoid the warning?
Greets Thorsten!
I tried to install the file to /bin instead of /usr/local/bin and got no warning when removing it. Seems so, that the /usr/local/.. folder will not treated as a system folder (?) by dpkg.
In general, this warning is completely harmless and normal. When dpkg is removing (or trying to remove) a package, it removes all files and directories which were created as part of that package installation.
This could happen either because they were machine generated, either during or after the install, or because they were created by a user. Then, unless instructed, dpkg will not remove those files. Since, by default, it will not remove a non-empty directory, in such a case, the directory containing these files will not be removed.
Since, by default, it will not remove a non-empty directory, in such a case, the directory containing these files will not be removed. So, in summary, after the package is removed, you may end up with a basically empty directory (or directories) with a few machine generated files or something.
Other than those which you have already posted, there are few other commands which can be helpful. Autoclean clears out the local repository of retrieved package files. Also as always, you can use dpkg to install, remove and purge packages. Both dpkg and the apt-get --force-yes commands return the same error as I was getting before.
That's right -- packages should never touch /usr/local
directory, it's reserved for system administrators by Filesystem Hierarchy Standard and is their zone of responsibility.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With