Install resin-cli in docker fails

I successfully build a docker image with the resin-cli inside a couple of months ago.

However, I tried again recently and it does not work. Using RUN npm install resin-cli -g --production --unsafe-perm raises the following error:

../deps/e2fsprogs/lib/ext2fs/getsectsize.c:34:22: fatal error: linux/fd.h: No such file or directory
 #include <linux/fd.h>

I checked that this is a dependency project which recently changed. However, I can install the resin-cli doing the following:

  1. use docker run to run a /bin/bash terminal inside the container that I am building
  2. then, use npm install resin-cli -g --production. That is, without --unsafe-perm. That does not work. It reach to an infinite try-exception with the following errors:
gyp WARN EACCES user "nobody" does not have permission to access the dev dir "/usr/lib/node_modules/resin-cli/node_modules/ext2fs/.node-gyp/8.9.3"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/resin-cli/node_modules/ext2fs/.node-gyp"
  1. However, if I manually stop the command at this point, and run again npm install resin-cli -g --production --unsafe-perm it works!

This is not a solution, because I cannot write a Dockerfile with this sequence of steps, but I hope it is enough information for you to debug this issue :slight_smile:

Thank you!

I forgot to mention that I am using docker as base image (docker in docker), which is an Alpine Linux

hi , firstly, can you check while in the container that fd.h is indeed available?

I didn’t find the fd.h file neither before and after trying to install (and stop) npm install resin-cli -g --production.

I checked that the dependency ext2fs is the one which fails. Moreover, if I try to install npm install ext2fs the error is the same. It is strange because when I run step 2 (try to install resin-cli and stop), I can install resin-cli, but I can’t ext2fs. It seems that some kind of checking by resin-cli continues the installation, but I don’t know if the behaviour would be totally correct.

I attach you my Dockerfile just in case I’m missing something:

FROM docker
RUN apk --update --no-cache add bash git openssh python python3 g++ make nodejs nodejs-npm yarn
RUN npm install resin-cli -g --production --unsafe-perm

Thank you!

Ok I found the problem. In this linux distribution there is a dependency (linux-headers) which must be installed: apk add linux-headers. This solved the problem.

Thank you again!

Right, that explains it. Glad that made it work

However it seems there is something more. It seems that it successfully installed the resin-cli tool, but when I use resin deploy MyAppName it fails:

Error relocating /usr/lib/node_modules/resin-cli/node_modules/resin-image-fs/node_modules/ext2fs/build/Release/bindings.node: ext2fs_open_file: symbol not found

Do you know what the problem would be? Anyway I am searching and trying to guess what’s the problem here.

Thanks for your support.

Hi @jcozar,

Do you still have this issue? If so, can you please create an issue in with the context that is mention in this thread (i.e. the error messages) so that we can take it from there?

Thank you,


yes it still happens. It seems to be related with musl and glibc, because in alpine musl vis used instead of glibc. I will report the issue.

Thank you!

As discussed in the issue created from this, we believe this to be resolved. Feel free to let us know if we’re wrong!

I’m trying to use this with CircleCi. With the resincli image docker our build environment will be much smaller enabling faster buildtimes. For example we’re using for optimizing protobuf/grpc use, optimized its 22mb

Our current Dockerfile

FROM node:alpine
RUN apk --update --no-cache add \
        bash=4.4.19-r1 \
        git=2.15.2-r0 \
        openssh=7.5_p1-r8 \
        python=2.7.14-r2 \
        python3=3.6.3-r9 \
        g++=6.4.0-r5 \
        make=4.2.1-r0 \
        unzip=6.0-r2 \
        curl=7.60.0-r1 \

RUN npm install --unsafe-perm --global --production resin-cli@7.7.0

ENTRYPOINT ["resin"]


first of all thank you for your work and your time! I am sorry for my late response, but I couldn’t test it before.

Probably I am missing something, but If I first install npm i ext2fs@1.0.7 and then npm install --unsafe-perm --global --production resin-cli@7.7.0, it seems it works, but fails when I try to use the resin tool. For example, if I use resin local scan, it throws this error:

Error relocating /usr/local/lib/node_modules/resin-cli/node_modules/ext2fs/build/Release/bindings.node: ext2fs_open_file: symbol not found

I tried the Dockerfile that @ohlsont wrote but the error is the same.

Am I missing something??

Thank you!

@jcozar do you still have this issue?
I just created a Dockerfile based on the examples above and I can build and run resin-cli:


FROM docker
RUN apk --update --no-cache add bash git openssh python python3 g++ make nodejs nodejs-npm yarn linux-headers
RUN npm install resin-cli -g --production --unsafe-perm
$ docker build . -t resin-cli
Sending build context to Docker daemon  6.144kB
Step 1/3 : FROM docker
 ---> 9797f6e6a068
Step 2/3 : RUN apk --update --no-cache add bash git openssh python python3 g++ make nodejs nodejs-npm yarn linux-headers
 ---> Using cache
 ---> b671bd58ac9b
Step 3/3 : RUN npm install resin-cli -g --production --unsafe-perm
 ---> Using cache
 ---> 51bc22c304c9
Successfully built 51bc22c304c9
Successfully tagged resin-cli:latest
$ docker run resin-cli resin local scan
Reporting scan results
Could not find any resinOS devices in the local network

If you need help, don't hesitate in contacting us at:


It works now! Thank you very much @zvin!