Nextcloud hangs on/stuck on : CAN_INSTALL file missing after upgrade

For me the issue was that the hard drive where nextcloud is installed was full and hence the config.php was not written correctly. I freed up space, restored the config.php from a backup and everything was running again.