Sebclem / hassio-nextcloud-backup

Hass.io Add-on: Backup your snapshots to Nextcloud
GNU General Public License v3.0
117 stars 15 forks source link

Can't create new snapshot (Response code 400 (Bad Request)) #233

Open nicknol opened 4 months ago

nicknol commented 4 months ago

Describe the bug Error Message: Can't create new snapshot (Response code 400 (Bad Request))

the tar file is created on my NAS but doesn't get transferred to nextCloud.

To Reproduce Neither scheduled nor ad-hoc backups are transferred to nextCloud

Expected behavior Scheduled adn ad-hoc backups are transferred to nextCloud

System information

Additional context Please find the log file after a restart of the add-on and executing an ad-hoc aka manual backup.

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
fix-attrs: info: applying /etc/fix-attrs.d/10-run
fix-attrs: warning: fix-attrs is deprecated, please fix volume permissions in your container manager instead
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/00-banner.sh

-----------------------------------------------------------
 Add-on: Nextcloud Backup
 Easily upload your Home Assistant backups to Nextcloud
-----------------------------------------------------------
 Add-on version: 0.17.7
 You are running the latest version of this add-on.
 System: Home Assistant OS 12.0  (amd64 / generic-x86-64)
 Home Assistant Core: 2024.2.2
 Home Assistant Supervisor: 2024.02.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
cont-init: info: /etc/cont-init.d/00-banner.sh exited 0
cont-init: info: running /etc/cont-init.d/01-log-level.sh
Log level is set to INFO
cont-init: info: /etc/cont-init.d/01-log-level.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun nextcould_backup (no readiness notification)
s6-rc: info: service legacy-services successfully started
[17:58:40] INFO: Starting Node...
[2024-02-28 17:58:41] [info]:   Log level: info
[2024-02-28 17:58:41] [info]:   Backup timeout: 9000000
[2024-02-28 17:58:41] [info]:   Satus : Go !
[2024-02-28 17:58:41] [info]:   Initializing and checking webdav client...
[2024-02-28 17:58:41] [info]:   Starting auto clean cron...
[2024-02-28 17:58:41] [info]:   Starting Cron...
[2024-02-28 17:58:41] [info]:   Hassio API : Go !
[2024-02-28 17:58:42] [info]:   Nextcloud connection : Go !
[2024-02-28 17:59:10] [info]:   Stopping addons...
[2024-02-28 17:59:10] [info]:   ... Ok
[2024-02-28 17:59:10] [info]:   Creating new snapshot...
[2024-02-28 18:03:52] [error]:  Can't create new snapshot (Response code 400 (Bad Request))
nicknol commented 4 months ago

it seems to be related to the backup functionality. The supervisor log shows:

24-02-28 19:29:00 ERROR (MainThread) [supervisor.backups.manager] Backup 25b7e633 error
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/backups/manager.py", line 261, in dobackup
    async with backup:
  File "/usr/src/supervisor/supervisor/backups/backup.py", line 363, in __aexit
    self.outersecuretarfile.exit(
  File "/usr/local/lib/python3.12/site-packages/securetar/_init.py", line 140, in __exit
    self._tar.close()
  File "/usr/local/lib/python3.12/tarfile.py", line 1975, in close
    self.fileobj.close()
OSError: [Errno 5] I/O error
sanchosk commented 3 months ago

Same thing here. @nicknol did you have any luck? I guess the problem is the file for backup is above 2GB...

sanchosk commented 3 months ago

@nicknol I think I know where the problem is. I recently moved my backup location from local data disk to remote NFS. This seems to be the problem - with NFS, the NC backup does not work. If I switch the default backup back to local device, the NC backup works again. Can you, plz, check if you also have default backup location switched to some remote drive? (SMB/NFS)

nicknol commented 3 months ago

@sanchosk yes, the backup itself fails if it is supposed to be created on a NAS and is big:

I could create big backups on the NAS in 2023, means using HA 2023.12. I can't remember exactly whether it stopped working with 2024.1 or 2024.2 Writing about it, I think I remember a comment about an improvement/change to handling tar in one of the recent releases. ... have to dig for it Found it, it was about HASS OS 12: https://www.home-assistant.io/blog/2024/02/26/home-assistant-os-12-support-for-raspberry-pi-5/

Sebclem commented 2 months ago

Can you confirm that this is not related to this addon ?

sanchosk commented 2 months ago

I am not sure, cannot confirm nor deny. What I can say is that when the backup location is set to local, the addon works as expected, when the backup location is shared drive, it does not. At the same time, the shared drive has no problem to create backups of 2+GB. So, can't tell "where is the ball", but I know that the combination of the addon and external drive for backup renders the addon defective.

Sebclem commented 2 months ago

This could be linked to the location api param, but it's strange because this should fallback to the default setting....