Bug 231179 - textproc/kibana6: version 6.3.2 fails to start from missing phantomjs-2.1.1-macosx.zip file
Summary: textproc/kibana6: version 6.3.2 fails to start from missing phantomjs-2.1.1-m...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Mark Felder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-09-05 16:32 UTC by Patrice
Modified: 2018-12-21 21:58 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (elastic)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrice 2018-09-05 16:32:40 UTC
Dear maintainer,

After upgrading kibana5 to kibana6-6.3.2 and updating the kibana.yml configuration, the service still refuses to start.

From kibana.log:

# tail -f /var/log/kibana.log
{"type":"log","@timestamp":"2018-09-05T16:24:12Z","tags":["reporting","error"],"pid":27630,"message":"Failed to install browser. See kibana logs for more details."}


We have more details when we start manually the service with the following command:

# /usr/local/bin/node --no-warnings /usr/local/www/kibana6/src/cli serve --config /usr/local/etc/kibana/kibana.yml --log-file /var/log/kibana.log

FATAL CLI ERROR YAMLException: the stream contains non-printable characters at line 1, column 1:
    P^
    ^
    at generateError (/usr/local/www/kibana6/node_modules/js-yaml/lib/js-yaml/loader.js:160:10)
    at throwError (/usr/local/www/kibana6/node_modules/js-yaml/lib/js-yaml/loader.js:166:9)
    at loadDocuments (/usr/local/www/kibana6/node_modules/js-yaml/lib/js-yaml/loader.js:1526:5)
    at load (/usr/local/www/kibana6/node_modules/js-yaml/lib/js-yaml/loader.js:1555:19)
    at safeLoad (/usr/local/www/kibana6/node_modules/js-yaml/lib/js-yaml/loader.js:1573:10)
    at files.map.path (/usr/local/www/kibana6/src/cli/serve/read_yaml_config.js:52:56)
    at Array.map (<anonymous>)
    at readYamlConfig (/usr/local/www/kibana6/src/cli/serve/read_yaml_config.js:52:23)
    at readServerSettings (/usr/local/www/kibana6/src/cli/serve/serve.js:150:57)
    at getCurrentSettings (/usr/local/www/kibana6/src/cli/serve/serve.js:32:38)
root@kibana:/usr/local/packages/All # /etc/kibana/kibana.yml --log-file /var/log/kibana.log
root@kibana:/usr/local/packages/All # /usr/local/bin/node --no-warnings /usr/local/www/kibana6/src/cli serve --config /usr/local/etc/kibana/kibana.yml --log-file /var/log/kibana.log

FATAL { ExtractError: Failed to extract the phantom.js archive
    at err (/usr/local/www/kibana6/node_modules/x-pack/plugins/reporting/server/browsers/extract/unzip.js:14:23)
    at /usr/local/www/kibana6/node_modules/extract-zip/index.js:20:23
    at /usr/local/www/kibana6/node_modules/extract-zip/node_modules/yauzl/index.js:29:21
    at FSReqWrap.oncomplete (fs.js:145:20)
  name: 'ExtractError',
  cause:
   { Error: ENOENT: no such file or directory, open '/usr/local/www/kibana6/node_modules/x-pack/plugins/reporting/.phantom/phantomjs-2.1.1-macosx.zip'
     errno: -2,
     code: 'ENOENT',
     syscall: 'open',
     path:
      '/usr/local/www/kibana6/node_modules/x-pack/plugins/reporting/.phantom/phantomjs-2.1.1-macosx.zip' } }


The problem appears to come from the attemped extraction of the file:

/usr/local/www/kibana6/node_modules/x-pack/plugins/reporting/.phantom/phantomjs-2.1.1-macosx.zip

This file doesn't exists:

# ls -l /usr/local/www/kibana6/node_modules/x-pack/plugins/reporting/.phantom/phantomjs-2.1.1-macosx.zip
ls: /usr/local/www/kibana6/node_modules/x-pack/plugins/reporting/.phantom/phantomjs-2.1.1-macosx.zip: No such file or directory

Thanks for some insights on how to fix the issue.

