Kibana Broken unless run using “/usr/share/kibana/bin/kibana --allow-root” command

Resolved this myself using the following commands -

1991  apt-get remove --purge kibana

1993  rm -r /var/lib/kibana
1994  rm -r /etc/kibana
 
1995  useradd kibana
1996  groupadd kibana
1997  usermod -a -G kibana kibana

 systemctl daemon-reload
 systemctl start kibana 
 systemctl status kibana  
 journalctl -fu kibana.service

Also had this error:

Generating a random key for xpack.reporting.encryptionKey. To prevent sessions from being invalidated on restart, please set xpack.reporting.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command.

Resolved by:

/usr/share/kibana/bin/kibana-encryption-keys generate

Paste output keys into kibana.yml at the bottom

And lastly this error:

Unable to retrieve version information from Elasticsearch nodes. security_exception: [security_exception] Reason: missing authentication credentials for REST request [/_nodes?filter_path=nodes.*.version%2Cnodes.*.http.publish_address%2Cnodes.*.ip]

Requires you to set up your basic authentication credentials in kibana.yml or have pre-upgrade generated a token via this command (using the dev tools in kibana):

POST /_security/service/elastic/kibana/credential/token
elasticsearch.serviceAccountToken: "paste generated token here"