Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elasticsearch package uninstall does not delete plugin bin directories #18109

Closed
spinscale opened this issue May 3, 2016 · 2 comments · Fixed by #41907
Closed

Elasticsearch package uninstall does not delete plugin bin directories #18109

spinscale opened this issue May 3, 2016 · 2 comments · Fixed by #41907
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts help wanted adoptme Team:Delivery Meta label for Delivery team

Comments

@spinscale
Copy link
Contributor

Elasticsearch version: 5.0.0-alpha2 deb/rpm

Steps to reproduce:

  1. Install elasticsearch package on any distro
  2. Install a plugin with a bin/ directory, ie x-pack
  3. Run rpm -e elasticsearch or dpkg -P elasticsearch
  4. Install the package again
  5. Install x-pack again and watch an exception because the bin/ directory is still there
/usr/share/elasticsearch/bin/elasticsearch-plugin install x-pack
-> Downloading x-pack from elastic
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@     WARNING: plugin requires additional permissions     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
* java.lang.RuntimePermission getClassLoader
* java.lang.RuntimePermission setContextClassLoader
* java.lang.RuntimePermission setFactory
* java.util.PropertyPermission * read,write
* javax.net.ssl.SSLPermission setHostnameVerifier
See http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.html
for descriptions of what these permissions allow and the associated risks.

Continue with installation? [y/N]y
Exception in thread "main" java.nio.file.FileAlreadyExistsException: /usr/share/elasticsearch/bin/x-pack
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:88)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)
    at java.nio.file.Files.createDirectory(Files.java:674)
    at org.elasticsearch.plugins.InstallPluginCommand.installBin(InstallPluginCommand.java:456)
    at org.elasticsearch.plugins.InstallPluginCommand.install(InstallPluginCommand.java:419)
    at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:202)
    at org.elasticsearch.plugins.InstallPluginCommand.execute(InstallPluginCommand.java:188)
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:91)
    at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:69)
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:91)
    at org.elasticsearch.cli.Command.main(Command.java:53)
    at org.elasticsearch.plugins.PluginCli.main(PluginCli.java:57)

The postrm scripts currently deletes the plugins directory on purge, but leaves the bin directory as is, thus cleans everything only half up.

@spinscale spinscale added >bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts labels May 3, 2016
@clintongormley clintongormley added the help wanted adoptme label May 3, 2016
@nikoncode
Copy link
Contributor

nikoncode commented May 12, 2016

If plugins with binaries always create dir in elasticsearch bin (like x-pack), we need to delete all folders from elastic bin (rm -rf */).

@jordansissel
Copy link
Contributor

Solving this will require a packaging script that runs after (or just before) the package is removed. I'll put some rough notes here about what I recall about these package formats --

This is made annoying because both Debian and Red Hat have different mechanisms for this. In RPM, you'll want a "postun" (for after removing a package) or a "preun" (before removing a package). In Debian, you'll want a "postrm" or "prerm" script. Further, I think each have different special ways of handling upgrades (which, in a way, is a package removal). Finally, Debian has two concepts for package removal -- "remove" and "purge". Fun!

Hope this helps. :)

rjernst added a commit to rjernst/elasticsearch that referenced this issue May 7, 2019
This commit adds deletion of the bin directory to postrm cleanup. While
the package's bin files are cleaned up by the package manager, plugins
may have created subdirectories under bin. We already cleanup plugins,
but not the extra bin dirs their installation created.

closes elastic#18109
rjernst added a commit that referenced this issue May 10, 2019
This commit adds deletion of the bin directory to postrm cleanup. While
the package's bin files are cleaned up by the package manager, plugins
may have created subdirectories under bin. We already cleanup plugins,
but not the extra bin dirs their installation created.

closes #18109
rjernst added a commit that referenced this issue May 10, 2019
This commit adds deletion of the bin directory to postrm cleanup. While
the package's bin files are cleaned up by the package manager, plugins
may have created subdirectories under bin. We already cleanup plugins,
but not the extra bin dirs their installation created.

closes #18109
gurkankaymak pushed a commit to gurkankaymak/elasticsearch that referenced this issue May 27, 2019
This commit adds deletion of the bin directory to postrm cleanup. While
the package's bin files are cleaned up by the package manager, plugins
may have created subdirectories under bin. We already cleanup plugins,
but not the extra bin dirs their installation created.

closes elastic#18109
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Delivery/Packaging RPM and deb packaging, tar and zip archives, shell and batch scripts help wanted adoptme Team:Delivery Meta label for Delivery team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants