Priming step slow

I observed that there’s one part in my snap recipe that takes extremely long in the priming step compared to others.

The part uses the dump plugin and is staged in less than a minute, but priming takes up to 15 minutes. The contents that must be staged/primed are less than 1500 files weighting ~80MB. Other similar parts in weight and amount of files using the same plugin don’t have this behaviour and they are primed quite fast.

According to the documentation, prime step “copies the staged components into the priming area, to their final locations for the resulting snap” so I don’t understand why is taking that long.

I reproduced this problem by isolating the part in its own recipe, so I know is not resulting of a bad interaction with any of the other parts. Is there any way I can debug this further?

Hrmmm, I do wonder if this is due to dependency checking. Which version of snapcraft are you using? There have been some recent performance improvements, it may be worth trying out the latest (sudo snap refresh snapcraft --edge)… you could also try the experimental --use-lxd option and see if that has any impact.

Is there a yaml you can share to reproduce?

If it is using confinement: classic, then this is where extra checks happen.

Yes, I’m using classic , however, just confirmed that using strict it also happens.

Is there any way to disable those checks?

To disable the ABI incompatibility checks and the potential fixes for those completely you can set build-attributes: [no-patchelf] for the specific part.

@sergiusens using no-patchelf doesn’t provide any speed-up, but indeed it seems is something related with the dependencies check. When finishing the priming step, it indicates that several libraries are missing and recommend to add them to stage-packages, however, these libraries are provided later by other part so it shouldn’t be necessary to include or checking for them every time, since I am already aware of it.

@cjp256, I am using the stable version (3.10.1). Tested with the latest edge version and it still happens. Unfortunately, I can’t offer a reproducer since the problematic part packages a proprietary driver and its libraries.

I noticed that priming the same snap in other machine doesn’t have this behaviour, so I installed in the original machine the libraries that the priming step originally indicated that were missing. With this, the priming step drops from 15’ to around a minute, so it is confirmed that it is something dependency-related.

I don’t think that polluting the host with not needed libraries is the solution, especially taking into account that they are already provided by other snap. Any ideas on how to avoid this checking?

yes, you are, but snapcraft is not :slight_smile: have you considered changing the order of the parts so snapcraft is also aware ?

Thanks @ogra, but that seems difficult here since it’s necessary to stage the problematic part earlier, as it’s bringing libraries that are required at the build time of other parts.