elastic / elastic/logstash

Logstash YUM uninstaller fails when using LDAP 'logstash' account

Open
#8,460 2 comments 0 reactions 0 assignees View on GitHub
packaging
Dominant language
Java
Stars
14.9k
Forks
3.5k
Avg merge
19h 14m
Merged PRs (30d)
63

Description

Hi,

I accidentally installed Logstash 6.0.0~rc1-1 (YUM pre-release repo was left enabled by mistake after we were testing newer versions of Beats). When I went to remove logstash, I found that I couldn't as the uninstall script failed trying to remove the 'logstash' user and group because we have them in LDAP and not local to the server.

```
Running transaction
userdel: cannot remove entry 'logstash' from /etc/passwd
groupdel: cannot remove the primary group of user 'logstash'
error: %preun(logstash-1:6.0.0~rc1-1.noarch) scriptlet failed, exit status 8
Error in PREUN scriptlet in rpm package 1:logstash-6.0.0~rc1-1.noarch
```

Would it be feasible to update the preuninstall scriptlet to have something like:
```
if getent passwd logstash >/dev/null && grep '^logstash:' /etc/passwd > /dev/null ; then
userdel logstash
fi

if getent group logstash > /dev/null && grep '^logstash:' /etc/group > /dev/null ; then
groupdel logstash
fi
```
So that the uninstaller only attempts to remove the logstash user and group if they are local to the host that we're removing the package from?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.