sabeechen / hassio-google-drive-backup

Automatically create and sync Home Assistant backups into Google Drive
MIT License
2.97k stars 181 forks source link

Deletion of old backups not possible #1019

Closed guidostek closed 2 months ago

guidostek commented 2 months ago
Description:
Please help, I have not been able to solve this...

Addon version: 0.112.1 Home Assistant Version: 2024.3.3 Supervisor Version: 2024.03.1 Supervisor Channel: stable Hassos Version: 12.1 Docker Version: 24.0.7 Architecture: aarch64 Machine: raspberrypi4-64 Date: 2024-04-03T19:52:41.043168+00:00 Timezone: Europe/Amsterdam Failure Time: 2024-04-03T19:52:32.276451+00:00 Last Good Sync: 2024-04-03T19:52:31.433588+00:00 Next Sync: 2024-04-03T21:52:32.276451+00:00 Next Backup: 2024-04-01T12:20:14.186392+00:00 Next Cache Warm: 2024-04-03T21:43:30.250343+00:00 Time Offset: 0.0

Exception:

  addon/backup/ha/harequests.py:105 (delete)
  addon/backup/ha/harequests.py:34 (wrap_and_call)
  addon/backup/ha/harequests.py:280 (_sendHassioData)
  addon/backup/ha/harequests.py:225 (_validateHassioReply)
  /site-packages/aiohttp/client_reqrep.py:1059 (raise_for_status)
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('http://supervisor/backups/4f08bbfa')
Whose handling caused:
  addon/backup/model/coordinator.py:198 (_sync)
  addon/backup/model/model.py:222 (sync)
  addon/backup/model/model.py:280 (deleteBackup)
  addon/backup/ha/hasource.py:355 (delete)
  addon/backup/ha/harequests.py:34 (wrap_and_call)
  addon/backup/ha/harequests.py:111 (delete)
backup.exceptions.exceptions.HomeAssistantDeleteError

Backups:

 {
    "HomeAssistant": {
        "backups": 3,
        "retained": 0,
        "deletable": 3,
        "name": "HomeAssistant",
        "title": "Home Assistant",
        "latest": "2024-03-10T09:42:22Z",
        "max": 3,
        "enabled": true,
        "icon": "home-assistant",
        "ignored": 125,
        "detail": "",
        "size": "54.0 GB",
        "ignored_size": "16.6 GB"
    },
    "GoogleDrive": {
        "backups": 7,
        "retained": 3,
        "deletable": 4,
        "name": "GoogleDrive",
        "title": "Google Drive",
        "latest": "2024-03-06T09:42:22Z",
        "max": 4,
        "enabled": true,
        "icon": "google-drive",
        "ignored": 0,
        "detail": "guidostek@gmail.com",
        "size": "76.6 GB",
        "ignored_size": "0.0 B",
        "free_space": "1.7 TB"
    }
}
Config:
 {
    "Setting.MAX_BACKUPS_IN_HA": 3,
    "Setting.DAYS_BETWEEN_BACKUPS": 4.0,
    "Setting.IGNORE_OTHER_BACKUPS": true,
    "Setting.DELETE_IGNORED_AFTER_DAYS": 14.0,
    "Setting.BACKUP_STORAGE": "diensten",
    "Setting.SEND_ERROR_REPORTS": true
}
Addon Logs:
 04-03 21:41:33 DEBUG [backup.watcher] Checking backup source for changes...
