If you don’t have much server administration experience, please click contact I can help you do this and get your website working correctly.
So you got this error when trying to update one of your plugins or upload an image or something else? I keep getting this error every few months myself. I have not figured out what is creating the error, however I suspect there has been a change to the core wordpress code somewhere which doesn’t set the permissions properly after an update. I almost feel like digging into the source code soon.
I was confused by this message right after creating a new wordpress website and then migrating my content.
I did a bad, bad no, no while updating and lost the entire site, so I had to start again from a bakcup. Yes I have lost this entire site. Thank god for backups. You’d be amazed how quickly you learn when you have no other choice. LOL. I highly suggest jetpack backups. The cheapest jetpack package is all I have and it is AMAZING.
The migration seemed to work fine. All my articles appeared. All my images appeared. I felt I had achieved a great success.

Then I tried to write an article and add an image. I got a failed to upload image message. The odd thing is I could go to old articles and still upload images.

I thought that was weird. Then I got a notice in my dashboard that a plugin needed updating. I tried to update it and got the error that lead you here.
I was lazy and ignored it a few days, thought it was just the plugin. Then another plugin needed updating. When I tried to update it I got the error again.
Update failed: The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.
I’ve done a lot of server admin work so I knew it was a simple permission issue. The only problem I had no idea what directories/folders needed permission changes and what they needed to be.
So I did a little research.

And the reason the name of this article is so long? Because nothing I typed matched a damn thing and I figured someone would be having this issue soon. LOL
You will need to login to your server either with SSH or many hosting companies now have a way to open a terminal right in your browser page.
First you will need to update the user permissions with usermod. After this your files owner and group will be something like www-data that is what my server (Nginx) was named. Here is a link to how to find out what yours is named.
sudo usermod -aG www-data $USER
The above line adds your current user to your servers group (Apache/Nginx). More on that here on Stackexchange if you look for the above command in the answers.
If you need to know where your wordpress is installed type the following using find command again.
find -name wordpress
That command will output something like /var/www/html/…/…/…/wordpress It finds anything with the name wordpress.
Next set the permissions on the files under your wordpress directory. Mine was located at /var/www/html/ so I used.
find /var/www/html/ -type f -exec chmod 604 {} \;
This uses the find Linux command and exec with chmod command. Basically this line of code is using the find command to find all the files (f) in the directories in or below /var/www/html/ and it applies chmod to them with permissions of 604. This means the owner (nginx/apache your server) has the read/write permissions but other users can only read. No one has the execute permissions not even root because this could cause security issues. You might go further and make the permissions on the files 604 as mentioned here. That will mean only the owner has full rights and everyone else can read only.
Next you need to change the directory permissions so that wordpress plugins can write to them and images can be uploaded etc. This will use the find command too, but slightly different syntax. This time use a d to find the directories in or below /var/www/html/ like so. Again your path may differ
find /var/www/html/ -type d -exec chmod 705 {} \;
That should make your wordpress work. Your site may be located in a directory different from /var/www/html/ you will need to look in your Server (nginx/apache) settings for the root directory or use the find -name wordpress command shown. That is where the permissions need changing. This all depends on who installed your wordpress, but I believe the above is default.
More about using exec with find

This keeps happening on my server. I keep having to reset my permissions. It only happens every few months and I have to SSH into my server to fix it all again. If I ever get the chance I’ll look into the WordPress code that does the updates. That is where the code needs to be fixed.
Whatever the reason, I have since switched to using setfacl to permanently set file permissions. I’ll update this article with how to do that soon. I want to see if it is more of a permanent solution than this.
Comments
2 responses to “WordPress : Update failed: The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.”
LOL this crashed my site. Oh well
You have to be careful. Changing permissions is not easy. You probably have the wrong permissions. If mistype even a little you shit will be wrecked. Linux permissions are a real mother fucker to say the least. The info in the article works I do it every few months and update the article. Your group and owner permissions are what is wrong. Owner must be www-data for all files that means you need to go outside the main directory say to www and run chmod -r and chown -r that tells it to be recursive aka for all folders and files below the parent file. Also I can fix it for you if you fill out the contact form.
You must log in to post a comment.