Magento 2 Permissions Exception During bin/magento setup: upgrade
After updating a module & running bin/magento setup: upgrade, if you are getting exception – “Missing write permissions to the following directories: ‘/var/www/html/magento2/pub/static’, you don’t need to worry anymore. Due to an older installation where some symlinks & old files are no longer existing, when checkInstallationFilePermissions confirms the permission recursively, it finds missing symlink & returns false on the verification step. This blog post is going to explore the steps to handle this exception & how to debug it.
2) Come to the line 143 in method checkRecursiveDirectories
3) Include the lines var_dump($subDirectory);var_dump($subDirectory->isWritable());
4) Run again – bin/magento setup: upgrade
After performing above steps, if you are still not able to debug the issue,
5) You need to check for existing modules that no longer exist, but having files in pub/static folder. We recommend you delete such files.
After such steps, run php bin/magento setup: upgrade command, and also clear cache.