urkel icon indicating copy to clipboard operation
urkel copied to clipboard

Error: ENOENT: no such file or directory, uv_os_get_passwd

Open d-xo opened this issue 5 years ago • 4 comments

I get this error when trying to run hsd in a systemd service. The error is thrown on this line.

From googling around I see some similar issues where this can occur if the user in question does not have an entry in /etc/passwd:

  • https://github.com/stepankuzmin/tilelive-postgis/issues/10
  • https://github.com/Unitech/pm2/issues/3184

Full Stack Trace

os.js:272
    throw new ERR_SYSTEM_ERROR(ctx);
    ^
SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
    at Object.userInfo (os.js:272:11)
    at Object.<anonymous> (/nix/store/6ndjrl5111qxdiz2wpvb0v30msra0ypk-node_hsd-2.2.0/lib/node_modules/hsd/node_modules/urkel/lib/radix/mfs.js:21:8)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/nix/store/6ndjrl5111qxdiz2wpvb0v30msra0ypk-node_hsd-2.2.0/lib/node_modules/hsd/node_modules/urkel/lib/radix/store.js:17:13)
    at Module._compile (internal/modules/cjs/loader.js:1137:30) {
  code: 'ERR_SYSTEM_ERROR',
  info: {
    errno: -2,
    code: 'ENOENT',
    message: 'no such file or directory',
    syscall: 'uv_os_get_passwd'
  },
  errno: [Getter/Setter],
  syscall: [Getter/Setter]
}

d-xo avatar Sep 25 '20 12:09 d-xo

What's your operating system?

pinheadmz avatar Sep 25 '20 12:09 pinheadmz

nixos

d-xo avatar Sep 25 '20 12:09 d-xo

After playing around with the systemd unit a bit more, the error seems to trigger when I enable some of the systemd confinement settings (docs here). Presumably there are some systemd switches that make /etc/passwd unavailable to the service...

d-xo avatar Sep 25 '20 13:09 d-xo

I'm not familiar with nixos, I wonder if the os object has different properties in nodejs. If you can solve this please let us know or open a PR for compatibility. What version of nodejs are you running?

pinheadmz avatar Sep 25 '20 14:09 pinheadmz