When use gitbook to generate ebook, Calibre reports this:
RuntimeError: X server required. If you are running on a headless machine, use xvfb
After xvfb is installed, it does not work either.
How to make gitbook/Calibre work on a headless server?
You need to wrap the command
xvfb-run. However, in gitbook (
ebook-convert is called directly.
You may change gitbook to call
xvfb-run ebook-convert. However, when you upgrade gitbook, you lost the change.
My solution is to add this wrapper so that calling
ebook-convert is actually invoking this wrapper:
/usr/local/bin/ is before
/usr/bin/ in my $PATH):
#!/bin/bash echo "Run xvfb-run /usr/bin/ebook-convert $@" xvfb-run /usr/bin/ebook-convert "$@"