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

Breaks on Linux with Pandoc 2 #17

Open
HaoZeke opened this issue Dec 3, 2017 · 12 comments
Open

Breaks on Linux with Pandoc 2 #17

HaoZeke opened this issue Dec 3, 2017 · 12 comments

Comments

@HaoZeke
Copy link

HaoZeke commented Dec 3, 2017

Running a file with your test snippet in the readme, I get the following:

Message:
    pandoc exited with code 83: (node:17947) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to launch chrome!
[1203/152112.372882:FATAL:zygote_host_impl_linux.cc(123)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
#0 0x560c4fcd0857 base::debug::StackTrace::StackTrace()
#1 0x560c4fce7041 logging::LogMessage::~LogMessage()
#2 0x560c4ee94711 content::ZygoteHostImpl::Init()
#3 0x560c4eb28da0 content::BrowserMainLoop::EarlyInitialization()
#4 0x560c4eb2f2de content::BrowserMainRunnerImpl::Initialize()
#5 0x560c53916dd6 headless::HeadlessContentMainDelegate::RunProcess()
#6 0x560c4fa1c9e7 content::RunNamedProcessTypeMain()
#7 0x560c4fa1d421 content::ContentMainRunnerImpl::Run()
#8 0x560c4fa2619d service_manager::Main()
#9 0x560c4fa1bf52 content::ContentMain()
#10 0x560c53916075 headless::(anonymous namespace)::RunContentMain()
#11 0x560c539160ea headless::HeadlessBrowserMain()
#12 0x560c4fa231b1 headless::HeadlessShellMain()
#13 0x560c4e4851bd ChromeMain
#14 0x7f6fea60ff6a __libc_start_main
#15 0x560c4e485029 <unknown>

Received signal 6
#0 0x560c4fcd0857 base::debug::StackTrace::StackTrace()
#1 0x560c4fcd03bf base::debug::(anonymous namespace)::StackDumpSignalHandler()
#2 0x7f6ff0a2ada0 <unknown>
#3 0x7f6fea6238a0 __GI_raise
#4 0x7f6fea624f09 __GI_abort
#5 0x560c4fccf402 base::debug::BreakDebugger()
#6 0x560c4fce742a logging::LogMessage::~LogMessage()
#7 0x560c4ee94711 content::ZygoteHostImpl::Init()
#8 0x560c4eb28da0 content::BrowserMainLoop::EarlyInitialization()
#9 0x560c4eb2f2de content::BrowserMainRunnerImpl::Initialize()
#10 0x560c53916dd6 headless::HeadlessContentMainDelegate::RunProcess()
#11 0x560c4fa1c9e7 content::RunNamedProcessTypeMain()
#12 0x560c4fa1d421 content::ContentMainRunnerImpl::Run()
#13 0x560c4fa2619d service_manager::Main()
#14 0x560c4fa1bf52 content::ContentMain()
#15 0x560c53916075 headless::(anonymous namespace)::RunContentMain()
#16 0x560c539160ea headless::HeadlessBrowserMain()
#17 0x560c4fa231b1 headless::HeadlessShellMain()
#18 0x560c4e4851bd ChromeMain
#19 0x7f6fea60ff6a __libc_start_main
#20 0x560c4e485029 <unknown>
  r8: 0000000000000000  r9: 00007fff89d89710 r10: 0000000000000008 r11: 0000000000000246
 r12: 00007fff89d89e30 r13: 0000000000000161 r14: 00007fff89d89e28 r15: 00007fff89d89e20
  di: 0000000000000002  si: 00007fff89d89710  bp: 00007fff89d899d0  bx: 0000000000000006
  dx: 0000000000000000  ax: 0000000000000000  cx: 00007f6fea6238a0  sp: 00007fff89d89710
  ip: 00007f6fea6238a0 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
 trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

(node:17947) [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.
fs.js:648
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/tmp/tmp-17905UFHHhEDJTzoS.tmp.png'
    at Object.fs.openSync (fs.js:648:18)
    at Object.fs.readFileSync (fs.js:553:33)
    at mermaid (/home/haozeke/.config/yarn/global/node_modules/mermaid-filter/index.js:63:27)
    at /home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:52:19
    at Array.forEach (<anonymous>)
    at walk (/home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:50:7)
    at /home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:74:16
    at Array.forEach (<anonymous>)
    at walk (/home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:73:20)
    at filter (/home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:36:10)
Error running filter mermaid-filter:
Filter returned error status 1

Details:
    domainEmitter: [object Object]
    domain: [object Object]
    domainThrown: false
Stack:
Error: pandoc exited with code 83: (node:17947) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to launch chrome!
[1203/152112.372882:FATAL:zygote_host_impl_linux.cc(123)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
#0 0x560c4fcd0857 base::debug::StackTrace::StackTrace()
#1 0x560c4fce7041 logging::LogMessage::~LogMessage()
#2 0x560c4ee94711 content::ZygoteHostImpl::Init()
#3 0x560c4eb28da0 content::BrowserMainLoop::EarlyInitialization()
#4 0x560c4eb2f2de content::BrowserMainRunnerImpl::Initialize()
#5 0x560c53916dd6 headless::HeadlessContentMainDelegate::RunProcess()
#6 0x560c4fa1c9e7 content::RunNamedProcessTypeMain()
#7 0x560c4fa1d421 content::ContentMainRunnerImpl::Run()
#8 0x560c4fa2619d service_manager::Main()
#9 0x560c4fa1bf52 content::ContentMain()
#10 0x560c53916075 headless::(anonymous namespace)::RunContentMain()
#11 0x560c539160ea headless::HeadlessBrowserMain()
#12 0x560c4fa231b1 headless::HeadlessShellMain()
#13 0x560c4e4851bd ChromeMain
#14 0x7f6fea60ff6a __libc_start_main
#15 0x560c4e485029 <unknown>

Received signal 6
#0 0x560c4fcd0857 base::debug::StackTrace::StackTrace()
#1 0x560c4fcd03bf base::debug::(anonymous namespace)::StackDumpSignalHandler()
#2 0x7f6ff0a2ada0 <unknown>
#3 0x7f6fea6238a0 __GI_raise
#4 0x7f6fea624f09 __GI_abort
#5 0x560c4fccf402 base::debug::BreakDebugger()
#6 0x560c4fce742a logging::LogMessage::~LogMessage()
#7 0x560c4ee94711 content::ZygoteHostImpl::Init()
#8 0x560c4eb28da0 content::BrowserMainLoop::EarlyInitialization()
#9 0x560c4eb2f2de content::BrowserMainRunnerImpl::Initialize()
#10 0x560c53916dd6 headless::HeadlessContentMainDelegate::RunProcess()
#11 0x560c4fa1c9e7 content::RunNamedProcessTypeMain()
#12 0x560c4fa1d421 content::ContentMainRunnerImpl::Run()
#13 0x560c4fa2619d service_manager::Main()
#14 0x560c4fa1bf52 content::ContentMain()
#15 0x560c53916075 headless::(anonymous namespace)::RunContentMain()
#16 0x560c539160ea headless::HeadlessBrowserMain()
#17 0x560c4fa231b1 headless::HeadlessShellMain()
#18 0x560c4e4851bd ChromeMain
#19 0x7f6fea60ff6a __libc_start_main
#20 0x560c4e485029 <unknown>
  r8: 0000000000000000  r9: 00007fff89d89710 r10: 0000000000000008 r11: 0000000000000246
 r12: 00007fff89d89e30 r13: 0000000000000161 r14: 00007fff89d89e28 r15: 00007fff89d89e20
  di: 0000000000000002  si: 00007fff89d89710  bp: 00007fff89d899d0  bx: 0000000000000006
  dx: 0000000000000000  ax: 0000000000000000  cx: 00007f6fea6238a0  sp: 00007fff89d89710
  ip: 00007f6fea6238a0 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
 trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

(node:17947) [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.
fs.js:648
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/tmp/tmp-17905UFHHhEDJTzoS.tmp.png'
    at Object.fs.openSync (fs.js:648:18)
    at Object.fs.readFileSync (fs.js:553:33)
    at mermaid (/home/haozeke/.config/yarn/global/node_modules/mermaid-filter/index.js:63:27)
    at /home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:52:19
    at Array.forEach (<anonymous>)
    at walk (/home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:50:7)
    at /home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:74:16
    at Array.forEach (<anonymous>)
    at walk (/home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:73:20)
    at filter (/home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:36:10)
Error running filter mermaid-filter:
Filter returned error status 1

    at ChildProcess.<anonymous> (/home/haozeke/Github/Pandoc/grimoire/node_modules/metalsmith-pandoc/index.js:90:21)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:927:16)
    at Socket.stream.socket.on (internal/child_process.js:348:11)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at Pipe._handle.close [as _onclose] (net.js:557:12)
@HaoZeke HaoZeke changed the title Breaks internally with gulp. Breaks without chrome? Dec 3, 2017
@raghur
Copy link
Owner

raghur commented Dec 3, 2017

Can you test with just pandoc -F to check if things are basically working?

@HaoZeke
Copy link
Author

HaoZeke commented Dec 3, 2017

Yup, same error...

@raghur
Copy link
Owner

raghur commented Dec 4, 2017

I'm unable to reproduce this on a fresh installation with the test.md in the repo. Can you paste in your exact command and output with just pandoc -F mermaid-filter?

@HaoZeke
Copy link
Author

HaoZeke commented Dec 4, 2017

Sure..

pandoc -F mermaid-filter test.md
(node:25800) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to launch chrome!
[1204/114408.094911:FATAL:zygote_host_impl_linux.cc(123)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
#0 0x561094287857 base::debug::StackTrace::StackTrace()
#1 0x56109429e041 logging::LogMessage::~LogMessage()
#2 0x56109344b711 content::ZygoteHostImpl::Init()
#3 0x5610930dfda0 content::BrowserMainLoop::EarlyInitialization()
#4 0x5610930e62de content::BrowserMainRunnerImpl::Initialize()
#5 0x561097ecddd6 headless::HeadlessContentMainDelegate::RunProcess()
#6 0x561093fd39e7 content::RunNamedProcessTypeMain()
#7 0x561093fd4421 content::ContentMainRunnerImpl::Run()
#8 0x561093fdd19d service_manager::Main()
#9 0x561093fd2f52 content::ContentMain()
#10 0x561097ecd075 headless::(anonymous namespace)::RunContentMain()
#11 0x561097ecd0ea headless::HeadlessBrowserMain()
#12 0x561093fda1b1 headless::HeadlessShellMain()
#13 0x561092a3c1bd ChromeMain
#14 0x7f30477dbf6a __libc_start_main
#15 0x561092a3c029 <unknown>

Received signal 6
#0 0x561094287857 base::debug::StackTrace::StackTrace()
#1 0x5610942873bf base::debug::(anonymous namespace)::StackDumpSignalHandler()
#2 0x7f304dbf6da0 <unknown>
#3 0x7f30477ef8a0 __GI_raise
#4 0x7f30477f0f09 __GI_abort
#5 0x561094286402 base::debug::BreakDebugger()
#6 0x56109429e42a logging::LogMessage::~LogMessage()
#7 0x56109344b711 content::ZygoteHostImpl::Init()
#8 0x5610930dfda0 content::BrowserMainLoop::EarlyInitialization()
#9 0x5610930e62de content::BrowserMainRunnerImpl::Initialize()
#10 0x561097ecddd6 headless::HeadlessContentMainDelegate::RunProcess()
#11 0x561093fd39e7 content::RunNamedProcessTypeMain()
#12 0x561093fd4421 content::ContentMainRunnerImpl::Run()
#13 0x561093fdd19d service_manager::Main()
#14 0x561093fd2f52 content::ContentMain()
#15 0x561097ecd075 headless::(anonymous namespace)::RunContentMain()
#16 0x561097ecd0ea headless::HeadlessBrowserMain()
#17 0x561093fda1b1 headless::HeadlessShellMain()
#18 0x561092a3c1bd ChromeMain
#19 0x7f30477dbf6a __libc_start_main
#20 0x561092a3c029 <unknown>
  r8: 0000000000000000  r9: 00007ffdae1816e0 r10: 0000000000000008 r11: 0000000000000246
 r12: 00007ffdae181e00 r13: 0000000000000161 r14: 00007ffdae181df8 r15: 00007ffdae181df0
  di: 0000000000000002  si: 00007ffdae1816e0  bp: 00007ffdae1819a0  bx: 0000000000000006
  dx: 0000000000000000  ax: 0000000000000000  cx: 00007f30477ef8a0  sp: 00007ffdae1816e0
  ip: 00007f30477ef8a0 efl: 0000000000000246 cgf: 002b000000000033 erf: 0000000000000000
 trp: 0000000000000000 msk: 0000000000000000 cr2: 0000000000000000
[end of stack trace]
Calling _exit(1). Core file will not be generated.


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

(node:25800) [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.
fs.js:1081
  return binding.unlink(pathModule.toNamespacedPath(path));
                 ^

Error: ENOENT: no such file or directory, unlink '/tmp/tmp-25794sbFMJGl9po1k.tmp.png'
    at Object.fs.unlinkSync (fs.js:1081:18)
    at mv (/home/haozeke/.config/yarn/global/node_modules/mermaid-filter/index.js:102:8)
    at mermaid (/home/haozeke/.config/yarn/global/node_modules/mermaid-filter/index.js:73:9)
    at /home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:52:19
    at Array.forEach (<anonymous>)
    at walk (/home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:50:7)
    at /home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:74:16
    at Array.forEach (<anonymous>)
    at walk (/home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:73:20)
    at filter (/home/haozeke/.config/yarn/global/node_modules/pandoc-filter/index.js:36:10)
Error running filter mermaid-filter:
Filter returned error status 1

Also if it helps,

pandoc -v
pandoc 2.0.1.1
Compiled with pandoc-types 1.17.2, texmath 0.10, skylighting 0.4.3.2
Default user data directory: /home/haozeke/.pandoc
Copyright (C) 2006-2017 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

@raghur
Copy link
Owner

raghur commented Dec 4, 2017

I'm able to reproduce the issue only on Linux. Windows works fine. ATM, I'm not quite sure what's going on - but it looks like files being created by mermaid cli are somehow deleted/removed by the time the filter tries to pick them up.

@HaoZeke
Copy link
Author

HaoZeke commented Dec 4, 2017

From monitoring my /tmp folder I notice that there is no tmp/tmp-*.tmp.png file being created at all...

I notice a pupeteer* folder being created and deleted along with a file (renamed to have .txt at the end) being produced in /tmp/

tmp-289106Xc7rWFch2dy.tmp.txt

@HaoZeke HaoZeke changed the title Breaks without chrome? Breaks on Linux with Pandoc 2 Dec 4, 2017
@raghur
Copy link
Owner

raghur commented Dec 5, 2017

Looks like this issue 16 in mermaid.cli might be where the trouble is.

@diversemix
Copy link

diversemix commented Jan 1, 2018

I've commented on the issue above - but to save navigating off...

Manually fettling package.json to include v0.13.0 of puppeteer within the mermaid.cli package seems to have got the mmdc working for me.

I've just tested pandoc too .... and that works with v0.13.0 of puppeteer

@mairon-eero
Copy link

Similar, but slightly different problem here. Also using pandoc -F mermaid-filter command. The error is:

[INFO] Running filter mermaid-filter
internal/fs/utils.js:269
    throw err;
    ^

Error: ENOENT: no such file or directory, open '/tmp/tmp-57o2MEa4kbr22k.tmp.png'
    at Object.openSync (fs.js:462:3)
    at Object.readFileSync (fs.js:364:35)
    at mermaid (/home/node/.npm-global/lib/node_modules/mermaid-filter/index.js:88:27)
    at /home/node/.npm-global/lib/node_modules/mermaid-filter/index.js:145:12
    at /home/node/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:52:19
    at Array.forEach (<anonymous>)
    at walk (/home/node/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:50:7)
    at /home/node/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:74:16
    at Array.forEach (<anonymous>)
    at walk (/home/node/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:73:20) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/tmp/tmp-57o2MEa4kbr22k.tmp.png'
}
Error running filter mermaid-filter:
Filter returned error status 1

When I look at the /tmp folder, the file is there, but without the png extension.

/data/src # ls /tmp
tmp-57o2MEa4kbr22k.tmp

I'm trying to run inside a docker container with pandoc/latex:2.14.2 docker image.

@Codem3ay
Copy link

Any news on this error? I'm facing the same issue when running pandoc on docker with my .gitlab-ci.yml using as a base image pandoc/latex

.gitlab-ci.yml here:

image:
    name: pandoc/latex
    entrypoint: ["/bin/sh", "-c"]

stages:          # List of stages for jobs, and their order of execution
  - Wiki

cloning-wiki:
  stage: Wiki
  artifacts:
    untracked: false
    expire_in: 30 days
    paths:
      - output/
  script:
      - apk add --update npm
      - npm i --unsafe-perm -g mermaid-filter 
      - pandoc -F mermaid-filter README.md -o output/README.pdf --data-dir=./pandoc --from markdown --template eisvogel --listings

Error here:

$ pandoc -F mermaid-filter README.md -o output/README.pdf --data-dir=./pandoc --from markdown --template eisvogel --listings
internal/fs/utils.js:269
    throw err;
    ^
Error: ENOENT: no such file or directory, open '/tmp/tmp-329AxvFrFjUH8Z8.tmp.png'
    at Object.openSync (fs.js:462:3)
    at Object.readFileSync (fs.js:364:35)
    at mermaid (/builds/i-supplier/devlab/wiki-to-pdf/.npm-global/lib/node_modules/mermaid-filter/index.js:88:27)
    at /builds/i-supplier/devlab/wiki-to-pdf/.npm-global/lib/node_modules/mermaid-filter/index.js:145:12
    at /builds/i-supplier/devlab/wiki-to-pdf/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:52:19
    at Array.forEach (<anonymous>)
    at walk (/builds/i-supplier/devlab/wiki-to-pdf/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:50:7)
    at /builds/i-supplier/devlab/wiki-to-pdf/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:74:16
    at Array.forEach (<anonymous>)
    at walk (/builds/i-supplier/devlab/wiki-to-pdf/.npm-global/lib/node_modules/mermaid-filter/node_modules/pandoc-filter/index.js:73:20) {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/tmp/tmp-329AxvFrFjUH8Z8.tmp.png'
}
Error running filter mermaid-filter:
Filter returned error status 1

@mairon-eero
Copy link

Yeah, I've solved it by building a new docker image. The problem was with puppetter configuration.
Here is my dockerfile:

FROM pandoc/latex:2.14.2

RUN apk upgrade && apk add --no-cache \
    nodejs==12.22.6-r0 \
    npm==12.22.6-r0 \
    chromium

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
    PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

RUN npm install mermaid-filter@1.4.5 -g --unsafe-perm
# Install additional LaTeX packages
RUN tlmgr update --self && tlmgr install \
  pgf floatrow titling

WORKDIR /data/src
RUN echo '{"args": ["--no-sandbox","--disable-setuid-sandbox"],"executablePath": "/usr/bin/chromium-browser"}' > /tmp/.puppeteer.json

I build it with: docker build -t myimage/latest .
Then I'm able to run it with: docker run --volume "$(pwd)/src:/data/src" --entrypoint ./publish_with_docker.sh myimage/latest

My publish_with_docker.sh script is inside $(pwd)/src on host and contains the following:

#!/bin/sh
cp /tmp/.puppeteer.json /data/src && ./publish.sh

I'm copying the file .puppeteer.json to the WORKDIR because mermaid-filter requires it to be in working directory, as we can see here.

./publish.sh is the script actually calling pandoc.

@evpill
Copy link

evpill commented Jul 3, 2022

I'm trying to run the following command in a docker container:

pandoc -f gfm -s Work-log.md -t html --pdf-engine=wkhtmltopdf --filter pandoc-mermaid --variable "geometry=margin=0.5in" -o Work-log.pdf

It's erring out due to no sandbox. I've tried creating the .puppeteer.json file with the contents of {"args": ["--no-sandbox"]} but it doesn't seem to be passing it in.

 Traceback (most recent call last):
   File "/usr/local/bin/pandoc-mermaid", line 8, in <module>
      sys.exit(main())
   File "/usr/local/lib/python3.9/dist-packages/pandoc_mermaid_filter.py", line 38, in main
     toJSONFilter(mermaid)
   File "/usr/local/lib/python3.9/dist-packages/pandocfilters.py", line 148, in toJSONFilter
     toJSONFilters([action])
   File "/usr/local/lib/python3.9/dist-packages/pandocfilters.py", line 182, in toJSONFilters
     sys.stdout.write(applyJSONFilters(actions, source, format))
   File "/usr/local/lib/python3.9/dist-packages/pandocfilters.py", line 213, in applyJSONFilters
     altered = walk(altered, action, format, meta)
   File "/usr/local/lib/python3.9/dist-packages/pandocfilters.py", line 141, in walk
     return {k: walk(v, action, format, meta) for k, v in x.items()}
   File "/usr/local/lib/python3.9/dist-packages/pandocfilters.py", line 141, in <dictcomp>
     return {k: walk(v, action, format, meta) for k, v in x.items()}
   File "/usr/local/lib/python3.9/dist-packages/pandocfilters.py", line 128, in walk
     res = action(item['t'],
   File "/usr/local/lib/python3.9/dist-packages/pandoc_mermaid_filter.py", line 31, in mermaid
     subprocess.check_call([MERMAID_BIN, "-i", src, "-o", dest])
   File "/usr/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
 subprocess.CalledProcessError: Command '['/usr/local/bin/mmdc', '-i', 'mermaid-images/998e1e2e523df8f6c2550c5c0f9a2c08910ab662.mmd', '-o', 'mermaid-images/998e1e2e523df8f6c2550c5c0f9a2c08910ab662.svg']'

Noticing the "subprocess" command at the bottom I went into the an instance of the Docker container I manually ran it /usr/local/bin/mmdc -i mermaid-images/998e1e2e523df8f6c2550c5c0f9a2c08910ab662.mmd -o mermaid-images/998e1e2e523df8f6c2550c5c0f9a2c08910ab662.svg and it gave me the following:

Error: Failed to launch the browser process!
[0703/000132.577638:FATAL:zygote_host_impl_linux.cc(117)] No usable sandbox! Update your kernel or see https://chromium.googlesource.com/chromium/src/+/main/docs/linux/suid_sandbox_development.md for more information on developing with the SUID sandbox. If you want to live dangerously and need an immediate workaround, you can try using --no-sandbox.
...
...
...

Running it manually again as /usr/local/bin/mmdc -p .puppeteer.json -i mermaid-images/998e1e2e523df8f6c2550c5c0f9a2c08910ab662.mmd -o mermaid-images/998e1e2e523df8f6c2550c5c0f9a2c08910ab662.svg passing in the .puppeteer.json file however works (notice that .puppeteer.json already exsisted in the working directory)...

Is there a way we can force pandoc or pandoc-mermaid-filter to pass in the -p flag to mmdc instead of relying on "auto[fail]" to find it?

P.S.

$ pandoc -v
pandoc 2.9.2.1
Compiled with pandoc-types 1.20, texmath 0.12.0.2, skylighting 0.8.5
Default user data directory: /home/zimmy/.local/share/pandoc or /home/zimmy/.pandoc
Copyright (C) 2006-2020 John MacFarlane
Web:  https://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

$ node -v
v12.22.12

$ npm list -g puppeteer
/usr/local/lib
`-- @mermaid-js/mermaid-cli@9.1.3
  `-- puppeteer@14.4.1

chrisfenner added a commit to TrustedComputingGroup/markdown that referenced this issue Aug 12, 2022
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

6 participants