I want to create my own deb package on Ubtunu 14.04 using dh_make and dh_install. I put the postinst file in mypackage-1.0/debian/postinst. I have no problem to create the deb. But when I try to install the package using the command of dpkg -i mypackage_1.0-1_all.deb I got following errors:

dpkg (subprocess): unable to execute installed post-installation script (/var/lib/dpkg/info/mypackage.postinst): No such file or directory
dpkg: error processing package mypackage 
(--install): subprocess installed post-installation script returned error exit status 2 
Processing triggers for ureadahead (0.100.0-16) ...
Errors were encountered while processing: mypackage

Please note, the script file exists and it has proper execution permissions.


  • 2
    When you extract your .deb, do you get a control.tar.gz that includes the control file and the postinst script? – Katu Dec 1 '16 at 16:24
  • @Katu, dpkg get error when tried to run it, then the file exists in the package. – user.dz May 26 '17 at 9:24
  • @BrianNate, That script fails in one of its instructions and exits with error code. Could you add the contents of postinst to the question. You may also add some echo's to it the know where exactly it does fail. – user.dz May 26 '17 at 9:27

You can extract the maintenance scripts from your deb with

mkdir tmp   
dpkg-deb -R mypackage_1.0-1_all.deb tmp

Now you can run tmp/DEBIAN/postinst with a "configure" argument to simulate a package install, and see what the problem is:

tmp/DEBIAN/postinst configure

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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