Removing old Ghost versions ERROR

If you’re looking for help, please provide information about your environment. If you delete this template and don’t provide any information, your topic will be automatically closed.

If you aren’t running the latest version of Ghost, the first thing we’ll ask you to do is update to the latest version of Ghost.

And

  • How was Ghost installed and configured?
    Digital Ocean droplet
  • What Node version, database, OS & browser are you using?
    Debug Information:
    OS: Ubuntu, v20.04.4 LTS
    Node Version: v14.19.3
    Ghost Version: 5.0.0
    Ghost-CLI Version: 1.21.0
    Environment: production
    Command: ‘ghost update’
  • What errors or information do you see in the console?
    :heavy_check_mark: Updating to a major version
  • sudo systemctl stop ghost_derealisation-xyz
    :heavy_check_mark: Stopping Ghost
    :heavy_check_mark: Linking latest Ghost and recording versions
  • sudo systemctl start ghost_derealisation-xyz
    :heavy_check_mark: Restarting Ghost
    :heavy_multiplication_x: Removing old Ghost versions
    An error occurred.
    Message: ‘EACCES: permission denied, unlink ‘/var/www/ghost/versions/4.31.0/.eslintrc.js’’
  • What steps could someone else take to reproduce the issue you’re having?
    Just ghost update. When happening I just reboot server and ghost update again and it works. But I would like some help to understand what is going wrong here and how to avoid the error if this can generate complications in the future.