polar icon indicating copy to clipboard operation
polar copied to clipboard

Bug: clightning docker images fails because of cert generation error

Open limpbrains opened this issue 2 years ago • 2 comments
trafficstars

Describe the bug When start clightning image with Polar or without, it fails with an error:

2023-08-04T11:50:04.034Z UNUSUAL plugin-plugin.js: --- Starting the cl-rest server ---
Generating a RSA private key
.....+++++
.......+++++
writing new private key to './certs/key.tmp.pem'
req: Can't open "./certs/key.tmp.pem" for writing, Permission denied
2023-08-04T11:50:04.052Z **BROKEN** plugin-plugin.js: {\"status\":1,\"signal\":null,\"output\":[null,\"\",\"Generating a RSA private key\\n.....+++++\\n.......+++++\\nwriting new private key to './certs/key.tmp.pem'\\nreq: Can't open \\\"./certs/key.tmp.pem\\\" for writing, Permission denied\\n\"],\"pid\":79,\"stdout\":\"\",\"stderr\":\"Generating a RSA private key\\n.....+++++\\n.......+++++\\nwriting new private key to './certs/key.tmp.pem'\\nreq: Can't open \\\"./certs/key.tmp.pem\\\" for writing, Permission denied\\n\"}
(node:48) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open './certs/key.pem'
    at Object.openSync (fs.js:498:3)
    at Object.readFileSync (fs.js:394:35)
    at Object.<anonymous> (/opt/c-lightning-rest/cl-rest.js:79:13)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at Plugin.restPlugin.onInit (/opt/c-lightning-rest/plugin.js:32:12)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:48) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:48) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

To Reproduce Steps to reproduce the behavior:

  1. Create polar network with clightning node
  2. Run it
  3. Look at clightning logs docker logs --follow clightning

Desktop (please complete the following information):

  • OS: MacOS Ventura 13.3.1 (a) (22E772610a)
  • Polar Version: 2.0.0
  • Docker desktop: 4.21.1
  • Docker Version: 24.0.2
  • Docker Compose Version: v2.19.1

limpbrains avatar Aug 04 '23 12:08 limpbrains

This looks like an issue with file system permissions.

  • Is this with the latest Core Lightning v23.05.2?
  • Are you using Polar's docker image or a custom image?

I've seen Docker exhibit some weird behavior from time to time. You can try restarting or even reinstalling it.

jamaljsr avatar Aug 04 '23 20:08 jamaljsr

Is this with the latest Core Lightning v23.05.2?

yes

Are you using Polar's docker image or a custom image?

Polar's docker image

This looks like an issue with file system permissions.

Yes, it is. When I mounted /opt/c-lightning-rest/certs/ and chmod it to 777, service was able to create certificates and start.

You can try restarting or even reinstalling.

Restarting / reinstalling doesn't help

limpbrains avatar Aug 07 '23 10:08 limpbrains