How do I get a postinst stage properly executed - traceroute will not install correctly

Loïc Minier loic.minier at
Tue Aug 2 10:35:13 UTC 2016

Hi David,

On Thu, Jul 28, 2016 at 6:32 PM, David Garrod <dgarrod at>
> Yes I know I can do some special messing around to try and fix up the
> installation but I don’t think that is a good idea. How can I get the
> package to install fully and correctly inside the SNAP, i.e. properly
> execute the “postinst” commands.

Taking a step back, Snapcraft is a tool to help you assemble snaps from
various pieces. The stage-package feature is meant to easily consume
package contents, but it's not a perfect installation of a .deb honoring
posting etc. At the moment, it just unpacks the .deb (dpkg -x) as if it was
a tarball.

Capturing the installation of any possible .deb and its postinst would be
quite complex:
- we'd have to run these postinsts with root permissions during the build
(however we do sudo apt install on the build-packages, so that's
technically possible albeit intrusive)
- we'd need a chroot and a way to record the changes done to this chroot
(as to extract the new files)
- we'd need to decide what to do with modified/updated files

This is not out of the possible, but it's a lot of work and the "unpacking
the .deb" heuristic works for most use cases.

Perhaps there should be a separate plugin which does the "true .deb"
installation process in a chroot etc., but for your specific traceroute use
case it seems easier to just add the missing symlinks created by
update-alternatives yourself (or simply move the binaries to the expected

Alternatively, you could also build traceroute from source instead of
reusing the .deb.

- Loïc Minier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Snapcraft mailing list