04-03 21:43:38 INFO [backup.watcher] A backup directory file was modified, we'll check for new backups soon.
04-03 21:43:50 DEBUG [backup.watcher] Checking backup source for changes...
04-03 21:44:10 INFO [backup.model.coordinator] Syncing Backups
04-03 21:44:11 INFO [backup.ha.hasource] Deleting 'Full Backup 2024-02-24 22:24:10' from Home Assistant
04-03 21:44:11 ERROR [backup.model.coordinator] Home Assistant refused to delete the backup.
04-03 21:44:11 INFO [backup.model.coordinator] I'll try again in 2 hours
04-03 21:44:19 INFO [backup.model.coordinator] Syncing Backups
04-03 21:44:20 INFO [backup.ha.hasource] Deleting 'Full Backup 2024-02-24 22:24:10' from Home Assistant
04-03 21:44:20 ERROR [backup.model.coordinator] Home Assistant refused to delete the backup.
04-03 21:44:20 INFO [backup.model.coordinator] I'll try again in 2 hours
04-03 21:51:53 INFO [backup.watcher] A backup directory file was modified, we'll check for new backups soon.
04-03 21:52:12 DEBUG [backup.watcher] Checking backup source for changes...
04-03 21:52:12 DEBUG [backup.model.syncer] Sync requested by Backup Directory Watcher
04-03 21:52:12 INFO [backup.model.coordinator] Syncing Backups
04-03 21:52:13 INFO [backup.ha.hasource] Deleting 'Full Backup 2024-02-24 22:24:10' from Home Assistant
04-03 21:52:13 INFO [backup.watcher] A backup directory file was modified, we'll check for new backups soon.
04-03 21:52:13 INFO [backup.ha.hasource] Deleting 'addon_a0d7b954_phpmyadmin_0.8.8' from Home Assistant
04-03 21:52:13 ERROR [backup.model.coordinator] Home Assistant refused to delete the backup.
04-03 21:52:13 INFO [backup.model.coordinator] I'll try again in 2 hours
04-03 21:52:23 DEBUG [backup.watcher] Checking backup source for changes...
04-03 21:52:23 DEBUG [backup.model.syncer] Sync requested by Backup Directory Watcher
04-03 21:52:23 INFO [backup.model.coordinator] Syncing Backups
04-03 21:52:24 INFO [backup.ha.hasource] Deleting 'addon_a0d7b954_phpmyadmin_0.8.8' from Home Assistant
04-03 21:52:24 ERROR [backup.model.coordinator] Home Assistant refused to delete the backup.
04-03 21:52:24 INFO [backup.model.coordinator] I'll try again in 2 hours
04-03 21:52:31 INFO [backup.model.coordinator] Syncing Backups
04-03 21:52:32 INFO [backup.ha.hasource] Deleting 'addon_a0d7b954_phpmyadmin_0.8.8' from Home Assistant
04-03 21:52:32 ERROR [backup.model.coordinator] Home Assistant refused to delete the backup.
04-03 21:52:32 INFO [backup.model.coordinator] I'll try again in 2 hours
Supervisor Logs:
 2024-04-03 21:51:54.213 ERROR (MainThread) [supervisor.backups.backup] Can't read backup tarfile /data/mounts/diensten/71881649.tar: unexpected end of data
