Automatically upgrade plugin fails

After moving my websites from a hosting provider to my Synology DS112 NAS I was having problems with the auto update / automatically updating of several plugins for my Worpress installation.
I tried almost every possible solution which i could find out there already on the net.
Finally I figured out what the issue was and the auto update service for plugins of WordPress works like a charm again.

I will try explain the steps I took in detail below to get it working again.

The error I was getting when i tried to do an automatic update of a WordPress plugin:

Removing the old version of the plugin
Could not remove the old version of the plugin
Plugin upgrade failed

Browsing the net I found a lot of answers directing me to several possible solutions, like:

define(‘FS_METHOD’, ‘ftpext’);
define(‘FTP_BASE’, ‘/path/to/wordpress/’);
define(‘FTP_CONTENT_DIR’, ‘/path/to/wordpress/wp-content/’);
define(‘FTP_PLUGIN_DIR ‘, ‘/path/to/wordpress/wp-content/plugins/’);
define(‘FTP_PUBKEY’, ‘/home/username/.ssh/id_rsa.pub’);
define(‘FTP_PRIKEY’, ‘/home/username/.ssh/id_rsa’);
define(‘FTP_USER’, ‘username’);
define(‘FTP_PASS’, ‘password’);
define(‘FTP_HOST’, ‘ftp .example.org’);
define(‘FTP_SSL’, false);

OR

define(‘FS_METHOD’, ‘ftpsockets’);

OR

Delete the plugin via FTP and manually upload it back again (what is in my opinion never a solution, but a workaround).

I solved this issue by executing the following steps, it is a bit technical (and i had to figure out a lot of things myself) but hopefully you can just use these steps below.

1) Open an internet browser like Firefox and navigate to your NAS by entering it’s IP adres [http: //192.168.1.**:5000/webman/index.cgi] and log-in using [Admin].

2) Click [Configuration Screen] and click [Terminal] below Network services.

3) Check [enable SSH-service ] and click [Apply]

4) Now download and install Putty from the internet on your PC.
Open Putty.exe and use your NAS ip adres [192.168.1.**] Port [22].
Place a bullit at [NEVER] below ‘”Close window on exit”.
Place a bullit at [SSH].
Done that? Click button [Open].

5) Now a SSH terminal will open. Login as [admin] and hit [enter]

6) Now you will see “admin@192.168.1.**’s password. So enter the [admin’s password] and hit enter. While typing you will not see any characters, that’s normal behaviour of this SSH terminal.

7) Now you will see something like:
Could not chdir to home directory /var/services/homes/admin: No such file or directory
BusyBox v1.16.1 (2013-11-06 05:31:51 CST) built-in shell (ash)
Enter ‘help’ for a list of built-in commands.
[YourServerOrNasNameHere]>

8) Behind [YourServerOrNasNameHere]> type the following code’s

[cd ..] and hit enter
[cd /usr/syno/apache/conf] and hit enter
[dir] and hit enter

9) Now you will see something like:
httpd.conf
httpd.conf-sys
httpd.conf-user

Behind [YourServerOrNasNameHere]> type:
[vi httpd.conf-user] and hit enter

10) You have now opend up the configuration file and we will start editing it in a second.

11) Use the down-arrow and go down approx. 64 rules down. The idea is that you will see:

#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User nobody
Group nobody

12) Use the arrow-keys to put the cursor in the beginning of line [User nobody]
Now hit [SHIFT-C] and the line will dissapear.
Now, on the empty line, write the user of your files and folders on your WordPress website installation, something like this
[User yournamehere] and hit the ESC(cape)-key. Don’t forget the ESC-key!

13) Use the arrow-keys to put the cursor in the beginning of line [Group nobody]
Now hit [SHIFT-C] and the line will dissapear.
Now, on the empty line, write the group of your user used at (12), so the user of your files and folders on your WordPress website installation, something like this
[Group groupnameoftheuserfrompoint12here] and hit the ESC(cape)-key. Don’t forget the ESC key!

14) Now, and it doesn’t matter where your cursor is situated (as long as you did the ESC-key) type [:wq] and hit enter (w=save and q=quit).

15) When you did those steps correctly you should see [YourServerOrNasNameHere]> again. Type [reboot] and hit enter to restart the NAS and to apply the changes.

16) Once the NAS is completely restarted log in to your WordPress websites back-office. [http: // yourwebsite.com/wp-admin] and try to auto update your plugin again.

This solved my problems!!

If this is not succesfull for your situation, try to repeat those steps again and for steps 12 and 13 try a different User and/or Group. DON’T FORGET:
-the ESC-key part of 12 and 13
-the [:wq] part of 14
-the [reboot] part of 15
If this is not the solution then first set the lines from 12 and 13 back to original lines {in most cases:
User nobody
Group nobody
but i have also seen
User root
Group root
In this example (which was my solution) i had to use httpd.conf-user, but you can also try the other files: httpd.conf AND/OR httpd.conf-sys perhaps that is the solution for you.

When i have some time i will add some extra screenshots. Please leave a reply, if this also solved your Worpdress auto update plugin issue.