RoR 1.35.1 Kibana 7.15.1 patch gives error

RoR: 1.35.1 Enterprise
Kibana: 7.15.1

Hi, when trying to patch the plugin after the installation of the plugin, we get the following error:

[ROR COMPAT] ReadonlyREST encountered problems with compatibility manager script, please run manually using 'ror-tools.js'   Error: Failed to apply patch 'http_server.js.patch' to '/usr/share/kibana/plugins/readonlyrestkbn/kibana/patchers/../../../../src/core/server/http/http_server.js'
at l.e (/usr/share/kibana/plugins/readonlyrestkbn/kibana/patchers/filePatcher.js:1:3031)
at /usr/share/kibana/plugins/readonlyrestkbn/kibana/patchers/kibanaPatcher.js:1:2824
at doWithPatcher (/usr/share/kibana/plugins/readonlyrestkbn/kibana/patchers/kibanaPatcher.js:1:3711)
at patchAll (/usr/share/kibana/plugins/readonlyrestkbn/kibana/patchers/kibanaPatcher.js:1:2659)
at Object.main (/usr/share/kibana/plugins/readonlyrestkbn/kibana/patchers/kibanaPatcher.js:1:2223)
at Object.<anonymous> (/usr/share/kibana/plugins/readonlyrestkbn/ror-tools.js:16:10)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
at Module.load (internal/modules/cjs/loader.js:937:32)
at Function.Module._load (internal/modules/cjs/loader.js:778:12)

We tried with 1.36.0 as well, but that gave the same error. We only don’t see it after a fresh install so it looks like it’s maybe related to the unpatching.

Regards & thanks,
Arjen

I have just tested the enterprise plugin 1.36.0 for kibana7.15.1 and works for me. Can you show the content of kibana/plugins/readonlyrestkbn/kibana/patchers/patches_for_kbn_distribution/http_server.js.patch in your installation? Let’s see if and how it’s different.

If all is normal, I’d have a look at what’s wrong with kibana/src/core/server/http/http_server.js in your Kibana and how it differs from the vanilla Kibana zip file distribution.

More insight can be found in why the patch and the file don’t work together using the patch command from the main kibana directory:

patch -p0 --dry-run /usr/share/kibana/plugins/readonlyrestkbn/kibana/patchers/../../../../src/core/server/http/http_server.js  < /usr/share/kibana/plugins/readonlyrestkbn/kibana/patchers/patches_for_kbn_distribution/http_server.js.patch --verbose

Also, verify you launched the unpatch command to make sure all previous patches are unapplied:

node/bin/node plugins/readonlyrestkbn/ror-tools.js unpatch
1 Like

Hi @sscarduzio ,

Let’s have a small session so I can show you what happens if you would be able to do that today maybe?

Thanks & regards,
Arjen

Yeah sure! Will contact you via DM

1 Like

OK mystery solved! The patching mechanism was OK, but:
If you install Kibana using a package manager like apt/yum, when you want to upgrade Kibana version, you will “<yum|apt> remove” the old Kibana version and “<yum|apt> install” the new one.

When you remove a packge, only the files that were created by the package manager will be deleted. This leaves out the “*.orig” files created by ror-tool.js patch.

When the package manager installs the new version of Kibana, and you ror-tools.js patch, it will restore the old “*.orig” file, then attempt to patch it again.

As a result the patching fail and the kibana file is restored to an older version.

Fix:

  1. Always remember to ror-tools.js unpatch before you uninstall ROR, especially when you upgrade Kibana versions.

  2. ror-tools now uses *.<ror_version_string>.orig when backing up Kibana files before patching them.

i.e.

src/core/server/http/http_server.js.7.15.1_1.37.0.orig
src/cli/serve/serve.js.7.15.1_1.37.0.orig

instead of:

src/core/server/http/http_server.js.orig
src/cli/serve/serve.js.orig

Thank you @abuising for having the patience to troubleshoot with me in Zoom!

1 Like