Kibana: Kibana update via yum removes user

Created on 4 Aug 2016  路  4Comments  路  Source: elastic/kibana

Kibana version:
4.5.1-1

Elasticsearch version:
2.3.3

Server OS version:
CentOS 7

Browser version:
N/A

Browser OS version:
N/A

Original install method (e.g. download page, yum, from source, etc.):
yum

Description of the problem including expected versus actual behavior:
Action: yum update kibana
Expected behavior: kibana updated from version 4.5.1-1 to 4.5.4-1 and service started
Actual behavior: kibana updated from version 4.5.1-1 to 4.5.4-1, service not started and when trying to start throws error that kibana:kibana is invalid. The user did exist and this was a simple upgrade. I had to recreate user and group and make sure the permissions where set correctly on the files needed.

Steps to reproduce:

  1. yum update kibana (taking into account versions specified)
  2. service kibana start
  3. fix user and group, reset permissions, start service

Errors in browser console (if relevant):
N/A

Provide logs and/or server output (if relevant):
N/A

Most helpful comment

Here the same problem, probably in the rpms specs to create the rpms don't use the correct state syntax

https://fedoraproject.org/wiki/Packaging:Scriptlets

The basic syntax is similar to the %build, %install, and other sections of the rpm spec file. The scripts support a special flag, -p which allows the scriptlet to invoke a single program directly rather than having to spawn a shell to invoke the programs. (ie: %post -p /sbin/ldconfig)

The scriptlets also take an argument, passed into them by the controlling rpmbuild process. This argument, accessed via $1 is the number of packages of this name which will be left on the system when the action completes, except for %pretrans and %posttrans which are always run with $1 as 0 (%pretrans and %posttrans are available in rpm 4.4 and later). So for the common case of install, upgrade, and uninstall we have:

install         upgrade uninstall
 %pretrans  $1 == 0 $1 == 0 (N/A)
 %pre           $1 == 1 $1 == 2 (N/A)
 %post          $1 == 1 $1 == 2 (N/A)
 %preun (N/A)$1 == 1    $1 == 0
 %postun(N/A)$1 == 1    $1 == 0
 %posttrans $1 == 0 $1 == 0 (N/A)

To fix that the following commands work to me.

[root@elk kibana]# adduser kibana
[root@elk kibana]# chown -R kibana:kibana /opt/kibana/optimize
[root@elk kibana]# service kibana start
kibana started

All 4 comments

Here the same problem, probably in the rpms specs to create the rpms don't use the correct state syntax

https://fedoraproject.org/wiki/Packaging:Scriptlets

The basic syntax is similar to the %build, %install, and other sections of the rpm spec file. The scripts support a special flag, -p which allows the scriptlet to invoke a single program directly rather than having to spawn a shell to invoke the programs. (ie: %post -p /sbin/ldconfig)

The scriptlets also take an argument, passed into them by the controlling rpmbuild process. This argument, accessed via $1 is the number of packages of this name which will be left on the system when the action completes, except for %pretrans and %posttrans which are always run with $1 as 0 (%pretrans and %posttrans are available in rpm 4.4 and later). So for the common case of install, upgrade, and uninstall we have:

install         upgrade uninstall
 %pretrans  $1 == 0 $1 == 0 (N/A)
 %pre           $1 == 1 $1 == 2 (N/A)
 %post          $1 == 1 $1 == 2 (N/A)
 %preun (N/A)$1 == 1    $1 == 0
 %postun(N/A)$1 == 1    $1 == 0
 %posttrans $1 == 0 $1 == 0 (N/A)

To fix that the following commands work to me.

[root@elk kibana]# adduser kibana
[root@elk kibana]# chown -R kibana:kibana /opt/kibana/optimize
[root@elk kibana]# service kibana start
kibana started

Same problem with RHEL. Similar steps to those mentioned by @jlruizmlg resolved.

It seems there is no check on $1 in %postun, it should read
%postun
if [ $1 = 0 ]
userdel kibana
fi
also kibana is stopped but not restarted after upgrade, again check $1
if [ $1 -ge 1 ]; then
/sbin/service kibana restart >/dev/null 2>&1 || :
fi

Closing in favor of https://github.com/elastic/kibana/issues/6729, this should be fixed going forward. The fixes are in the 4.5.4 release but we need scripts from previous releases to cycle through and then things will start working better.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

celesteking picture celesteking  路  3Comments

tbragin picture tbragin  路  3Comments

snide picture snide  路  3Comments

bhavyarm picture bhavyarm  路  3Comments

stacey-gammon picture stacey-gammon  路  3Comments