Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm building some packages for a private repository using equivs-build. The files are installing ok using apt-get install but when I go to remove them they are trying to delete the whole folder structure they are installed to.

In the equivs file I have the line:

Files: <file to copy> /usr/local/sbin/

When I run apt-get remove there are messages about

'.. directory /usr/local not empty so not removed.'

The /usr/local/sbin folder is removed.

Is there some way to prevent this?

share|improve this question
up vote 2 down vote accepted

There are a few references to this on Stackoverflow in the context of using dpkg which is the underlying tool behind apt-get: 1, 2 an 3. And every time the same considerations come up:

  1. It is a warning only and the package was indeed removed with its directory as requested
  2. In terms of best practices, one shouldn't use /usr/local for packages because of Debian policy (what does lintian say about the package?)and to respect the Filesystem Hierarchy Standard
  3. Some people experience a different behavior with the exact same removal operation when the target is elsewhere i.e. /bin VS. /usr/local/bin and even /opt
  4. preinst, prerm, postinst, and postrm scripts can technically contain things that alter the behavior during install/remove - but then again is the behavior of dpkg in /usr/local an exception or the rule (the removal of empty top directories, not limited to one level) - and is the design affected by package and folder ownership or just by the package being in /usr/local?

Finally, there might be alternatives which involve a better structuring of the task at hand as it expands in time... for instance creating a package repository. Ultimately equivs-build has to be used in a way which doesn't conflict with the design of the package management system.

share|improve this answer
When I say a "warning only" I mean that the package was indeed removed - it wasn't a showstopper. I understand that sbin was removed also. Maybe leaving a dummy file there would prevent this but that's not very elegant loll. – On a eu. Aug 5 '13 at 7:53
I will ultimately have a number of packages in a private repository. Each will have its own versioning and be maintained by puppet. My understanding of linux-lore is that '/usr/local/<*>' was intended for user applications. Not to be confused with '/bin' or '/sbin'. – ethrbunny Aug 5 '13 at 12:51
Well - total hack - putting a 'place holder' file in there prevented apt-get remove <package> from removing the folder. I must not be using this properly. – ethrbunny Aug 5 '13 at 13:33
Haha, beginner's luck on my part with the "place holder" file advice. Afterwards I thought why not just a directory? I had much less luck trying to replicate the behavior you were describing, as I made a mistake in the header file generated by equivs-control trying to set up my own package... I entered a name+version combo as the package name instead of just the name... then dh_make didn't work etc. But yeah, that topic is all very interesting! Happy this was helpful! – On a eu. Aug 5 '13 at 14:34
see also the postrm hack from an example stub source package that includes a dummy CA certificate in the /usr/local/share/ca-certificates directory – Evgeny Vereshchagin Jul 13 '15 at 2:46

Does your Files line look as you typed it or are you missing the colon (:) after the word Files?

As in this example, equivs control file:

### Commented entries have reasonable defaults.
### Uncomment to edit them.
Section: misc
Priority: optional
Standards-Version: 3.6.2

Package: main-package
Version: 0.0.1
Maintainer: Your Name <a.spam.box@mail.sj>
# Pre-Depends: <comma-separated list of packages>
# Depends: <comma-separated list of packages>
# Recommends: <comma-separated list of packages>
# Suggests: <comma-separated list of packages>
# Provides: <comma-separated list of packages>
# Replaces: <comma-separated list of packages>
Architecture: all
# Copyright: <copyright file; defaults to GPL2>
# Changelog: <changelog file; defaults to a generic changelog>
# Readme: <README.Debian file; defaults to a generic one>
Files: /home/myuser/main-package.conf /etc/main-package.conf
Description: <short description; defaults to some wise words>
 long description and info


share|improve this answer
My mistake - it does read as 'Files: <file to copy> /usr/local/sbin/<file>'. I edited the question to reflect this. – ethrbunny Aug 5 '13 at 12:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.