So I have worked with RPM (Redhat package manager) and it has a feature called ghost files. This type of file designates a file that is owned by the package, but is not necessarily installed through the installation process (useful for files that the program generates after it runs). More about the ghost directive in RPM can be found at the link below


So far the only way I have found to approximate the ghost behaviour in .deb packages is to touch the desired file and specify it as a config file in the debian/conffiles file. That way it is owned by the package but will not be updated every time a new version is installed.

What I am wondering is if there is a more official equivalent to this behaviour in the debian package manager, mainly looking at Ubuntu. I am using debuild to build the packages. Any help or suggestions would be greatly appreciated.

Additional info:

What I need to accomplish is to allow the package manager to know what files may be created by the program when it runs. These files should not be updated when a new version is installed and should not be deleted when the package is removed. The files should only be removed during a purge of the package.

1 Answer 1


Using conffiles is not the way to go, primarily because when your package is updated the user will be prompted whether to keep their old "config" file or to accept your new packaged version.

The alternative that comes to mind is to just clean up these files in a postrm script, which will allow your package to completely and cleanly uninstall, but will not mark the file as owned by your package. You could probably use a preinst script to initially install the file so the package knows it owns it and setup preinst and postrm to only act at the initial install and the final removal (and not at the removal/install steps during an upgrade).

  • That's an interesting way to do it. How would I mark these scripts to only run on the initial install and removal? Also kind of a sub question, I have never found a definitive listing of every possible file that could be in the debian/ directory and be recognized by debuild. Is there anywhere you know that has this info as I have not been able to find something like that in weeks of searching about the packaging process. Commented Aug 5, 2014 at 20:39
  • 1
    @Mix999 The preinst and postinst script take arguments that indicate what is happening (new installation, upgrade, etc.). See the Policy Manual for details. The chapter on source packages describes the debian directory. You can put non-standard files there, so it isn't an exhaustive list; some tools that you can use from debian/rules (e.g. dh_* scripts from debhelper) may use additional files not referenced in the policy. Commented Aug 5, 2014 at 23:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .