I logged into rhel 7 box (a docker container) and runs as root. I tried to remove a directory and I keep getting Invalid argument error. Here is my command
[root@sandbox ~]# rm -rf /var/lib/ambari-server/data/tmp/solr-service/custom-services/SOLR/5.5.2.2.5
rm: cannot remove `/var/lib/ambari-server/data/tmp/solr-service/custom-services/SOLR/5.5.2.2.5': Invalid argument
Here is the permission of that folder
[root@sandbox ~]# ls -lrth /var/lib/ambari-server/data/tmp/solr-service/custom-services/SOLR/
total 4.0K
drwxr-xr-x 1 root root 4.0K Nov 7 07:50 5.5.2.2.5
The folder is actually empty:
[root@sandbox ~]# ls -lrth /var/lib/ambari-server/data/tmp/solr-service/custom-services/SOLR/5.5.2.2.5/
total 0
Trying to put the path in quote is not working either:
[root@sandbox ~]# rmdir "/var/lib/ambari-server/data/tmp/solr-service/custom-services/SOLR/5.5.2.2.5"
rmdir: failed to remove `/var/lib/ambari-server/data/tmp/solr-service/custom-services/SOLR/5.5.2.2.5': Invalid argument
Delete by using inode is not working either:
[root@sandbox ~]# ls -il /var/lib/ambari-server/data/tmp/solr-service/custom-services/SOLR/
total 4
98616 drwxr-xr-x 1 root root 4096 Nov 7 07:50 5.5.2.2.5
root@sandbox ~]# find . -inum 98616 -exec rm -i {} \; # doesn't throws error but the folder is still there
[root@sandbox ~]# ls /var/lib/ambari-server/data/tmp/solr-service/custom-services/SOLR/
5.5.2.2.5
Delete by using find is not working either:
[root@sandbox ~]# find /var/lib/ambari-server/data/tmp/solr-service/custom-services/SOLR/ -type d -exec rm -Rf {} \;
rm: cannot remove `/var/lib/ambari-server/data/tmp/solr-service/custom-services/SOLR/5.5.2.2.5': Invalid argument
rm: cannot remove `/var/lib/ambari-server/data/tmp/solr-service/custom-services/SOLR/5.5.2.2.5': Invalid argument
How to remove that folder?
If the folder is empty have you tried the rmdir
command instead with the full path in simple quotes? ''
If this not work neither could you find the inode of the folder and then remove it via its inode?
ls -il <path> #get the inumber, let's say it's 782353
Then, find . -inum <782353> -exec rm -ir {} \;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With