Nextcloud upgrade from 27 to 28 stuck in loop with needsDBupgrade true from files app

Generally something else is wrong with the installation or the update process being used. You’ll need to provide more details about your specific situation. I would suggest opening a dedicated thread and filling out the support template.