2

I have a Debian package with postinst script in it that create symlinks. When I try to install the .deb package with --root (since I want to change the location where the package should be installed), I get this error:

dpkg (subprocess): unable to execute installed post-installation script: No such file or directory subprocess installed post-installation script returned error exit status 2 

dpkg is trying to find the postinst script in /var/lib/dpkg/info. What I can't understand is that according to the dpkg man page, using --root option changes the admindir to newdir/var/lib/dpkg as well.Then why is it trying to find postinst script in /var/lib/dpkg/info/?

I tried creating another package that doesn't contain this maintainer script and installed it using the same -i --root=newdir option and that doesn't throw any error.

Please let me know how I can make this work.

1 Answer 1

0

dpkg did find the postinst script in /your/root/var/lib/dpkg/info — it tried to run it. It looks like the problem is a missing loader: dpkg finds the postinst script but then gets a “No such file or directory” error when it tries to execute it because the interpreter program for the script is not present (e.g. it's a Python script and python-minimal isn't installed). With an alternative instdir, the interpreter must be present under the instdir (dpkg chroots to the instdir before running package scripts).

If the interpreter isn't provided by a package tagged Essential, make sure that your package depends on the package that provides the interpreter.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.