nextcloud / backup

Backup now. Restore later.
GNU Affero General Public License v3.0
233 stars 33 forks source link

During initial backup, paths are always null #635

Open super-cooper opened 4 months ago

super-cooper commented 4 months ago

I've just installed the app recently, and have been unable to take a backup so far.

I run the standard Nextcloud image inside a Docker container. I have both stages of the backup pointed to an NFS mount in the container. Double checked that the permissions are correct, but it's not even able to get to the point of actually storing anything.

It can't even read files because it keeps pulling up the path of whatever file it's trying to look at as null. This causes an error with one of the functions that is expecting a path string. I don't really know PHP so this has been difficult for me to try to debug, but I'm pretty sure it is deriving the user session as null in /var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php. I added some logging to getPathForNode, and the $user and $owner variables both come up null. As a result, the function returns null, and that value is plugged into OC\Files\View->file_exists(), which is not expecting a null value. Full log:

An unhandled exception has been thrown:
TypeError: OC\Files\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/html/lib/private/Files/View.php on line 528 and defined in /var/www/html/lib/private/Files/View.php:1128
Stack trace:
#0 /var/www/html/lib/private/Files/View.php(528): OC\Files\View->basicOperation('file_exists', NULL)
#1 /var/www/html/lib/private/Files/Filesystem.php(545): OC\Files\View->file_exists(NULL)
#2 /var/www/html/apps/files_versions/lib/Storage.php(189): OC\Files\Filesystem::file_exists(NULL)
#3 /var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php(196): OCA\Files_Versions\Storage::store(NULL)
#4 /var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php(102): OCA\Files_Versions\Listener\FileEventsListener->write_hook(Object(OC\Files\Node\File))
#5 /var/www/html/lib/private/EventDispatcher/ServiceEventListener.php(86): OCA\Files_Versions\Listener\FileEventsListener->handle(Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent))
#6 /var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php(230): OC\EventDispatcher\ServiceEventListener->__invoke(Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent), 'OCP\\Files\\Event...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#7 /var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php(59): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'OCP\\Files\\Event...', Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent))
#8 /var/www/html/lib/private/EventDispatcher/EventDispatcher.php(94): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent), 'OCP\\Files\\Event...')
#9 /var/www/html/lib/private/EventDispatcher/EventDispatcher.php(106): OC\EventDispatcher\EventDispatcher->dispatch('OCP\\Files\\Event...', Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent))
#10 /var/www/html/lib/private/Files/Node/HookConnector.php(100): OC\EventDispatcher\EventDispatcher->dispatchTyped(Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent))
#11 /var/www/html/lib/private/legacy/OC_Hook.php(105): OC\Files\Node\HookConnector->write(Array)
#12 /var/www/html/lib/private/Files/View.php(1270): OC_Hook::emit('OC_Filesystem', 'write', Array)
#13 /var/www/html/lib/private/Files/View.php(1144): OC\Files\View->runHooks(Array, '/backup/staging...')
#14 /var/www/html/lib/private/Files/View.php(680): OC\Files\View->basicOperation('file_put_conten...', '/adam/files/bac...', Array, '')
#15 /var/www/html/lib/private/Files/Node/Folder.php(188): OC\Files\View->file_put_contents('/adam/files/bac...', '')
#16 /var/www/html/lib/private/Files/SimpleFS/SimpleFolder.php(89): OC\Files\Node\Folder->newFile('.nobackup', '')
#17 /var/www/html/custom_apps/backup/lib/Service/PointService.php(796): OC\Files\SimpleFS\SimpleFolder->newFile('.nobackup', '')
#18 /var/www/html/custom_apps/backup/lib/Service/PointService.php(642): OCA\Backup\Service\PointService->initBackupFS()
#19 /var/www/html/custom_apps/backup/lib/Command/PointScan.php(129): OCA\Backup\Service\PointService->scanFoldersFromAppData()
#20 /var/www/html/3rdparty/symfony/console/Command/Command.php(298): OCA\Backup\Command\PointScan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/3rdparty/symfony/console/Application.php(1040): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/html/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Backup\Command\PointScan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/html/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/html/lib/private/Console/Application.php(206): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /var/www/html/console.php(100): OC\Console\Application->run()
#27 /var/www/html/occ(11): require_once('/var/www/html/c...')
#28 {main}%                                                      

I'm kind of not sure where to go from there. I'm not sure where this user session is coming from, and I don't have experience debugging PHP. Some help would be immensely appreciated.

Alex15622 commented 4 months ago

I have the same problem. Also, I cannot move the AppData storage back to local. grafik

