Problems with snapcraft docker image resolving IPs


Not sure what exactly the cause is of this, but the docker image at snapcore/snapcraft:stable currently is failing for us reliabily because it can’t resolve some IP address needed for the package linux-libc-dev:

15:25:18 Err:92 xenial-updates/main amd64 linux-libc-dev amd64 4.4.0-135.161
15:25:18   404  Not Found [IP: 80]
15:25:25 Fetched 160 MB in 7s (20.2 MB/s)
15:25:25 E: Failed to fetch  404  Not Found [IP: 80]
15:25:25 E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

You can reproduce this locally by attempting to perform the build for the EdgeX project by doing the following:

git clone

which will launch the docker container and attempt to run the build. Also note that this is only reproducible on x86 (obvious since the docker image for snapcraft is only published for x86).

Lastly, if you just want to look at the full build, take a look at a recent Jenkins build we have that fails:

404 looks more like your local package cache is outdated and a simple apt update would solve it

Sure, but this is the upstream docker image that causes this, we don’t call apt update anywhere.
Unless I’m using the image wrong… This is all we’re doing with the dockerfile:

FROM snapcore/snapcraft:stable

# include all of the build context inside /build
COPY . /build

# run the script to actually perform the build when the container is run
WORKDIR /build
ENTRYPOINT [ "/build/snap/" ]

and is:

#!/bin/bash -e

# Required by click.
export LC_ALL=C.UTF-8

# build the snap
cd /build
snapcraft clean

# other stuff specific to the project

we definitely should :slight_smile: (also for proper versions (specifically security fixes) of build and stage packages during the build)

$ wget -q -O-|html2text|grep linux-libc-dev_4.4.0
[[   ]]       linux-libc-dev_4.4.0-21.37_amd64.deb        2016-04-19 10:21 810K
[[   ]]       linux-libc-dev_4.4.0-21.37_i386.deb         2016-04-19 10:24 811K
[[   ]]       linux-libc-dev_4.4.0-137.163_amd64.deb      2018-09-26 09:53 831K
[[   ]]       linux-libc-dev_4.4.0-137.163_i386.deb       2018-09-26 09:53 831K
[[   ]]       linux-libc-dev_4.4.0-138.164_amd64.deb      2018-10-04 08:53 839K
[[   ]]       linux-libc-dev_4.4.0-138.164_i386.deb       2018-10-04 08:54 839K

I guess it’s confusing to me that we would need to call apt update in a docker image that supposedly already contains a working snapcraft…

If that is the case then it sounds like the right thing to do is to update the docker image that snapcraft publishes so it does an apt update when the container starts.

your build-packages/stage-packages definitely come from the archive using the local package lists of the build machine, so these should be updated before you fire off the build to make sure to have the latest meta info …

Shouldn’t calling snapcraft update the sources it needs when it goes to do the build?
Or do I now need to call apt update && snapcraft every time?

not sure if snapcraft calls update or simply attempts to install the listed packages …

Hello! :wave:
I see is quite old post, but I just felt into this issue and I did not find a solution… :frowning:
I don’t have any other way to build snap at the moment, do you have any recommendation?

Thank you! :pray:

The solution is to run apt update before running snapcraft in your docker container