maxwellhadley / node-red-contrib-rfxcom

node-RED nodes to access an RFXtrx433 transceiver
BSD 2-Clause "Simplified" License
22 stars 13 forks source link

Dependance on serialport not working on docker custom data-root #141

Closed bevrat closed 3 months ago

bevrat commented 3 months ago

I've got node-red and node-red-contrib-rfxcom perfectly working on a container, using the default Docker data-root (/var/lib/docker) On the same system, I moved the Docker data-root to a custom path ('/srv/path-to-a-verylong-disk-byId/dockerdb).

I create a totaly new node-red container, to avoid import error with docker volumes. In this fresh node-red container, I try to install node-red-contrib-rfxcom with the palette

I got the following error

18 Jul 20:40:25 - [info] Installing module: node-red-contrib-rfxcom, version: 2.13.0
18 Jul 20:40:27 - [warn] Installation of module node-red-contrib-rfxcom failed:
18 Jul 20:40:27 - [warn] ------------------------------------------
18 Jul 20:40:27 - [warn] npm error code 126
npm error path /data/node_modules/@serialport/bindings-cpp
npm error command failed
npm error command sh -c node-gyp-build
npm error sh: node-gyp-build: Permission denied

npm error A complete log of this run can be found in: /data/.npm/_logs/2024-07-18T20_40_26_164Z-debug-0.log

In the full log, I got

93 info run @serialport/bindings-cpp@11.0.3 install node_modules/@serialport/bindings-cpp node-gyp-build
94 info run @serialport/bindings-cpp@11.0.3 install { code: 126, signal: null }
95 verbose stack Error: command failed
95 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
95 verbose stack     at ChildProcess.emit (node:events:519:28)
95 verbose stack     at maybeClose (node:internal/child_process:1105:16)
95 verbose stack     at Socket.<anonymous> (node:internal/child_process:457:11)
95 verbose stack     at Socket.emit (node:events:519:28)
95 verbose stack     at Pipe.<anonymous> (node:net:338:12)
96 verbose pkgid @serialport/bindings-cpp@11.0.3
97 verbose cwd /data
98 verbose Linux 6.1.0-0.deb11.13-amd64
99 verbose node v20.15.1
100 verbose npm  v10.7.0
101 error code 126
102 error path /data/node_modules/@serialport/bindings-cpp
103 error command failed
104 error command sh -c node-gyp-build
105 error sh: node-gyp-build: Permission denied
106 verbose exit 126
107 verbose code 126

I have no idea, why just changing the docker data-root make such an error. Is there some hardcoded path somewhere pointing to old docker data-root, is there a limitation on the path length (my new disk where data-root is stored has a very long id, so the new data-root path is long) ?

maxwellhadley commented 3 months ago

The installer is trying to compile serialport from sources (why?), but it is unable to write to some directory or other because it doesn't have permissions. Clearly, in the 'old' container it did have permission, but not in the new. I believe these are temporary directories created by node-gyp-build, so it's probably a parent directory that doesn't have the appropriate permissions.

bevrat commented 3 months ago

I told myself that indeed there should be permission issues. I checked all permission on the folder, they were OK. But I missed a huge one : the partition was mounted with the noexec attribute.... I removed in fstab the noexec and it works now perfectly.

maxwellhadley commented 3 months ago

Doh!