Regards,
Comment 1 Patrice 2018-09-05 20:04:41 UTC
We found the workaround: downloading  phantomjs-2.1.1-macosx.zip from http://phantomjs.org/download.html, then move it to /usr/local/www/kibana6/node_modules/x-pack/plugins/reporting/.phantom/

But that's just a workaround, the file should ship with the kibana6 port.

Best regards,
Comment 2 Mark Felder freebsd_committer 2018-09-07 16:03:18 UTC
Mine starts fine without this, but I suppose I'm not using the reporting module.

I do not believe the MacOS phantomjs download is appropriate. It ships a phantomjs binary that cannot work on FreeBSD. The correct solution might be to make kibana6 depend on the FreeBSD phantomjs package, but it's unclear if Kibana will accept a system-installed phantomjs or not.
Comment 3 Mark Felder freebsd_committer 2018-09-07 16:21:59 UTC
Do you need the reporting module? Are you generating reports with it?

Kibana is shipping both a copy of PhantomJS and Chromium for this module which is outrageous. It also cannot possibly work on FreeBSD as they don't even attempt to use a copy that works on FreeBSD. Someone at ElasticSearch is convinced that MacOS is just a BSD so all BSDs can run MacOS code... *sigh*

I'm considering removing this module from the package. It did not exist before as X-Pack was not part of the install. I cannot imagine anyone is actually using this successfully on FreeBSD.
Comment 4 Patrice 2018-09-10 11:54:05 UTC
Hello,

we are not using the X-Pack reporting module (yet). It seems it is activated by default. Maybe turning it off by default in port version could to the trick?

We added the following setting to disable it in kibana.yml:

xpack.reporting.enabled: false

Regards,
Comment 5 Nicola Mingotti 2018-10-17 00:49:58 UTC
Hi guys,

today I had really a bad time about the same issue, Kibana not running in FreeBSD-11.2, but it was running in FreeBSD-11.1.

Instead of downloading the Mac file I changed the file:
/usr/local/www/kibana6/node_modules/x-pack/plugins/reporting/server/browsers/phantom/path.js

-------------------- modified version ----------------
......
  packages: [{
    // platforms: ['darwin', 'freebsd', 'openbsd'],
     platforms: ['darwin', 'openbsd'],
    archiveFilename: 'phantomjs-2.1.1-macosx.zip',
    archiveChecksum: 'b0c038bd139b9ecaad8fd321070c1651',
    binaryRelativePath: 'phantomjs-2.1.1-macosx/bin/phantomjs',
  }, {
    // platforms: ['linux'],
    platforms: ['linux', 'freebsd'],
    archiveFilename: 'phantomjs-2.1.1-linux-x86_64.tar.bz2',

......
--------------------------------------------------------

with this it runs. 

maybe we can just suggest to modify this file when Kibana package
gets installed. Or do it automatically. 

bye
Nicola
Comment 6 Mark Felder freebsd_committer 2018-10-17 21:37:43 UTC
The reporting plugin does not work on FreeBSD at all, so you can just disable it in your Kibana config. I have been meaning to update the port to exclude this plugin from the package so the error can not be hit. It fell off my radar, but I'll get this taken care of.
Comment 7 Mark Felder freebsd_committer 2018-11-05 23:31:34 UTC
My latest update to the Kibana port added an ENV to the rc script which disables the reporting module as it would refuse to start if I simply deleted the module files. This should solve the problem.
Comment 8 matt 2018-12-21 21:58:13 UTC
For anyone that really really wants the reporting module to work, I've found a pretty simple workaround.

It takes advantage of the bug in Kibana whereby it thinks that FreeBSD can run Darwin (MacOS) binaries. Here's a PR I filed against that bug: https://github.com/elastic/kibana/pull/27255

A hack to get reporting working is to install phantomjs and point Kibana against that port installed version.

pkg install -y phantomjs
cd /usr/local/www/kibana6/node_modules/x-pack/plugins/reporting/.phantom
fetch https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-macosx.zip
mkdir -p phantomjs-2.1.1-macosx/bin
ln -s /usr/local/bin/phantomjs phantomjs-2.1.1-macosx/bin/phantomjs

# enable reporting module in kibana.yml
xpack.reporting.enabled: true

# restart Kibana
service kibana restart