dpkg: warning: while removing directory /usr/local not empty so not removed

混江龙づ霸主 提交于 2019-12-10 12:48:43

问题


I built and installed a debian package from the following folder structure:

  • myprog
    • DEBIAN
      • control
    • usr
      • local
        • bin
          • myprog.sh

... 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!

# Edit

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.


回答1:


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.




回答2:


To avoid the warning, according to this post, is to create a "core-custom"/dummy package, which will install in /opt, and be required by your main package.

So, when you'll uninstall your main package, at least your dummy package will be left in /opt and dpkg will not issue the warning.

You can also use that dummy package as a meta-package to install all the regular packages you like.



来源:https://stackoverflow.com/questions/3704354/dpkg-warning-while-removing-directory-usr-local-not-empty-so-not-removed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!