0

I went to my website's directory and ran:

composer update

[RuntimeException] Could not delete /home/example/public_html/example.com/web/sites/default/default.services.yml:

ls -la output:

-rw-rw-r-- 1 example example 7732 Aug 28 03:52 default.services.yml

Should I take any action, if so, what?

2 Answers 2

1

In the core 9.4.7 update, the default.services.yml file was updated. However, if your permissions are set correctly on the /default directory and the default.services.yml file, then composer update will fail with the "could not delete" permissions warning.

You can solve this as follows on most versions of linux and macOS.

First, delete default.services.yml. (You may need to use sudo (sudo rm default.services.yml).

Next, try running composer install (since you have already run the update, running install will cause the scaffolding to be reset). If the file is created properly, check the permissions against this answer and if they are ok, you are done.

If the file cannot be created, carefully change the permissions of the default directory (but not any child/subdirectories) to 777 (chmod default 777), run composer install again to create the file, and then change the permissions for the default directory back to 755 (chmod default 755).

Why does this happen?

Drupal needs file permissions for services files to be set securely so that they cannot be changed by just anyone. Unfortunately, this makes updating these files a bit of a pain because the update requires manual intervention (since the files can't be easily overwritten automatically, unlike most Drupal files in updates).

6
  • I got Nothing to install, update or remove.
    – markus
    Sep 30, 2022 at 10:05
  • I have already deleted the sites/default/default.services.yml file, how could I reverse this?
    – markus
    Sep 30, 2022 at 10:09
  • sites/default/default.services.yml was somehow re-created, well no in composer update I get Nothing to install, update or remove.
    – markus
    Sep 30, 2022 at 10:16
  • Usually after composer performs the update/install of modules, then the scaffolding files, which includes default.services.yml, will be checked and generated if they do not exist. Sep 30, 2022 at 10:18
  • 1
    Yes, my version is now 9.4.7 seems I got after this in peace.
    – markus
    Sep 30, 2022 at 10:20
0

I just ran into this issue when upgrading Drupal 9.4.8 to 9.5.0 and this link helped me, I believe it will help you too :)

https://drupal.stackexchange.com/a/290297/35202

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.