sabeechen / hassio-google-drive-backup

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

Can't delete a missing backup #862

Closed manofpants closed 1 year ago

manofpants commented 1 year ago
Description:

Addon version: 0.110.4 Home Assistant Version: 2023.6.0 Supervisor Version: 2023.06.1 Supervisor Channel: stable Hassos Version: 10.2 Docker Version: 23.0.6 Architecture: armv7 Machine: raspberrypi3 Date: 2023-06-12T19:31:57.416552+00:00 Timezone: America/New_York Failure Time: 2023-06-12T19:30:50.711622+00:00 Last Good Sync: 2023-06-12T19:30:49.786697+00:00 Next Sync: 2023-06-12T21:30:50.711622+00:00 Next Backup: 2023-06-14T04:00:00+00:00 Next Cache Warm: 2023-06-12T21:17:17.357569+00:00 Time Offset: 0.0

Exception:

  addon/backup/ha/harequests.py:100 (delete)
  addon/backup/ha/harequests.py:33 (wrap_and_call)
  addon/backup/ha/harequests.py:263 (_sendHassioData)
  addon/backup/ha/harequests.py:208 (_validateHassioReply)
  /site-packages/aiohttp/client_reqrep.py:1005 (raise_for_status)
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('http://supervisor/backups/f0d6690f')
Whose handling caused:
  addon/backup/model/coordinator.py:198 (_sync)
  addon/backup/model/model.py:206 (sync)
  addon/backup/model/model.py:378 (_purge)
  addon/backup/model/model.py:275 (deleteBackup)
  addon/backup/ha/hasource.py:335 (delete)
  addon/backup/ha/harequests.py:33 (wrap_and_call)
  addon/backup/ha/harequests.py:106 (delete)
backup.exceptions.exceptions.HomeAssistantDeleteError

Backups:

 {
    "HomeAssistant": {
        "backups": 3,
        "retained": 0,
        "deletable": 3,
        "name": "HomeAssistant",
        "title": "Home Assistant",
        "latest": "2023-06-12T04:00:00Z",
        "max": 2,
        "enabled": true,
        "icon": "home-assistant",
        "ignored": 0,
        "detail": "",
        "size": "400.4 MB",
        "ignored_size": "0.0 B",
        "free_space": "7.3 GB"
    },
    "GoogleDrive": {
        "backups": 9,
        "retained": 2,
        "deletable": 7,
        "name": "GoogleDrive",
        "title": "Google Drive",
        "latest": "2023-06-10T04:00:01Z",
        "max": 8,
        "enabled": true,
        "icon": "google-drive",
        "ignored": 0,
        "detail": "manofpants@gmail.com",
        "size": "2.2 GB",
        "ignored_size": "0.0 B",
        "free_space": "1.8 TB"
    }
}
Config:
 {
    "Setting.MAX_BACKUPS_IN_HA": 2,
    "Setting.MAX_BACKUPS_IN_GOOGLE_DRIVE": 8,
    "Setting.DAYS_BETWEEN_BACKUPS": 2.0,
    "Setting.BACKUP_TIME_OF_DAY": "00:00",
    "Setting.SEND_ERROR_REPORTS": true
}
Addon Logs:
 06-12 10:50:02 INFO [backup.model.coordinator] Syncing Backups
