We've been having problems recently with theme and plugin updates failing with the "can't delete directory" error.
Here's what I discovered testing this with updating Akismet:
The permissions and ownership are set to the installation defaults (755 for directories, 644 for files).
When Akisment plugin is activated and I click "Automatic update", I get the "deactivating" message and then the update fails.
If I deactivate the plugin first, use the automatic update, and then re-activate the plug-in, the plug-in successfully updates.
The same is true with updating a theme: If I deactivate the theme first and then do the automatic update, the theme update is successful.
If the theme is activated when I run the automatic update, the update fails.
I HAVE NOT READ THE CODE to see what the mechanism is or why this is happening, but in my case, it doesn't appear to be a permission issue. Rather, it appears that the update process fails to actually deactivate the plugin or theme, even though it says it is deactivating the plugin or theme, and doesn't display a message stating that the deactivation failed.
HERE'S WHAT I AM CURIOUS ABOUT:
1. Is this what others who are having the problem with plugin and theme updates failing are experiencing? -- That is, deactivating the plugin or theme before using the automatic update, makes the update work correctly.
2. Is this a permission problem? It doesn't seem to be a permission problem to me. I haven't tested the permissions as carefully, but it appears that changing the permissions on the files and folders doesn't actually fix the problem.
3. If it is an issue with the automatic deactivation failing, what possible remedies should I try? Do the WordPress coding specification and API have a mechanism for verifying that a plugin or theme successfully deactivated before the update proceeds?
I'm hoping this information might help in resolving the automatic update failure problem, especially since it seems to be so mysterious and this forum is full of comments about how changing permissions didn't help.
All feedback is most welcome. We have a lot of WP websites and this update failure problem is creating a lot of extra work.