2024-04-03 21:51:55.291 INFO (MainThread) [supervisor.backups.manager] Found 130 backup files
2024-04-03 21:51:55.891 ERROR (MainThread) [supervisor.backups.backup] Can't read backup tarfile /data/mounts/diensten/71881649.tar: unexpected end of data
2024-04-03 21:52:00.408 INFO (MainThread) [supervisor.backups.manager] Found 130 backup files
2024-04-03 21:52:01.019 ERROR (MainThread) [supervisor.backups.backup] Can't read backup tarfile /data/mounts/diensten/71881649.tar: unexpected end of data
2024-04-03 21:52:02.029 INFO (MainThread) [supervisor.backups.manager] Found 130 backup files
2024-04-03 21:52:02.624 ERROR (MainThread) [supervisor.backups.backup] Can't read backup tarfile /data/mounts/diensten/71881649.tar: unexpected end of data
2024-04-03 21:52:12.207 INFO (MainThread) [supervisor.api.middleware.security] /supervisor/info access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:12.218 INFO (MainThread) [supervisor.api.middleware.security] /backups access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:12.434 INFO (MainThread) [supervisor.api.middleware.security] /backups/01caa85b/info access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:12.494 INFO (MainThread) [supervisor.api.middleware.security] /supervisor/info access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:12.503 INFO (MainThread) [supervisor.api.middleware.security] /backups access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:13.468 INFO (MainThread) [supervisor.api.middleware.security] /backups/01caa85b access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:13.482 INFO (MainThread) [supervisor.backups.manager] Removed backup file 01caa85b
2024-04-03 21:52:13.495 INFO (MainThread) [supervisor.api.middleware.security] /backups/4f08bbfa access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:13.502 ERROR (MainThread) [supervisor.backups.manager] Can't remove backup 4f08bbfa: [Errno 13] Permission denied: '/data/mounts/diensten/4f08bbfa.tar'
2024-04-03 21:52:23.553 INFO (MainThread) [supervisor.api.middleware.security] /supervisor/info access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:23.567 INFO (MainThread) [supervisor.api.middleware.security] /backups access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:23.795 INFO (MainThread) [supervisor.api.middleware.security] /backups/4f08bbfa/info access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:23.808 INFO (MainThread) [supervisor.api.middleware.security] /supervisor/info access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:23.816 INFO (MainThread) [supervisor.api.middleware.security] /backups access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:24.375 INFO (MainThread) [supervisor.api.middleware.security] /backups/4f08bbfa access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:24.380 ERROR (MainThread) [supervisor.backups.manager] Can't remove backup 4f08bbfa: [Errno 13] Permission denied: '/data/mounts/diensten/4f08bbfa.tar'
2024-04-03 21:52:31.440 INFO (MainThread) [supervisor.api.middleware.security] /supervisor/info access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:31.448 INFO (MainThread) [supervisor.api.middleware.security] /backups access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:31.675 INFO (MainThread) [supervisor.api.middleware.security] /backups/4f08bbfa/info access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:32.269 INFO (MainThread) [supervisor.api.middleware.security] /backups/4f08bbfa access from cebe7a76_hassio_google_drive_backup
2024-04-03 21:52:32.272 ERROR (MainThread) [supervisor.backups.manager] Can't remove backup 4f08bbfa: [Errno 13] Permission denied: '/data/mounts/diensten/4f08bbfa.tar'
2024-04-03 21:52:41.064 INFO (MainThread) [supervisor.api.middleware.security] /supervisor/logs access from cebe7a76_hassio_google_drive_backup
Home Assistant Core Logs:
     data = data.decode()
           ^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x86 in position 11: invalid start byte
2024-04-03 21:52:37.458 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback _SelectorDatagramTransport._read_ready()
Traceback (most recent call last):
  File "/config/custom_components/localtuya/discovery.py", line 65, in datagram_received
    data = decrypt_udp(data)
           ^^^^^^^^^^^^^^^^^
  File "/config/custom_components/localtuya/discovery.py", line 30, in decrypt_udp
    return _unpad(decryptor.update(message) + decryptor.finalize()).decode()
                                              ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/base.py", line 184, in finalize
    data = self._ctx.finalize()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 223, in finalize
    raise ValueError(
ValueError: The length of the provided data is not a multiple of the block length.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 1238, in _read_ready
    self._protocol.datagram_received(data, addr)
  File "/config/custom_components/localtuya/discovery.py", line 67, in datagram_received
    data = data.decode()
           ^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8d in position 10: invalid start byte
sabeechen commented 2 months ago

From your supervisor logs:

�[31m2024-04-03 21:52:02.624 ERROR (MainThread) [supervisor.backups.backup] Can't read backup tarfile /data/mounts/diensten/71881649.tar: unexpected end of data

Something is wrong with your network mount. So many things can go wrong with a network mount, I'm unable to provide support. You'll either need to sort out its access or store your HA Backus on the HA machine

guidostek commented 2 months ago

Found the cause, sorry for the inconvenience! Thanks for the response!

Op za 6 apr. 2024 17:32 schreef Stephen Beechen @.***>:

From your supervisor logs:

�[31m2024-04-03 21:52:02.624 ERROR (MainThread) [supervisor.backups.backup] Can't read backup tarfile /data/mounts/diensten/71881649.tar: unexpected end of data

Something is wrong with your network mount. So many things can go wrong with a network mount, I'm unable to provide support. You'll either need to sort out its access or store your HA Backus on the HA machine

— Reply to this email directly, view it on GitHub https://github.com/sabeechen/hassio-google-drive-backup/issues/1019#issuecomment-2041119397, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQXIYZ4NADSGJSFXCT6PLTY4AIQ3AVCNFSM6AAAAABFV67GCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBRGEYTSMZZG4 . You are receiving this because you authored the thread.Message ID: @.***>