Upgrading moodle 3.5.5 to 3.5.12 and encountered the following error while performing command line update in Windows/IIS server. "Invalid permissions detected when trying to create a directory. " (More detailed errors included below.)
-tried deleted cache folder contents, no luck
-tried adding IUSR with Full access to cache folder, no luck
-tried web interface update, no luck, blank page after a minute
-added myself to cache folder with full access, helped,
-added myself to localcache folder with full access, helped
-added myself to whole moodledata folder, appeared to work then.
Solution: add access permissions to moodledata for the account I was logged into the server with.
The CLI process must be running under my user account, not the web user. To further complicate things my administrator account didnt seem to have enough access rights to the moodledata folder on a network drive, so I added myself, perhaps the network drive was part of the confusion too.
Thought Ild post my solution for Windows 20016 IIS 10 users out there. There's a few forum posts on this issue with apache solutions.
========further details from failed updates:=============
PHP Warning: rmdir(E:\xxxxxxdata/cache/cachestore_file): Directory not empty in E:\xxxxxxxxx\lib\moodlelib.php on line 9443
PHP Warning: unlink(E:\xxxxxxdata/localcache/.lastpurged): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9434
PHP Warning: rmdir(E:\xxxxxxxxx/localcache/htmlpurifier/2018051705.03): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9443
PHP Warning: rmdir(E:\xxxxxxxxx/localcache/htmlpurifier): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9443
PHP Warning: unlink(E:\xxxxxxxxx/localcache/mustache/1592912537/boost/__Mustache_3428caa03544af11ff6e67391084b68b.php): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9434
PHP Warning: unlink(E:\xxxxxxxxx/localcache/mustache/1592912537/boost/__Mustache_5f41112bee7414b7305fa62cbc2d1f13.php): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9434
PHP Warning: unlink(E:\xxxxxxxxx/localcache/mustache/1592912537/boost/__Mustache_72541c0a8f02293347e0812e8799ca64.php): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9434
PHP Warning: unlink(E:\xxxxxxxxx/localcache/mustache/1592912537/boost/__Mustache_7a43f0495820dce0201da63ee5c35425.php): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9434
PHP Warning: unlink(E:\xxxxxxxxx/localcache/mustache/1592912537/boost/__Mustache_7ac6cfa4ad7774790d2aafb799a63dfe.php): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9434
PHP Warning: unlink(E:\xxxxxxxxx/localcache/mustache/1592912537/boost/__Mustache_9b0dfa9438111951d1532fded4f28734.php): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9434
PHP Warning: unlink(E:\xxxxxxxxx/localcache/mustache/1592912537/boost/__Mustache_e8d8ae873a984614cbb0bd0c2a191036.php): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9434
PHP Warning: unlink(E:\xxxxxxxxx/localcache/mustache/1592912537/boost/__Mustache_fe0367092bc18a0ea6dfce2f676bcc18.php): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9434
PHP Warning: rmdir(E:\xxxxxxxxx/localcache/mustache/1592912537/boost): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9443
PHP Warning: rmdir(E:\xxxxxxxxx/localcache/mustache/1592912537): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9443
PHP Warning: rmdir(E:\xxxxxxxxx/localcache/mustache): Permission denied in E:\xxxxxxxxx\lib\moodlelib.php on line 9443
Default exception handler: Invalid permissions detected when trying to create a directory. Turn debugging on for further details. Debug: [localcachedir] is not writable, check permissions.
Error code: invaliddatarootpermissions
* line 1566 of \lib\setuplib.php: invalid_dataroot_permissions thrown
* line 1764 of \lib\setuplib.php: call to make_writable_directory()
* line 1668 of \lib\moodlelib.php: call to make_localcache_directory()
* line 1781 of \lib\upgradelib.php: call to purge_all_caches()
* line 176 of \admin\cli\upgrade.php: call to upgrade_core()
!!! Invalid permissions detected when trying to create a directory. Turn debugging on for further details. !!!
!! [localcachedir] is not writable, check permissions.
Error code: invaliddatarootpermissions !!
!! Stack trace: * line 1566 of \lib\setuplib.php: invalid_dataroot_permissions thrown
* line 1764 of \lib\setuplib.php: call to make_writable_directory()
* line 1668 of \lib\moodlelib.php: call to make_localcache_directory()
* line 1781 of \lib\upgradelib.php: call to purge_all_caches()
* line 176 of \admin\cli\upgrade.php: call to upgrade_core()
PHP Warning: rmdir(E:\xxxxxxxxxxxxdata/cache/cachestore_file): Directory not empty in E:\xxxxxxxxx\lib\moodlelib.php on line 9443
-->auth_oauth2
++ 2018051401: Success (0.06 seconds) ++
++ Success (0.16 seconds) ++
-->filter_mathjaxloader
++ 2018051401: Success (0.10 seconds) ++
++ Success (0.14 seconds) ++
Default exception handler: Invalid permissions detected when trying to create a directory. Turn debugging on for further details. Debug: [tempdir]/filestorage is not writable, check permissions.
Error code: invaliddatarootpermissions
* line 1566 of \lib\setuplib.php: invalid_dataroot_permissions thrown
* line 1724 of \lib\setuplib.php: call to make_writable_directory()
* line 59 of \lib\filestorage\file_storage.php: call to make_temp_directory()
* line 6501 of \lib\moodlelib.php: call to file_storage->__construct()
* line 36 of \theme\boost\settings.php: call to get_file_storage()
* line 52 of \admin\settings\appearance.php: call to include()
* line 7997 of \lib\adminlib.php: call to require()
* line 8020 of \lib\adminlib.php: call to admin_get_root()
* line 188 of \admin\cli\upgrade.php: call to admin_apply_default_settings()
!!! Invalid permissions detected when trying to create a directory. Turn debugging on for further details. !!!
!! [tempdir]/filestorage is not writable, check permissions.
Error code: invaliddatarootpermissions !!
!! Stack trace: * line 1566 of \lib\setuplib.php: invalid_dataroot_permissions thrown