Snap fails to build from build.snapcraft.io but builds locally successfully

Hello, Long time listener, multiple time caller :wink:

So I have been maintaining iproute2 snap for a while now, and when I tried to upgrade from core20 to core22 and add a new app to the snap, it now fails when I try to build through build.snapcraft.io for publishing for different platforms. However, when I build locally, it builds successfully and it works correctly. When I looked at the build log from snapcraft.io in my profile, I found this interresting line:

Failed to pull source: command ['git', 'clone', '--recursive', '--branch', 'v6.1.0', 'git://git.kernel.org/pub/scm/network/iproute2/iproute2.git', PosixPath('/build/iproute2-snap/parts/iproute2/src')] exited with code 128.
Make sure sources are correctly specified.
Full execution log: '/root/.cache/snapcraft/log/snapcraft-20230204-063805.286300.log'
Build failed

The first thing I notice is that the build system is using --branch instead of --tag since I am building based on tag instead of branch in git from git.kernel.org. I haven’t had this issue in the past, and the only thing I have changed in my snapcraft.yaml is I updated the base from core20 to core22, and I added a new app that is now part of the latest iproute2.

My snapcraft.yaml is located in my github repo at github.com/wililupy/iproute2-snap.

Thanks, Luke

1 Like

So an update. If I change the base from core22 to core20, it builds successfully. So there must be something I am missing in my snapcraft.yaml to move to the core22 base. I will do some research and then make my changes.

I just find it odd that I can build locally in LXD with the base as core22 and no errors, but when I try to build on build.snapcraft.io it fails unless it is core20.

/r Luke

Maybe something related to this line. I’m still learning how to track down issues in snapcraft.

It seems to suggest if source_tag then it will use --branch in the git call.

Using --branch is fine, but the fact that it works locally but fails on the builder with error code 128 is strange – @mr_cal, any idea on what could be happening here?

What’s weird is that it’s not a branch though, but a tag. If it were a branch, I think that it would work, but branch and tag are different. Shouldn’t it be a different variable in the source?

According to git-clone(1) --branch can also be used with tags.

core20 runs the command:

git clone --recursive --branch v6.1.0 git://git.kernel.org/pub/scm/network/iproute2/iproute2.git /root/parts/iproute2/src

core22 runs the command:

git clone --recursive --branch v6.1.0 git://git.kernel.org/pub/scm/network/iproute2/iproute2.git

I don’t suspect the git clone call itself.

git clone returns 128 if it can’t reach the repository. I don’t know why a core20 vs core22 base would behave differently, but I do know the git:// runs on port 9148. Maybe there is a firewall issue?

What happens if you change your source from git://git.kernel.org/pub/scm/network/iproute2/iproute2.git to https://kernel.googlesource.com/pub/scm/network/iproute2/iproute2?

So I updated the base and the git source to google and it seems to work now. Interresting that the main repo for this package doesn’t work, but a mirror does. I wonder if it’s the “git://” instead of “https://”? Thanks for the help. Odd that it has to be called out that way.

So it looks like if I call the source using git:// instead of https:// it fails, but changing it to https:// seems to let me use the core22 base and it build successfully. Not sure why it builds locally with snapcraft but remotely it fails. At least now it’s updated to core22 base and builds correctly now. Thank you everyone. /r Luke

1 Like