I used dh_make to create a basic Debian package install. I added a dependency which is the actual program I want. All I want to do is overwrite the conf file this package installed, with a new file with bunch of custom parameters.

I tried to use the install file which looks like this:

file.conf /etc/destination/file.conf

but repeatedly got an error saying:

dh_install: cp -a debian/tmp/file.conf debian/custom-package//etc/package// returned exit code 1

I can't figure out why it won't find the file. I know debian/tmp is created by the builder, but I don't know why it won't find my file, then it tries to copy not to the directory I want, but it prepends debian/custom-package/.

I also tried to use a Makefile but while it builds and runs, the file isn't copying to the directory. I'm not sure the Makefile is right or is even getting called (dh_make didn't originally include a Makefile, I'm not sure where to call it if it doesn't get called).

The make file just has the install directive and looks like this:

        cp file.conf /etc/destination/

The rules file is the basic file that was built with dh, and as recommended from the Debian guide:

        dh $@
  • In file.conf /etc/destination/file.conf, what is destination? And what is the exact name of your install file? pkgname.install will try to install in debian/tmp/pkgname/etc/destination/, I think. You don't want both an install file as well as an install rule in make. They both do the same thing - copy stuff to the files under debian/tmp which packages are made from. You probably just want a line in an install file. Jun 24, 2015 at 16:32
  • Oh, and include your rules file, please. You should probably also be using dh. Jun 24, 2015 at 16:39
  • The rules file is the recommended file from the debian guide, very short, I added it above. I am trying the solution posed by @Stephen Kitt, basically deleting the install file and only using the directive in the Makefile.
    – eignhpants
    Jun 24, 2015 at 17:21
  • 1
    Your package doesn't sound complicated. I suggest you put the whole thing somewhere public, if you can't figure it out. And post a link here, of course. Jun 24, 2015 at 17:54
  • I will try and do this later, can't right this minute. I am sure the solution is very close, but I'm just missing some small component. And you are right, it is a very simple package.
    – eignhpants
    Jun 24, 2015 at 19:12

2 Answers 2


See the Debian wiki for detailed instructions to create a configuration package. The short version given what you've already got is:

  • delete the install file
  • in your Makefile, specify the install target as follows:
        mkdir -p $(DESTDIR)/etc/destination/
        cp file.conf $(DESTDIR)/etc/destination/
  • in your debian/rules, just run dh:
        dh $@
  • Is $(DESTDIR) something I need to set manually or is it inherited somewhere? I made these changes and while it had a noticeable effect in that the make process was much less verbose, the .conf file is still not the one I included in my package, nor did I get any errors regarding files not being found or any such thing.
    – eignhpants
    Jun 24, 2015 at 17:31
  • The above comment is not quite right, lintian did return an error stating: unknown-file-in-debian-source file.conf
    – eignhpants
    Jun 24, 2015 at 17:37
  • DESTDIR is defined by the build tools. Where is your file.conf? The lintian error means it's in debian/source, it should be in your package's main directory. Jun 24, 2015 at 17:45
  • So I am still seeing the basic .conf file when I install. I moved the file out and don't get any lintian errors but I am also not seeing my modified .conf file anywhere. Do I need to add the file to conffile? I have read that this is not the best practice. I also read that conf files can be placed in etc/ within the build package, but no where is clear on where in the build package the mean. I also tried adding -f to the cp in my Makefile but that did not seem to have any effect either.
    – eignhpants
    Jun 24, 2015 at 18:27

I ended up solving this problem by using a package called config-package-dev.

config-package-dev link

While I didn't realize it at the time, there was a big flaw in what I was trying to do previously. Updates or changes to the package could have overwritten my custom .conf files on update and the system would have been broken.

config-package-dev solved this issue by making symlinks to my custom .conf files, which insulates the configuration to changes (among other things). In addition it accomplished all the things I was trying to do and made the entire process much cleaner. I ended up throwing away my old solution and making an entirely new package with the debian package building tools.

Thanks everyone.

You must log in to answer this question.

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