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

Pre upgrade to 8.2.3 I was able to start kibana with 'systemctl start kibana' but it just fails over and over again after the upgrade.

I found I am able to run Kibana using

/usr/share/kibana/bin/kibana --allow-root

It looks like I upgraded as root so I'm not sure why this would be a problem:

root@xxxx1:/usr/share/kibana/bin# ls -al
total 32
drwxr-xr-x 2 root root 4096 Jun 16 14:55 .
drwxr-xr-x 8 root root 4096 Jun 16 14:55 ..
-rwxr-xr-x 1 root root  835 Jun  8 10:42 kibana

& Here his the .yml file.

root@xxxx:/etc/kibana# ls -al
total 36
drwxr-s---   2 root kibana  4096 Jun 16 14:57 .
drwxr-xr-x 118 root root   12288 Jun 16 14:55 ..
-rw-rw----   1 root kibana   130 Jun 16 14:55 kibana.keystore
-rw-r--r--   1 root kibana    62 Jun 16 14:55 .kibana.keystore.initial_md5sum
-rw-rw----   1 root kibana  7700 Jun 16 14:57 kibana.yml
-rw-r--r--   1 root kibana   305 Jun  8 10:42 node.options

How do I fix this so I can use systemd to start up kibana normally?

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"