X server is needed? #6

Closed
opened 2021-05-03 00:14:40 -04:00 by lecris · 8 comments
Contributor

I cannot seem to start-up the python -m matrix_puppeteer_line after all of the configurations:

Traceback (most recent call last):
  File "/opt/synapse/bridges/matrix-puppeteer-line/.venv/lib/python3.8/site-packages/mautrix/util/program.py", line 190, in _run
    self.loop.run_until_complete(self.start())
  File "/usr/lib64/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/opt/synapse/bridges/matrix-puppeteer-line/matrix_puppeteer_line/__main__.py", line 75, in start
    await super().start()
  File "/opt/synapse/bridges/matrix-puppeteer-line/.venv/lib/python3.8/site-packages/mautrix/bridge/bridge.py", line 154, in start
    await super().start()
  File "/opt/synapse/bridges/matrix-puppeteer-line/.venv/lib/python3.8/site-packages/mautrix/util/program.py", line 213, in start
    await asyncio.gather(*(self.startup_actions or []))
  File "/opt/synapse/bridges/matrix-puppeteer-line/matrix_puppeteer_line/user.py", line 95, in connect
    state = await self.client.start()
  File "/opt/synapse/bridges/matrix-puppeteer-line/matrix_puppeteer_line/rpc/client.py", line 32, in start
    return StartStatus.deserialize(await self.request("start"))
  File "/opt/synapse/bridges/matrix-puppeteer-line/matrix_puppeteer_line/rpc/rpc.py", line 178, in request
    return await future
matrix_puppeteer_line.rpc.types.RPCError: Error: Failed to launch the browser process!
[987671:987671:0503/125122.386576:ERROR:browser_main_loop.cc(1439)] Unable to open X display.

This is on a headless server, any ideas of how to circumvent this?

I cannot seem to start-up the `python -m matrix_puppeteer_line` after all of the configurations: ``` Traceback (most recent call last): File "/opt/synapse/bridges/matrix-puppeteer-line/.venv/lib/python3.8/site-packages/mautrix/util/program.py", line 190, in _run self.loop.run_until_complete(self.start()) File "/usr/lib64/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "/opt/synapse/bridges/matrix-puppeteer-line/matrix_puppeteer_line/__main__.py", line 75, in start await super().start() File "/opt/synapse/bridges/matrix-puppeteer-line/.venv/lib/python3.8/site-packages/mautrix/bridge/bridge.py", line 154, in start await super().start() File "/opt/synapse/bridges/matrix-puppeteer-line/.venv/lib/python3.8/site-packages/mautrix/util/program.py", line 213, in start await asyncio.gather(*(self.startup_actions or [])) File "/opt/synapse/bridges/matrix-puppeteer-line/matrix_puppeteer_line/user.py", line 95, in connect state = await self.client.start() File "/opt/synapse/bridges/matrix-puppeteer-line/matrix_puppeteer_line/rpc/client.py", line 32, in start return StartStatus.deserialize(await self.request("start")) File "/opt/synapse/bridges/matrix-puppeteer-line/matrix_puppeteer_line/rpc/rpc.py", line 178, in request return await future matrix_puppeteer_line.rpc.types.RPCError: Error: Failed to launch the browser process! [987671:987671:0503/125122.386576:ERROR:browser_main_loop.cc(1439)] Unable to open X display. ``` This is on a headless server, any ideas of how to circumvent this?
Owner

Yes, an X server is needed, as Puppeteer cannot be run headless with extensions enabled in Chrome (doc).

What should work is running an X server in the background. Some options for doing so are given here: https://stackoverflow.com/questions/32156691/running-a-program-with-gui-without-displaying-in-ubuntu.

Once I find a way of doing this that works, I'll add it to SETUP.md. Rest assured that I certainly want this bridge to work on headless servers.

Yes, an X server is needed, as Puppeteer cannot be run headless with extensions enabled in Chrome ([doc](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#working-with-chrome-extensions)). What should work is running an X server in the background. Some options for doing so are given here: https://stackoverflow.com/questions/32156691/running-a-program-with-gui-without-displaying-in-ubuntu. Once I find a way of doing this that works, I'll add it to SETUP.md. Rest assured that I certainly want this bridge to work on headless servers.
Author
Contributor

Hmm, I see that chrome has built-in headless. Does it not work with extensions?

Hmm, I see that chrome has built-in [`headless`](https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md). Does it not work with extensions?
Owner

I haven't tried using the flag directly, but I did try using Puppeteer's headless mode, which I believe sets that flag itself. Doing so prevents the LINE extension from being loaded, unfortunately.

I haven't tried using the flag directly, but I did try using Puppeteer's headless mode, which I believe sets that flag itself. Doing so prevents the LINE extension from being loaded, unfortunately.
Author
Contributor

Hmm, that's unfortunate. So until that's solved we'll use something like xvfb? Are there many adjustments needed to get that working?

Hmm, that's unfortunate. So until that's solved we'll use something like [`xvfb`](https://stackoverflow.com/a/59793651)? Are there many adjustments needed to get that working?
Owner

I assume no adjustments are needed, but I haven't tried it yet.

I assume no adjustments are needed, but I haven't tried it yet.
Author
Contributor

I've confirmed that xvfb-run node src/main.js gets it working

I've confirmed that `xvfb-run node src/main.js` gets it working
Owner

Great, thanks for confirming!
I'll update SETUP.md to mention this.

Great, thanks for confirming! I'll update SETUP.md to mention this.
Owner

Instructions added by 862398c00e.

Instructions added by 862398c00e.
fair closed this issue 2021-05-06 03:02:03 -04:00
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: fair/matrix-puppeteer-line#6
No description provided.