06-12 10:50:03 INFO [backup.ha.hasource] Deleting 'test' from Home Assistant
06-12 10:50:03 ERROR [backup.model.coordinator] Home Assistant refused to delete the backup.
06-12 10:50:03 INFO [backup.model.coordinator] I'll try again in 2 hours
06-12 11:06:49 ERROR [backup.ha.haupdater] Unable to reach Home Assistant (HTTP 502).  This is normal if Home Assistant is restarting.  You will probably see some errors in the supervisor logs until it comes back online.
06-12 12:42:30 DEBUG [backup.model.destinationprecache] Preemptively retrieving and caching info from the backup destination to avoid peak demand
06-12 12:42:31 DEBUG [backup.drive.driverequests] Requesting refreshed Google Drive credentials
06-12 12:50:03 DEBUG [backup.model.syncer] Sync requested by Coordinator
06-12 12:50:03 INFO [backup.model.coordinator] Syncing Backups
06-12 12:50:03 INFO [backup.ha.hasource] Deleting 'test' from Home Assistant
06-12 12:50:03 ERROR [backup.model.coordinator] Home Assistant refused to delete the backup.
06-12 12:50:03 INFO [backup.model.coordinator] I'll try again in 2 hours
06-12 14:36:32 DEBUG [backup.model.destinationprecache] Preemptively retrieving and caching info from the backup destination to avoid peak demand
06-12 14:36:32 DEBUG [backup.drive.driverequests] Requesting refreshed Google Drive credentials
06-12 14:50:03 DEBUG [backup.model.syncer] Sync requested by Coordinator
06-12 14:50:03 INFO [backup.model.coordinator] Syncing Backups
06-12 14:50:03 INFO [backup.ha.hasource] Deleting 'test' from Home Assistant
06-12 14:50:03 ERROR [backup.model.coordinator] Home Assistant refused to delete the backup.
06-12 14:50:03 INFO [backup.model.coordinator] I'll try again in 2 hours
06-12 15:30:49 INFO [backup.model.coordinator] Syncing Backups
06-12 15:30:50 INFO [backup.ha.hasource] Deleting 'test' from Home Assistant
06-12 15:30:50 ERROR [backup.model.coordinator] Home Assistant refused to delete the backup.
06-12 15:30:50 INFO [backup.model.coordinator] I'll try again in 2 hours
06-12 15:31:26 INFO [backup.drive.drivesource] Deleting 'test' From Google Drive
06-12 15:31:29 INFO [backup.ha.hasource] Deleting 'test' from Home Assistant
06-12 15:31:29 ERROR [backup.ui.uiserver] Error serving POST http://10.0.0.29:8123/deleteSnapshot
06-12 15:31:30 ERROR [backup.ui.uiserver] 
  addon/backup/ha/harequests.py:100 (delete)
  addon/backup/ha/harequests.py:33 (wrap_and_call)
  addon/backup/ha/harequests.py:263 (_sendHassioData)
  addon/backup/ha/harequests.py:208 (_validateHassioReply)
  /site-packages/aiohttp/client_reqrep.py:1005 (raise_for_status)
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('http://supervisor/backups/f0d6690f')
Whose handling caused:
  addon/backup/ui/uiserver.py:771 (error_middleware)
  addon/backup/ui/uiserver.py:300 (deleteSnapshot)
  addon/backup/model/coordinator.py:293 (delete)
  addon/backup/model/coordinator.py:351 (_withSoftLock)
  addon/backup/model/coordinator.py:302 (_delete)
  addon/backup/ha/hasource.py:335 (delete)
  addon/backup/ha/harequests.py:33 (wrap_and_call)
  addon/backup/ha/harequests.py:106 (delete)
backup.exceptions.exceptions.HomeAssistantDeleteError

06-12 15:31:36 INFO [backup.ha.hasource] Deleting 'test' from Home Assistant
06-12 15:31:36 ERROR [backup.ui.uiserver] Error serving POST http://10.0.0.29:8123/deleteSnapshot
06-12 15:31:36 ERROR [backup.ui.uiserver] 
  addon/backup/ha/harequests.py:100 (delete)
  addon/backup/ha/harequests.py:33 (wrap_and_call)
  addon/backup/ha/harequests.py:263 (_sendHassioData)
  addon/backup/ha/harequests.py:208 (_validateHassioReply)
  /site-packages/aiohttp/client_reqrep.py:1005 (raise_for_status)
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('http://supervisor/backups/f0d6690f')
Whose handling caused:
  addon/backup/ui/uiserver.py:771 (error_middleware)
  addon/backup/ui/uiserver.py:300 (deleteSnapshot)
  addon/backup/model/coordinator.py:293 (delete)
  addon/backup/model/coordinator.py:351 (_withSoftLock)
  addon/backup/model/coordinator.py:302 (_delete)
  addon/backup/ha/hasource.py:335 (delete)
  addon/backup/ha/harequests.py:33 (wrap_and_call)
  addon/backup/ha/harequests.py:106 (delete)
backup.exceptions.exceptions.HomeAssistantDeleteError
Supervisor Logs:
 23-06-12 15:05:01 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.DNS_SERVER_IPV6_ERROR/ContextType.DNS_SERVER
