Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootstrap-image fails on node-pty when running on Cortex-A53 #400

Closed
joezappie opened this issue Feb 4, 2023 · 5 comments
Closed

bootstrap-image fails on node-pty when running on Cortex-A53 #400

joezappie opened this issue Feb 4, 2023 · 5 comments

Comments

@joezappie
Copy link

joezappie commented Feb 4, 2023

I hope this is the correct repo for this. I have a devcontainer that works when cloning in Windows. I 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 which appears to be when building the "bootstrap-image" container:

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. Any help would be appreciated. Looking through the old devcontainers repository, there was an issue for supporting arm64 which seems like it was completed. Maybe I'm wrong on that assumption.

Full stack trace

[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
@joezappie
Copy link
Author

To dig into this more, I manually booted up a container on the board using the "node:16.16.0" image and installed node-pty works fine!

# Dockerfile
FROM node:16.16.0
RUN cd && npm i node-pty

---------------------
docker build . --no-cache
Sending build context to Docker daemon  3.072kB
Step 1/2 : FROM node:16.16.0
 ---> 21f4b87b4155
Step 2/2 : RUN cd && npm i node-pty
 ---> Running in 8ef1bb7f8d06

added 2 packages, and audited 3 packages in 11s

found 0 vulnerabilities
npm notice 
npm notice New major version of npm available! 8.11.0 -> 9.4.1
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.4.1>
npm notice Run `npm install -g npm@9.4.1` to update!
npm notice 
Removing intermediate container 8ef1bb7f8d06
 ---> 8da08ad9deff
Successfully built 8da08ad9deff

Manually running the Dockerfile provided bootstrap-image does fail. So theres some critical difference between devcontainer apline image and node's image to not let node-pty install properly.

# bootstrap-image/0.266.1/bootstrap.Dockerfile
FROM mcr.microsoft.com/devcontainers/base:0-alpine-3.16

RUN apk add --no-cache \
        nodejs \
        python3 \
        npm \
        make \
        g++ \
        docker-cli \
        docker-cli-buildx \
        docker-cli-compose \
        ;

RUN cd && npm i node-pty

COPY .vscode-remote-containers /root/.vscode-remote-containers

@joezappie
Copy link
Author

joezappie commented Feb 4, 2023

I commended out the RUN cd && npm i node-pty line so I could start/attach a container with it. Manually trying to install node-pty once inside the container, I could then get to the log file. Pretty much the same thing but maybe theres something useful:

/root/.npm/_logs/2023-02-04T02_36_56_294Z-debug-0.log
0 verbose cli /usr/bin/node /usr/bin/npm
1 info using npm@8.10.0
2 info using node@v16.17.1
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 12ms
5 timing config:load:file:/usr/lib/node_modules/npm/npmrc Completed in 35ms
6 timing config:load:builtin Completed in 37ms
7 timing config:load:cli Completed in 13ms
8 timing config:load:env Completed in 1ms
9 timing config:load:project Completed in 19ms
10 timing config:load:file:/root/.npmrc Completed in 2ms
11 timing config:load:user Completed in 2ms
12 timing config:load:file:/etc/npmrc Completed in 1ms
13 timing config:load:global Completed in 1ms
14 timing config:load:validate Completed in 1ms
15 timing config:load:credentials Completed in 5ms
16 timing config:load:setEnvs Completed in 6ms
17 timing config:load Completed in 102ms
18 timing npm:load:configload Completed in 104ms
19 timing npm:load:mkdirpcache Completed in 6ms
20 timing npm:load:mkdirplogs Completed in 4ms
21 verbose title npm i node-pty
22 verbose argv "i" "node-pty"
23 timing npm:load:setTitle Completed in 6ms
24 timing config:load:flatten Completed in 18ms
25 timing npm:load:display Completed in 29ms
26 verbose logfile logs-max:10 dir:/root/.npm/_logs
27 verbose logfile /root/.npm/_logs/2023-02-04T02_36_56_294Z-debug-0.log
28 timing npm:load:logFile Completed in 30ms
29 timing npm:load:timers Completed in 0ms
30 timing npm:load:configScope Completed in 0ms
31 timing npm:load Completed in 185ms
32 timing arborist:ctor Completed in 5ms
33 silly logfile done cleaning log files
34 timing arborist:ctor Completed in 0ms
35 timing idealTree:init Completed in 69ms
36 timing idealTree:userRequests Completed in 12ms
37 silly idealTree buildDeps
38 silly fetch manifest node-pty@*
39 http fetch GET 200 https://registry.npmjs.org/node-pty 478ms (cache miss)
40 silly placeDep ROOT node-pty@0.10.1 OK for:  want: *
41 silly fetch manifest nan@^2.14.0
42 http fetch GET 200 https://registry.npmjs.org/nan 80ms (cache miss)
43 timing idealTree:#root Completed in 647ms
44 silly placeDep ROOT nan@2.17.0 OK for: node-pty@0.10.1 want: ^2.14.0
45 timing idealTree:node_modules/node-pty Completed in 19ms
46 timing idealTree:node_modules/nan Completed in 0ms
47 timing idealTree:buildDeps Completed in 672ms
48 timing idealTree:fixDepFlags Completed in 3ms
49 timing idealTree Completed in 763ms
50 timing reify:loadTrees Completed in 767ms
51 timing reify:diffTrees Completed in 6ms
52 silly reify moves {}
53 timing reify:retireShallow Completed in 6ms
54 timing reify:createSparse Completed in 15ms
55 timing reify:loadBundles Completed in 0ms
56 silly audit bulk request { 'node-pty': [ '0.10.1' ], nan: [ '2.17.0' ] }
57 silly tarball no local data for nan@https://registry.npmjs.org/nan/-/nan-2.17.0.tgz. Extracting by manifest.
58 silly tarball no local data for node-pty@https://registry.npmjs.org/node-pty/-/node-pty-0.10.1.tgz. Extracting by manifest.
59 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 156ms
60 timing auditReport:getReport Completed in 165ms
61 silly audit report {}
62 timing auditReport:init Completed in 0ms
63 timing reify:audit Completed in 170ms
64 http fetch GET 200 https://registry.npmjs.org/nan/-/nan-2.17.0.tgz 680ms (cache miss)
65 timing reifyNode:node_modules/nan Completed in 729ms
66 http fetch GET 200 https://registry.npmjs.org/node-pty/-/node-pty-0.10.1.tgz 1127ms (cache miss)
67 timing reifyNode:node_modules/node-pty Completed in 1200ms
68 timing reify:unpack Completed in 1203ms
69 timing reify:unretire Completed in 0ms
70 timing build:queue Completed in 10ms
71 info run node-pty@0.10.1 install node_modules/node-pty node scripts/install.js
72 info run node-pty@0.10.1 install { code: 1, signal: null }
73 timing reify:rollback:createSparse Completed in 171ms
74 timing reify:rollback:retireShallow Completed in 0ms
75 timing command:i Completed in 7907ms
76 verbose stack Error: command failed
76 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:63:27)
76 verbose stack     at ChildProcess.emit (node:events:513:28)
76 verbose stack     at maybeClose (node:internal/child_process:1093:16)
76 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
77 verbose pkgid node-pty@0.10.1
78 verbose cwd /root
79 verbose Linux 5.4.193-5.7.1-devel+git.f78299297185
80 verbose node v16.17.1
81 verbose npm  v8.10.0
82 error code 1
83 error path /root/node_modules/node-pty
84 error command failed
85 error command sh -c node scripts/install.js
86 error make: Entering directory '/root/node_modules/node-pty/build'
86 error make: Leaving directory '/root/node_modules/node-pty/build'
87 error gyp info it worked if it ends with ok
87 error gyp info using node-gyp@9.0.0
87 error gyp info using node@16.17.1 | linux | arm64
87 error gyp info find Python using Python version 3.10.9 found at "/usr/bin/python3"
87 error gyp http GET https://nodejs.org/download/release/v16.17.1/node-v16.17.1-headers.tar.gz
87 error gyp http 200 https://nodejs.org/download/release/v16.17.1/node-v16.17.1-headers.tar.gz
87 error gyp http GET https://nodejs.org/download/release/v16.17.1/SHASUMS256.txt
87 error gyp http 200 https://nodejs.org/download/release/v16.17.1/SHASUMS256.txt
87 error gyp info spawn /usr/bin/python3
87 error gyp info spawn args [
87 error gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
87 error gyp info spawn args   'binding.gyp',
87 error gyp info spawn args   '-f',
87 error gyp info spawn args   'make',
87 error gyp info spawn args   '-I',
87 error gyp info spawn args   '/root/node_modules/node-pty/build/config.gypi',
87 error gyp info spawn args   '-I',
87 error gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
87 error gyp info spawn args   '-I',
87 error gyp info spawn args   '/root/.cache/node-gyp/16.17.1/include/node/common.gypi',
87 error gyp info spawn args   '-Dlibrary=shared_library',
87 error gyp info spawn args   '-Dvisibility=default',
87 error gyp info spawn args   '-Dnode_root_dir=/root/.cache/node-gyp/16.17.1',
87 error gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
87 error gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/16.17.1/<(target_arch)/node.lib',
87 error gyp info spawn args   '-Dmodule_root_dir=/root/node_modules/node-pty',
87 error gyp info spawn args   '-Dnode_engine=v8',
87 error gyp info spawn args   '--depth=.',
87 error gyp info spawn args   '--no-parallel',
87 error gyp info spawn args   '--generator-output',
87 error gyp info spawn args   'build',
87 error gyp info spawn args   '-Goutput_dir=.'
87 error gyp info spawn args ]
87 error gyp info spawn make
87 error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
87 error make: printf: Operation not permitted
87 error make: *** [pty.target.mk:107: Release/obj.target/pty/src/unix/pty.o] Error 127
87 error gyp ERR! build error
87 error gyp ERR! stack Error: `make` failed with exit code: 2
87 error gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
87 error gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
87 error gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
87 error gyp ERR! System Linux 5.4.193-5.7.1-devel+git.f78299297185
87 error gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
87 error gyp ERR! cwd /root/node_modules/node-pty
87 error gyp ERR! node -v v16.17.1
87 error gyp ERR! node-gyp -v v9.0.0
87 error gyp ERR! not ok
88 verbose exit 1
89 timing npm Completed in 8476ms
90 verbose unfinished npm timer reify 1675478216841
91 verbose unfinished npm timer reify:build 1675478218915
92 verbose unfinished npm timer build 1675478218916
93 verbose unfinished npm timer build:deps 1675478218917
94 verbose unfinished npm timer build:run:install 1675478218929
95 verbose unfinished npm timer build:run:install:node_modules/node-pty 1675478218931
96 verbose code 1

@samruddhikhandale samruddhikhandale transferred this issue from devcontainers/images Feb 6, 2023
@samruddhikhandale
Copy link
Member

Hi @jrj2211 👋

Do you mind pasting the contents of your dev container? It will help the investigation.

@joezappie
Copy link
Author

Hi @samruddhikhandale,

Thanks for the quick response. I found an issue over on Docker's repo about alpine v3.14 having this issue with Docker versions older than 20.10. The version of Linux these boards ship with only has Docker 18.09.1 which is EOL. The solution seems to be update to a current version of Docker (hopefully).

docker-library/php#1177

I will report back shortly, hopefully closing this issue with it just being a Docker version mismatch.

@joezappie
Copy link
Author

Yup! It was just an out of date Docker that was causing the permission error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants