I'm trying to build a very simple debian package. I have two files, main_file and functions, they are both shell scripts, functions is sourced by main_file. There are no dependencies on any external packages, the code simply uses echo.

I have a Makefile that looks like this:

    cp main_file $(DESTDIR)/usr/bin/main_file
    cp functions $(DESTDIR)/usr/bin/functions

I also have a control file in the debian directory, that looks like this:

Source: ad
Section: unknown
Priority: extra
Maintainer: James Kelly <james.kelly@email.com>
Build-Depends: debhelper (>= 7)
Standards-Version: 3.8.3
Homepage: <insert the upstream URL, if relevant>
Package: ad
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Just messing around
 Playing with debian packages

I have a tar.gz file in the directory above the one which contains the code and debian folder containing the code and the Makefile.

If I run $ dpkg-depcheck -d ./configure I get an error:

strace: ./configure: command not found
Running strace failed (command line:
strace -e trace=open,execve -f -q -o /tmp/depchwOSqtO ./configure

I didn't think that would matter as there are no dependencies, then if I run dpkg-buildpackage -rfakeroot I get an error:

dh_auto_clean: failed to write to debian/ad.debhelper.log: Permission denied
END failed--call queue aborted.
make: *** [clean] Error 13
dpkg-buildpackage: error: fakeroot debian/rules clean gave error exit status 2

Finally if I run sudo dpkg-buildpackage -rfakeroot the process gets further but then gives me an error:

make[1]: Entering directory `/home/james/Dummy_Debian/ad-1.0'
cp main_file /home/james/Dummy_Debian/ad-1.0/debian/ad/usr/bin/main_file
cp: cannot create regular file `/home/james/Dummy_Debian/ad-1.0/debian/ad/usr/bin/main_file': No such file or directory
make[1]: *** [install] Error 1
make[1]: Leaving directory `/home/james/Dummy_Debian/ad-1.0'
dh_auto_install: make -j1 install DESTDIR=/home/james/Dummy_Debian/ad-1.0/debian/ad returned exit code 2
make: *** [binary] Error 29
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

I've been banging my head against this all day and I feel that it's probably something simple that I'm doing wrong, if anyone could give me some help I'd be eternally grateful!


My rules file is here:

#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

    dh  $@

and a link to a zip file containing my sample code.

  • My 1st bet would be checking /home/james/Dummy_Debian/ad-1.0/debian/ad/usr/bin/ for permissions issuesm as well as checking if the path exists. – schaiba Jul 23 '13 at 21:46
  • The path doesn't exist, but shouldn't dpkg-buildpackage make this for me or am I misunderstanding? – James Jul 23 '13 at 21:49
  • I suggest uploading your code, including the Debian packaging, somewhere public - e.g. Bitbucket or Github, and provide a link to it in your question. Then it may be possible for someone to figure out what your problem is. From your description it sounds like you are making some elementary packaging mistake(s), but there is nothing to be gained in trying to guess what. – Faheem Mitha Jul 23 '13 at 22:09
  • 1
    Post your debian/rules file. You may need to register the directories like usr/bin in debian/dirs, depending on which dh tools you're using. debian/ad.debhelper.log: Permission denied is weird: what are the permissions on the debian directory? – Gilles Jul 23 '13 at 23:11
  • +1 for the debian/dirs hint. Your install target is broken, though; it should create the directory (with correct permissions!) if it is missing. – tripleee Jul 24 '13 at 5:29

debhelper(7) tries to use broken Makefile to build (dh_auto_build) and install (dh_auto_install) files so either Makefile has to be fixed or we can ignore it by adding overrides to debian/rules:

override_dh_auto_build override_dh_auto_install:  

and making debian/install file with following contents:

main_file  /usr/bin
functions  /usr/bin

Read more about Debian packaging in

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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