You need to have a user in "data/config.php" in defaultPermissions to be the same user you run upgrade from (either your user or www-data, but not root). I recommend keep it www-data but run upgrade from www-data. You also need to have all files to have the same ownership (not mixed-up) www-data.
You also need to remove the empty data/config-internal.php file if it exists.
You also need to remove the empty data/config-internal.php file if it exists.
Comment