I have a devcontainer that works when cloning in Windows. We need to also be able to run it on our actual hardware, which we use a Tordex Verdin ARMv8-A SOM.
In Vscode, I'm first connecting to my board via remote-ssh. I'm then using the "Dev Containers: Clone repository in container volume" command. Using my projects repo or any of Microsofts "remote-try-xxx" projects, the same error occurs:
docker build -f /tmp/vsch-torizon/bootstrap-image/0.266.1/bootstrap.Dockerfile -t vsc-volume-bootstrap /tmp/vsch-torizon/bootstrap-image/0.266.1
The command '/bin/sh -c cd && npm i node-pty' returned a non-zero code: 1
These Toradex boards use a very stripped down version of linux to speed up boot time so I'm guessing I'm probably missing some needed dependency but the provided error doesn't lend itself to figure out what could be missing.
[172 ms] Dev Containers 0.266.1 in VS Code 1.74.3 (97dec172d3256f8ca4bfb2143f3f76b503ca0534).
[172 ms] Start: Resolving Remote
[178 ms] Start: Run: ssh 192.168.2.196 /bin/sh
[200 ms] Start: Run in host: id -un
[490 ms] torizon
[491 ms]
[491 ms] Start: Run in host: cat /etc/passwd
[513 ms] Start: Run in host: echo ~
[517 ms] /home/torizon
[518 ms]
[518 ms] Start: Run in host: test -x '/home/torizon/.vscode-remote-containers/bin/97dec172d3256f8ca4bfb2143f3f76b503ca0534/node'
[521 ms]
[522 ms]
[522 ms] Exit code 1
[523 ms] Start: Run in host: test -x '/home/torizon/.vscode-server/bin/97dec172d3256f8ca4bfb2143f3f76b503ca0534/node'
[527 ms]
[527 ms]
[528 ms] Start: Run in host: test -f '/home/torizon/.vscode-server/bin/97dec172d3256f8ca4bfb2143f3f76b503ca0534/node_modules/node-pty/package.json'
[531 ms]
[531 ms]
[532 ms] Start: Run in host: test -f '/home/torizon/.vscode-remote-containers/dist/vscode-remote-containers-server-0.266.1.js'
[536 ms]
[536 ms]
[539 ms] userEnvProbe: loginInteractiveShell (default)
[540 ms] userEnvProbe shell: /bin/sh
[864 ms] userEnvProbe PATHs:
Probe: '/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/sbin:/usr/sbin:/sbin'
Container: None
[884 ms] Start: Check Docker is running
[885 ms] Start: Run in Host: docker version --format {{.Server.APIVersion}}
[1039 ms] Server API version: 1.40
[1040 ms] Start: Run in Host: docker volume ls -q
[1263 ms] Start: Run in Host: docker build -f /tmp/vsch-torizon/bootstrap-image/0.266.1/bootstrap.Dockerfile -t vsc-volume-bootstrap /tmp/vsch-torizon/bootstrap-image/0.266.1
Sending build context to Docker daemon 2.199MB
Step 1/4 : FROM mcr.microsoft.com/devcontainers/base:0-alpine-3.16
---> 5f5f7d3fea4f
Step 2/4 : RUN apk add --no-cache nodejs python3 npm make g++ docker-cli docker-cli-buildx docker-cli-compose ;
---> Using cache
---> d51a0bda5431
Step 3/4 : RUN cd && npm i node-pty
---> Running in 699eece3930c
npm ERR! code 1
npm ERR! path /root/node_modules/node-pty
npm ERR! command failed
npm ERR! command sh -c node scripts/install.js
npm ERR! make: Entering directory '/root/node_modules/node-pty/build'
npm ERR! make: Leaving directory '/root/node_modules/node-pty/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.17.1 | linux | arm64
npm ERR! gyp info find Python using Python version 3.10.9 found at "/usr/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v16.17.1/node-v16.17.1-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.17.1/node-v16.17.1-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.17.1/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.17.1/SHASUMS256.txt
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/root/node_modules/node-pty/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/root/.cache/node-gyp/16.17.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/16.17.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/16.17.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/root/node_modules/node-pty',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! make: printf: Operation not permitted
npm ERR! make: *** [pty.target.mk:107: Release/obj.target/pty/src/unix/pty.o] Error 127
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.4.193-5.7.1-devel+git.f78299297185
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /root/node_modules/node-pty
npm ERR! gyp ERR! node -v v16.17.1
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-02-04T00_18_37_401Z-debug-0.log
The command '/bin/sh -c cd && npm i node-pty' returned a non-zero code: 1
[13115 ms] Command failed: docker build -f /tmp/vsch-torizon/bootstrap-image/0.266.1/bootstrap.Dockerfile -t vsc-volume-bootstrap /tmp/vsch-torizon/bootstrap-image/0.266.1
[13115 ms] Exit code 1
The issue was that the version of linux these embedded boards ship with was v18 which causes issues with newer releases of the alpine container microsoft uses for the bootstrap container.
The solution was to upgrade Docker to v20+.
Original issue that led me to figuring this out: https://github.com/docker-library/php/issues/1177