cannot remove directory: Permission denied

  • Support information:
    - OS: Ubuntu 16.04 LTS
    - I-MSCP: i-MSCP 1.5.1 (Build: 20170908)

    Hi there,

    yesterday my system crashes and I need to let the hoster restore it from an backup. This crashed almost the whole database server whiches caused me to remove all databases and restore them all from the scratch. All I could us was the db.* and user.* files so the logins and permission stayed the same.

    After that everything went smooth and was working again. So I continued normal work which was to remove a subdomain. But it was not going to be deleted from imscp and stayed at "deleted" state. So I executed the request manager of imscp manually and it was telling me that it has no access to the subdomain folder which should be deleted (sorry no logs here).
    So I tried to delete it on my own but it wasn't possible. Even trying to use chattr only told me that the system is not knowing the command "chattr"?!?

    My next step was to directly remove the delete command in the database by setting the "todelete" status back to "ok". And then I did a reconfigure of imscp, but all I got (and get) was this:

    About a year ago I already had this trouble (…2Fetc%252Fmount#post52147) so I tried to make it work again by using the workaround for the mount script (which is getting overwritten by the hoster on each boot). But I am still able to start.

    My last try was to disable logging as it was told here:…t_customer_logs-parameter but without any effect.

    Can someone help me please?

  • @UncleSam

    Your mount problem, even with specific init script provided by Strato shouldn't occurs anymore as we are now reading entries from /proc/self/mounts.

    Well, at first please, try to run the script that you can found in your i-MSCP 1.5.1 archive (contrib directory). That script should umount any mount from /var/www (recursively). Once done try to delete the subdomain again.

    If you cannot figure out alone, give us access to the server for further investigation.


  • Hello @Nuxwin

    thank you very much for your fast response. I finished restoring and everything is working again - but not the removing of this subdomain. I already executed your fix and it writes a lot of unmount lines. But I can execute it as often as I want they are always the same.

    I now start from the scratch so here is the message I get if I try to let imscp remove it:

    Shell-Script: # /var/www/imscp/engine/imscp-rqst-mngr --help
    1. [FATAL] iMSCP::DbTasksProcessor::_processModuleDbTasks: Couldn't remove the `/var/www/virtual/domain.tld/logs/' directory: problem unlinking /var/www/virtual/domain.tld/logs/ticket.domain.tld: cannot remove directory: Device or resource busy ...propagated at /var/www/imscp/engine/PerlLib/iMSCP/ line 496.

    (Next part could be ignored - fixed it, was only a missing column - no idea why but now it is there and working :-))
    I have no idea if this is importent or not, but I have one plugin which is no longer working after restore. I cannot explain why, but OpenDKIM is no longer working. I just write it because maybe it has to do something with my problem?!?

    1. (translated message) unexpected error
    2. Plugin::OpenDKIM::enable: DBD::mysql::db do failed: Unknown column 'is_subdomain' in 'field list' at /var/www/imscp/gui/plugins/OpenDKIM/backend/ line 1156.
    3. ...propagated at /var/www/imscp/gui/plugins/OpenDKIM/backend/ line 1190.

    I write you in private my details if you want to take a look on it.

    Edited once, last by UncleSam ().

  • After fixing the plugin and doing some opendkim stuff the reconfigure worked and deleted the subdomain - no idea what happened but it seems to work now.

    Thx for your help!