I am using Nextcloud AIO in a Docker on Ubuntu 22.04. Even if I want to start the backup with the occ command, I get the following exception:

sudo docker exec --user www-data -it nextcloud-aio-nextcloud php occ backup:point:create
> maintenance mode: on
> initialization of the AppData
> maintenance mode: off
An unhandled exception has been thrown:
TypeError: OC\Files\View::basicOperation(): Argument #2 ($path) must be of type string, null given, called in /var/www/html/lib/private/Files/View.php on line 528 and defined in /var/www/html/lib/private/Files/View.php:1128
Stack trace:
#0 /var/www/html/lib/private/Files/View.php(528): OC\Files\View->basicOperation('file_exists', NULL)
#1 /var/www/html/lib/private/Files/Filesystem.php(545): OC\Files\View->file_exists(NULL)
#2 /var/www/html/apps/files_versions/lib/Storage.php(190): OC\Files\Filesystem::file_exists(NULL)
#3 /var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php(196): OCA\Files_Versions\Storage::store(NULL)
#4 /var/www/html/apps/files_versions/lib/Listener/FileEventsListener.php(102): OCA\Files_Versions\Listener\FileEventsListener->write_hook(Object(OC\Files\Node\File))
#5 /var/www/html/lib/private/EventDispatcher/ServiceEventListener.php(86): OCA\Files_Versions\Listener\FileEventsListener->handle(Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent))
#6 /var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php(251): OC\EventDispatcher\ServiceEventListener->__invoke(Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent), 'OCP\\Files\\Event...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#7 /var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'OCP\\Files\\Event...', Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent))
#8 /var/www/html/lib/private/EventDispatcher/EventDispatcher.php(94): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent), 'OCP\\Files\\Event...')
#9 /var/www/html/lib/private/EventDispatcher/EventDispatcher.php(106): OC\EventDispatcher\EventDispatcher->dispatch('OCP\\Files\\Event...', Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent))
#10 /var/www/html/lib/private/Files/Node/HookConnector.php(112): OC\EventDispatcher\EventDispatcher->dispatchTyped(Object(OCP\Files\Events\Node\BeforeNodeWrittenEvent))
#11 /var/www/html/lib/private/legacy/OC_Hook.php(105): OC\Files\Node\HookConnector->write(Array)
#12 /var/www/html/lib/private/Files/View.php(1275): OC_Hook::emit('OC_Filesystem', 'write', Array)
#13 /var/www/html/lib/private/Files/View.php(1144): OC\Files\View->runHooks(Array, '/Lokal/BackupCa...')
#14 /var/www/html/lib/private/Files/View.php(680): OC\Files\View->basicOperation('file_put_conten...', '/Alex/files/Lok...', Array, '')
#15 /var/www/html/lib/private/Files/Node/Folder.php(188): OC\Files\View->file_put_contents('/Alex/files/Lok...', '')
#16 /var/www/html/lib/private/Files/SimpleFS/SimpleFolder.php(89): OC\Files\Node\Folder->newFile('.nobackup', '')
#17 /var/www/html/custom_apps/backup/lib/Service/PointService.php(796): OC\Files\SimpleFS\SimpleFolder->newFile('.nobackup', '')
#18 /var/www/html/custom_apps/backup/lib/Service/PointService.php(386): OCA\Backup\Service\PointService->initBackupFS()
#19 /var/www/html/custom_apps/backup/lib/Service/PointService.php(252): OCA\Backup\Service\PointService->initRestoringPoint(true)
#20 /var/www/html/custom_apps/backup/lib/Command/PointCreate.php(120): OCA\Backup\Service\PointService->create(true, '', '')
#21 /var/www/html/3rdparty/symfony/console/Command/Command.php(298): OCA\Backup\Command\PointCreate->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/html/3rdparty/symfony/console/Application.php(1040): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/html/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Backup\Command\PointCreate), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/html/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /var/www/html/lib/private/Console/Application.php(218): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /var/www/html/console.php(100): OC\Console\Application->run()
#28 /var/www/html/occ(11): require_once('/var/www/html/c...')
joshtrichards commented 4 weeks ago

Are you still experiencing this current maintenance releases of v27/v28/v29?

super-cooper commented 4 weeks ago

Hi Josh, I believe the issue was caused by the file versioning plugin. I have since uninstalled backups because it kept causing my nextcloud to get stuck in maintenance mode during hours of the day where it wasn't supposed to be doing any work. I now back up via the filesystem and have a cronjob which dumps the database every day. Not as good as what the backups plugin provided but also doesn't have the reliability issues. I'd be happy to help with investigation if needed.