Kibana 6.1.0. and newer starts with error

Hi, I came to this topic from Kibana 6.1.1 Fatal Error at start and I think there are a few different issues going on. The few that I can think of are:

  1. Installing or removing a plugin while Kibana is running. Kibana must be stopped when a plugin is installed. Kibana discovers all the plugins at startup time, so plugins have to be installed or removed while Kibana is not running.
  2. X-Pack or some other plugin not being fully installed. If plugin installation gets aborted before it's finished then it may show as installed even though it is in a broken state. You can remove and try installing the plugin again. Make sure Kibana is restarted after the plugin is reinstalled. Sometimes removing the optimize directory and restarting Kibana could act as a shortcut.
  3. Running a bin/kibana-plugin install plugin-name command from a different working directory. The plugin installer has to be run from the Kibana installation path.

@Kim-Kruse-Hansen if this is what you need to do to run Kibana with X-Pack, it indicates to me that the Kibana Service you're launching is somehow starting Kibana without it running the optimizer first. (Sorry, but I'm not sure how that would happen.) So running bin/kibana manually up front does the optimization, and then Kibana can be restarted by the service successfully, because optimization was done. If you add any other plugins or change certain config settings (such as disabling a feature or changing the server.basePath setting) then you'd need to run bin/kibana manually again to force it do to the optimization again.