# Uninstalling x-pack plugin from Kibana Docker image (5.6.1) broken: Unable to remove plugin because of error: "ENOTEMPTY: directory not empty, rmdir '/usr/share/kibana/plugins/x-pack/.phantom'"

**URL:** <https://discuss.elastic.co/t/uninstalling-x-pack-plugin-from-kibana-docker-image-5-6-1-broken-unable-to-remove-plugin-because-of-error-enotempty-directory-not-empty-rmdir-usr-share-kibana-plugins-x-pack-phantom/101744>\
**Category:** Kibana\
**Created:** [September 25, 2017, 7:03pm UTC](https://discuss.elastic.co/t/uninstalling-x-pack-plugin-from-kibana-docker-image-5-6-1-broken-unable-to-remove-plugin-because-of-error-enotempty-directory-not-empty-rmdir-usr-share-kibana-plugins-x-pack-phantom/101744 "2017-09-25T19:03:27Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![kspear](https://avatars.discourse-cdn.com/v4/letter/k/9f8e36/32.png) [@kspear](https://discuss.elastic.co/u/kspear)\
**Post date:** [September 25, 2017, 7:03pm UTC](https://discuss.elastic.co/t/uninstalling-x-pack-plugin-from-kibana-docker-image-5-6-1-broken-unable-to-remove-plugin-because-of-error-enotempty-directory-not-empty-rmdir-usr-share-kibana-plugins-x-pack-phantom/101744/1 "2017-09-25T19:03:27Z")

</div>

Relates to this [GitHub issue](https://github.com/elastic/kibana/issues/10474) (now closed).

Opening a thread here at the suggestion of [kobelb](https://github.com/elastic/kibana/issues/10474#issuecomment-281653080), who closed the original GitHub issue. I can confirm, though, that the problem is present as of the latest available Kibana Docker image.

Copying [my comment from that thread](https://github.com/elastic/kibana/issues/10474#issuecomment-331978044) here:

* * *

Running into this same issue with [docker.elastic.co/kibana/kibana:5.6.1](http://docker.elastic.co/kibana/kibana:5.6.1).

```auto
[user@server]$ docker run --user root -ti --rm docker.elastic.co/kibana/kibana:5.6.1 bash
[root@70ac29ce9a7e kibana]# bin/kibana-plugin remove x-pack
Removing x-pack...
Unable to remove plugin because of error: "ENOTEMPTY: directory not empty, rmdir '/usr/share/kibana/plugins/x-pack/.phantom'" 
[root@70ac29ce9a7e kibana]# rm -rf /usr/share/kibana/plugins/x-pack/.phantom    
rm: cannot remove '/usr/share/kibana/plugins/x-pack/.phantom': Directory not empty
[root@70ac29ce9a7e kibana]# ls /usr/share/kibana/plugins/x-pack/.phantom -l
ls: cannot access /usr/share/kibana/plugins/x-pack/.phantom/phantomjs-2.1.1-linux-i686.tar.bz2: No such file or directory
ls: cannot access /usr/share/kibana/plugins/x-pack/.phantom/phantomjs-2.1.1-linux-x86_64.tar.bz2: No such file or directory
ls: cannot access /usr/share/kibana/plugins/x-pack/.phantom/phantomjs-2.1.1-macosx.zip: No such file or directory
ls: cannot access /usr/share/kibana/plugins/x-pack/.phantom/phantomjs-2.1.1-windows.zip: No such file or directory
total 0
?????????? ? ? ? ? ? phantomjs-2.1.1-linux-i686.tar.bz2
?????????? ? ? ? ? ? phantomjs-2.1.1-linux-x86_64.tar.bz2
?????????? ? ? ? ? ? phantomjs-2.1.1-macosx.zip
?????????? ? ? ? ? ? phantomjs-2.1.1-windows.zip
[root@70ac29ce9a7e kibana]# rm -f /usr/share/kibana/plugins/x-pack/.phantom/*
[root@70ac29ce9a7e kibana]# ls /usr/share/kibana/plugins/x-pack/.phantom -l
ls: cannot access /usr/share/kibana/plugins/x-pack/.phantom/phantomjs-2.1.1-linux-i686.tar.bz2: No such file or directory
ls: cannot access /usr/share/kibana/plugins/x-pack/.phantom/phantomjs-2.1.1-linux-x86_64.tar.bz2: No such file or directory
ls: cannot access /usr/share/kibana/plugins/x-pack/.phantom/phantomjs-2.1.1-macosx.zip: No such file or directory
ls: cannot access /usr/share/kibana/plugins/x-pack/.phantom/phantomjs-2.1.1-windows.zip: No such file or directory
total 0
?????????? ? ? ? ? ? phantomjs-2.1.1-linux-i686.tar.bz2
?????????? ? ? ? ? ? phantomjs-2.1.1-linux-x86_64.tar.bz2
?????????? ? ? ? ? ? phantomjs-2.1.1-macosx.zip
?????????? ? ? ? ? ? phantomjs-2.1.1-windows.zip

```

No amount of trying will let me remove these files, so the uninstall command for x-pack (`bin/kibana-plugin remove x-pack`) appears to be straight up broken in the latest official Kibana docker image.

---

_[View the full topic](https://discuss.elastic.co/t/uninstalling-x-pack-plugin-from-kibana-docker-image-5-6-1-broken-unable-to-remove-plugin-because-of-error-enotempty-directory-not-empty-rmdir-usr-share-kibana-plugins-x-pack-phantom/101744)._
