When you get an error like this while updating, check file ownership. Chances are that you edited something in the backend and the plugin or theme files now being owned by another user, cannot be deleted by the server.
If you have terminal access as root, type:
chown -R www-data:www-data /path/to/wordpress/*
Where www-data is the user your Apache runs as and /path/to/wordpress is of course the path to the root of your wordpress installation. the “*” is to apply to all files and folders and the “-R” earlier means the command [chown – for change owner – in this case] applies recursively to all files and folders contained in the folder named.
If you try to upgrade now, it should work.