23-06-12 15:05:01 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.MULTIPLE_DATA_DISKS/ContextType.SYSTEM
23-06-12 15:05:01 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.DOCKER_CONFIG/ContextType.SYSTEM
23-06-12 15:05:01 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.TRUST/ContextType.SUPERVISOR
23-06-12 15:05:01 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.DNS_SERVER_FAILED/ContextType.DNS_SERVER
23-06-12 15:05:01 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.IPV4_CONNECTION_PROBLEM/ContextType.SYSTEM
23-06-12 15:05:01 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.SECURITY/ContextType.CORE
23-06-12 15:05:01 INFO (MainThread) [supervisor.resolution.checks.base] Run check for IssueType.FREE_SPACE/ContextType.SYSTEM
23-06-12 15:05:01 INFO (MainThread) [supervisor.resolution.check] System checks complete
23-06-12 15:05:01 INFO (MainThread) [supervisor.resolution.evaluate] Starting system evaluation with state CoreState.RUNNING
23-06-12 15:05:02 INFO (MainThread) [supervisor.resolution.evaluate] System evaluation complete
23-06-12 15:05:02 INFO (MainThread) [supervisor.resolution.fixup] Starting system autofix at state CoreState.RUNNING
23-06-12 15:05:02 INFO (MainThread) [supervisor.resolution.fixup] System autofix complete
23-06-12 15:15:20 INFO (MainThread) [supervisor.host.info] Updating local host information
23-06-12 15:15:22 INFO (MainThread) [supervisor.host.services] Updating service information
23-06-12 15:15:22 INFO (MainThread) [supervisor.host.network] Updating local network information
23-06-12 15:15:23 INFO (MainThread) [supervisor.host.sound] Updating PulseAudio information
23-06-12 15:15:23 INFO (MainThread) [supervisor.host.manager] Host information reload completed
23-06-12 15:22:17 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
23-06-12 15:30:49 INFO (MainThread) [supervisor.api.middleware.security] /supervisor/info access from cebe7a76_hassio_google_drive_backup
23-06-12 15:30:49 INFO (MainThread) [supervisor.api.middleware.security] /backups access from cebe7a76_hassio_google_drive_backup
23-06-12 15:30:49 INFO (MainThread) [supervisor.api.middleware.security] /backups/f0d6690f/info access from cebe7a76_hassio_google_drive_backup
23-06-12 15:30:50 INFO (MainThread) [supervisor.api.middleware.security] /backups/f0d6690f access from cebe7a76_hassio_google_drive_backup
23-06-12 15:30:50 ERROR (MainThread) [supervisor.backups.manager] Can't remove backup f0d6690f: [Errno 2] No such file or directory: '/data/mounts/HA_backup/f0d6690f.tar'
23-06-12 15:30:58 INFO (MainThread) [supervisor.backups.manager] Found 2 backup files
23-06-12 15:30:59 INFO (MainThread) [supervisor.backups.manager] Found 2 backup files
23-06-12 15:31:29 INFO (MainThread) [supervisor.api.middleware.security] /backups/f0d6690f access from cebe7a76_hassio_google_drive_backup
23-06-12 15:31:36 INFO (MainThread) [supervisor.api.middleware.security] /backups/f0d6690f access from cebe7a76_hassio_google_drive_backup
23-06-12 15:31:57 INFO (MainThread) [supervisor.api.middleware.security] /supervisor/logs access from cebe7a76_hassio_google_drive_backup
Home Assistant Core Logs:
   File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 53, in get
    return await WebSocketHandler(request.app["hass"], request).async_handle()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 390, in async_handle
    await self._writer_task
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 141, in _writer
    await send_str(coalesced_messages)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_ws.py", line 308, in send_str
    await self._writer.send(data, binary=False, compress=compress)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 690, in send
    await self._send_frame(message, WSMsgType.TEXT, compress)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/http_websocket.py", line 659, in _send_frame
    await self.protocol._drain_helper()
  File "/usr/local/lib/python3.11/site-packages/aiohttp/base_protocol.py", line 90, in _drain_helper
    await asyncio.shield(waiter)
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1082, in _write_ready
    n = self._sock.send(self._buffer)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
BrokenPipeError: [Errno 32] Broken pipe
2023-06-12 15:10:03.219 WARNING (MainThread) [root] SinglePressType.CLASSIC
2023-06-12 15:12:22.785 WARNING (MainThread) [root] SinglePressType.CLASSIC
2023-06-12 15:18:31.846 ERROR (MainThread) [homeassistant.components.nws] Error requesting NWS forecast hourly station KSFB data: 500, message='Internal Server Error', url=URL('https://api.weather.gov/gridpoints/MLB/28,77/forecast/hourly')
2023-06-12 15:19:31.397 ERROR (MainThread) [homeassistant.components.nws] Error requesting NWS forecast station KSFB data: 500, message='Internal Server Error', url=URL('https://api.weather.gov/gridpoints/MLB/28,77/forecast')
sabeechen commented 1 year ago

Looks like its this line:

31m23-06-12 15:30:50 ERROR (MainThread) [supervisor.backups.manager] Can't remove backup f0d6690f: [Errno 2] No such file or directory: '/data/mounts/HA_backup/f0d6690f.tar'

Home Assistant can't find the file it expects on your share.

Is your mount up and accessible from HA? You could try deleting it from the Home Assistant interface, but I suspect that would fail too. You might need to restart to invalidate its cache. I'm not sure how HA reconciles the difference when one of the files it created isn't accessible or is changed on the server side.

manofpants commented 1 year ago

Hey thanks for the response. While I'm not sure what was the real problem, it turned out that an HAOS VM I thought was shut down was still up and throwing everything into chaos. Of course I can't see this issue anymore because I cleared it all up so I'm closing and will say I love this add-on :)