NextCloud snap installation - backup fails

Hey guys!

after having lots of trouble with the NCP-images, I have moved on to installing a NextCloud snap! So far everything works fine and I have my instance up and running. I am using an Odroid HC4 SBC with 2x 2TB SATA drives connected. One drive is for the NextCloud data, the other one will be used to store the backups.
I am currently struggling with setting up a regular automatic backup. For this, I installed the Backup app and configured an external storage (local - my second backup hard drive). I enabled background tasks, set the restoring point location to my external storage and left the App Data on Local storage.

I then hit “Create full restoring point”. Cron is activated and should now begin the backup. In the logs I can see that Cron starts every 15 minutes and tries to create a backup. Problem is, that it is not added to the Restoring points history.

Can anyone help me to figure out, what the problem here is exactly?

Thanks in advance!
Best regards.

Nextcloud version (eg, 20.0.5): 25
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04
Apache or nginx version (eg, Apache 2.4.25): 2.4
PHP version (eg, 7.4): 8.0

The output of your Nextcloud log in Admin > Logging:

Error	PHP	Error: unlink(/tmp/phpq9eRiH): No such file or directory at /var/snap/nextcloud/33060/nextcloud/extra-apps/backup/lib/Service/PointService.php#540
0: <<closure>>
    OC\Log\ErrorHandler::onError()
1: /var/snap/nextcloud/33060/nextcloud/extra-apps/backup/lib/Service/PointService.php - line 540:
    unlink()
2: /var/snap/nextcloud/33060/nextcloud/extra-apps/backup/lib/Service/PointService.php - line 260:
    OCA\Backup\Service\PointService->backupSql()
3: /var/snap/nextcloud/33060/nextcloud/extra-apps/backup/lib/Cron/Backup.php - line 137:
    OCA\Backup\Service\PointService->create()
4: /var/snap/nextcloud/33060/nextcloud/extra-apps/backup/lib/Cron/Backup.php - line 124:
    OCA\Backup\Cron\Backup->runFullBackup()
5: /var/snap/nextcloud/33060/nextcloud/extra-apps/backup/lib/Cron/Backup.php - line 115:
    OCA\Backup\Cron\Backup->runBackup()
6: /var/snap/nextcloud/33060/nextcloud/extra-apps/backup/lib/Cron/Backup.php - line 97:
    OCA\Backup\Cron\Backup->manage()
7: /snap/nextcloud/33060/htdocs/lib/private/BackgroundJob/Job.php - line 54:
    OCA\Backup\Cron\Backup->run()
8: /snap/nextcloud/33060/htdocs/lib/private/BackgroundJob/TimedJob.php - line 60:
    OC\BackgroundJob\Job->execute()
9: /snap/nextcloud/33060/htdocs/cron.php - line 152:
    OC\BackgroundJob\TimedJob->execute()

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
    ),
  ),
  'supportedDatabases' => 
  array (
    0 => 'mysql',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  ),
  'log_type' => 'file',
  'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log',
  'logfilemode' => 416,
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => '[0:0:0:0:0:0:0:0]',
  ),
  'datadirectory' => '/media/myDataDrive/data',
  'dbtype' => 'mysql',
  'version' => '25.0.2.3',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'xxx',
  'installed' => true,
  'instanceid' => 'xxx',
  'maintenance' => true,
);

Hello,

Sorry for going little off topic but snap has it’s own built in backup utility. Have you considered that?

Refer here → How to backup your instance · nextcloud-snap/nextcloud-snap Wiki · GitHub

You can setup rsync for your user data folder between two drives or do RAID for mirroring and take database backup via snap backup commands. It supports partial backup, so just DB backup will be enough to restore the setup.

This backup process is independent of the app, in this case nextcloud so you won’t have deal with these errors. Runs smooth and works fine.

I am an user of snap nextcloud and this is my preferred way of backup and restore !!

Thanks.

Hello,

yes, I have looked into that option and I can confirm that it works great - but only with limited functionality.
I would like to use the possibility to encrypt my backup, create partial backups and store it on a different NextCloud instance later on. As far as I know the snap backup only creates a backup of the instance and saves it locally, correct?

Best regards

Hello,

Default file access of snap is confined !! But linux as platform offers you the ability of mount points and systemlinks.

You can use combination of those along with scheduled cronjobs for moving those backups.

Refer to that link I shared above.

  1. Data can be indepent of snap confinement so, it can be stored separately on different external disk.
  2. RAID or Mirroring commands like Rysnc can always keep another mirror copy of your user data folder.
  3. Snap supports partial backup, so you can generate a very small size backup of the DB only.

Snap only those two to restore itself.

Idea behind snap is always a solution for non tech end users. Plug n play. If lacks modification and deep customization abilities. If you don’t fall in that category of non-tech user who wants ease of use but want a system with deep customization, I guess snap deployment isn’t the best way to go.

Consider AIO or Docker deployment as they will offer far greater flexibility.

Thanks.

Hello NaXai,

I agree that there are other means to store the backup on a different hard drive. Just uploading it to a different NextCloud instance will be difficult to handle imho. I’m guessing it would also be possible to encrypt the backup via cron job.

Probably I will just stick to the simple snap solution for now and run my server for a while. When it is up and running for a bit I will have a look into docker images or a complete install (what exactly do you mean by AIO?)

Hello,

Refer here → nextcloud/all-in-one: Nextcloud AIO stands for Nextcloud All In One and provides easy deployment and maintenance with most features included in this one Nextcloud instance. (github.com)

Thanks.

Ah ok - thanks! I keep on learning about new possibilities to operate a NextCloud instance. Is there a kind of overview which possibilities exist to operate an instance with an explanation regarding advantages and disadvantages? It seems to me that I have not yet found the perfect way to start off - but unfortunately I don’t even know which oppertunities exist…

Hello,

There is an overview of options available for server hosting and deployment methods. Refer here → Install - Nextcloud

But I don’t think there is any comparison type table available.

Technically speaking, everything is possible via all of the deployment methods, just way to achieving that results are different

One has to run a lot of trial and error when taking the DIY route, before settling for the option he or she feels most comfortable with.

Thanks.