Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New backup format in latest supervisor breaks partial restore #4909

Open
boesing opened this issue Feb 21, 2024 · 14 comments
Open

New backup format in latest supervisor breaks partial restore #4909

boesing opened this issue Feb 21, 2024 · 14 comments

Comments

@boesing
Copy link
Contributor

boesing commented Feb 21, 2024

Describe the issue you are experiencing

Hey there,

I have a full backup which I do want to restore. Due to its sheer size, I did a normal setup, installed the SSH addon and uploaded the backup to the backup folder via SCP.

I was able to select that backup to restore my machine, but the addon which takes the biggest amount of space was not restored (which is my timescaledb). So somehow, the whole machine was restored and most of the stuff is running besides those integrations depending on the database (which is within the timescaledb addon which was not restored).

Now I can at least use most of my integrations, etc. but I want to restore my addon. So what I tried was to partially restore the addon only now, since all the other stuff is already properly setupped.

When I try to partially restore, I get an error during after quite some time which tells me to have a look in the supervisor logs.
I've attached these log lines below.

Please note that it is the exact same backup which does restore all the other stuff, so I have absolutely no clue what that means "not a gzipped file" as it is definitely a GZIP file...

→ file WeeklyBackup_Monday_February_19_2024.tar 
WeeklyBackup_Monday_February_19_2024.tar: POSIX tar archive

Any ideas on what I can do to restore my (fairly big addon) backup?

What type of installation are you running?

Home Assistant OS

Which operating system are you running on?

Home Assistant Operating System

Steps to reproduce the issue

  1. Upload backup file
  2. Restore partial backup of a single addon

Anything in the Supervisor logs that might be useful for us?

24-02-21 00:40:21 INFO (MainThread) [supervisor.backups.manager] Restore 6f9a38c5 starting stage addons
24-02-21 00:41:34 ERROR (MainThread) [supervisor.jobs] Unhandled exception: Not a gzipped file (b'V\x88')
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/jobs/decorator.py", line 304, in wrapper
    return await self._method(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 1196, in restore
    await self.sys_run_in_executor(_extract_tarfile)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 1189, in _extract_tarfile
    backup.extractall(
  File "/usr/local/lib/python3.12/tarfile.py", line 2259, in extractall
    for member in members:
  File "/usr/local/lib/python3.12/site-packages/securetar/__init__.py", line 153, in secure_path
    for member in tar:
  File "/usr/local/lib/python3.12/tarfile.py", line 2748, in __iter__
    tarinfo = self.next()
              ^^^^^^^^^^^
  File "/usr/local/lib/python3.12/tarfile.py", line 2635, in next
    raise e
  File "/usr/local/lib/python3.12/tarfile.py", line 2608, in next
    tarinfo = self.tarinfo.fromtarfile(self)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/tarfile.py", line 1296, in fromtarfile
    return obj._proc_member(tarfile)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/tarfile.py", line 1318, in _proc_member
    return self._proc_pax(tarfile)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/tarfile.py", line 1404, in _proc_pax
    buf = tarfile.fileobj.read(self._block(self.size))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/gzip.py", line 324, in read
    return self._buffer.read(size)
           ^^^^^^^^^^^^^^^^^^^^^^^
gzip.BadGzipFile: Not a gzipped file (b'V\x88')
24-02-21 00:41:34 WARNING (MainThread) [supervisor.backups.backup] Can't restore Add-on 77b2833f_timescaledb:

System Health information

System Information

version core-2024.2.1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.1
os_name Linux
os_version 6.1.63-haos-raspi
arch armv7l
timezone Europe/Berlin
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4687
Installed Version 1.34.0
Stage running
Available Repositories 1408
Downloaded Repositories 59
Home Assistant Cloud
logged_in true
subscription_expiration November 25, 2024 at 01:00
relayer_connected true
relayer_region eu-central-1
remote_enabled true
remote_connected true
alexa_enabled false
google_enabled true
remote_server eu-central-1-3.ui.nabu.casa
certificate_status ready
instance_id eb256d7ff1c248eab51dce9cb69db7e1
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 11.5
update_channel stable
supervisor_version supervisor-2024.01.1
agent_version 1.6.0
docker_version 24.0.7
disk_total 228.5 GB
disk_used 11.7 GB
healthy true
supported true
board rpi4
supervisor_api ok
version_api ok
installed_addons Advanced SSH & Web Terminal (17.1.0), Node-RED (17.0.7), Zigbee2MQTT (1.35.3-1), Mosquitto broker (6.4.0), pgAdmin4 (3.0.1)
Dashboards
dashboards 7
resources 41
views 42
mode storage

Supervisor diagnostics

config_entry-hassio-95fec82dcd96f58467255ee49ee0f874.json

Additional information

I was able to restore a kinda similar large backup (also 6GB) back in december. I haven't tried that backup file yet, might do that somewhat later, but it is probably not a size problem.

@boesing boesing added the bug label Feb 21, 2024
@boesing
Copy link
Contributor Author

boesing commented Feb 21, 2024

hm, somehow, a supervisor update from february 16th popped up where the backup Format was changed. could be related to my issue. testing this today.

@boesing
Copy link
Contributor Author

boesing commented Feb 21, 2024

Still same error. I was already wondering that there were no changes to the restore logic in the PR where the backup Format changed.

is that related? can some1 verify?

@boesing boesing changed the title Unable to restore 6GB backup to new machine New backup format in latest supervisor breaks partial restore Feb 22, 2024
@standsed
Copy link

standsed commented Mar 9, 2024

Core 2024.3.0
Supervisor 2024.02.1
Operating System 12.0
Frontend 20240306.0

I got "Not a gzipped file" error thrown in supervisor when tried full restore. Partial backup on another hand worked (upload was done via front-end) and I was able to restore to an earlier addon versions.
Backups were created via front-end and downloaded as tar archives.

@bdraco
Copy link
Member

bdraco commented Mar 9, 2024

This looks like a duplicate of #4924

Did you do the backup with 2024.02.1 or 2024.02.0 ?

@standsed
Copy link

standsed commented Mar 9, 2024

From tar archive's backup.json

  "supervisor_version": "2023.11.6",
...
  "homeassistant": {
    "version": "2023.5.2",
    "exclude_database": false,
    "size": 532.21
  },
  "compressed": true,

@bdraco
Copy link
Member

bdraco commented Mar 9, 2024

That looks like a different problem since 2023.11.6 didn't have any of the newer changes

@lecourtb
Copy link

lecourtb commented Mar 9, 2024

I got same problem (same supervisor logs), backups march 06 and january 22 (20224) cannot be restored using HA OS 12.0

Configuration: RPi4 32 bits, the backup .tar size os about 3.7GB.

The tar file is healthy, I can read it.

@lecourtb
Copy link

lecourtb commented Mar 10, 2024

I also noticed I can't restore previous backup as (I suppose) supervisor cannot be downgraded (even one with size 1.7GB from june 2023 and HAOS 10.2).

Too bad, my HA is down, I am going to try a manual restore.

@agners
Copy link
Member

agners commented Mar 11, 2024

I also noticed I can't restore previous backup as (I suppose) supervisor cannot be downgraded (even one with size 1.7GB from june 2023 and HAOS 10.2).

Restoring a newer backup on a older Supervisor is prevented, but the reverse should not be prevented. So, restoring your backup from June 2023 should work. What is the error in that case?

I got same problem (same supervisor logs), backups march 06 and january 22 (20224) cannot be restored using HA OS 12.0

Did you upload the Backup in some way to that instance? Maybe a corruption during upload? 🤔

@lecourtb
Copy link

What I can say is I was able to restore backups from march 06 and january 22 2024 in a VM for virtual box (Windows).
The error I got when restoring march 06 backup on RPI4/32 was:
gzip.BadGzipFile: Not a gzipped file
Yes perhaps there was a curruption while uploading, but I tried two times.
Sorry, I didn't catch the error with the backup from june 2023.
Anyway, I plan to by a NUC with PROXMOX to have backups more robust !

@boesing
Copy link
Contributor Author

boesing commented Mar 15, 2024

I do not think that it is a currupted file. I had this for partially restoring from a full backup. restoring the backup as a whole works besides the timescaledb addon where I had the issue mentioned above. since that postgres holds my whole homeassistant entity states, that addon is huge and thus it seems to not properly restore. Thats why I wanted to restore only that addon as a partial restore...

Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Apr 14, 2024
@eopo
Copy link

eopo commented Apr 20, 2024

Same issue for me:

2024-04-20 21:04:04.715 INFO (MainThread) [supervisor.backups.manager] Partial-Restore 26b10a15 start
2024-04-20 21:05:42.231 INFO (MainThread) [supervisor.backups.manager] Restore 26b10a15 starting stage docker_config
2024-04-20 21:05:42.433 INFO (MainThread) [supervisor.backups.manager] Restore 26b10a15 starting stage addon_repositories
2024-04-20 21:05:43.968 INFO (MainThread) [supervisor.store] Loading add-ons from store: 77 all - 0 new - 0 remove
2024-04-20 21:05:43.969 INFO (MainThread) [supervisor.backups.manager] Restore 26b10a15 starting stage addons
2024-04-20 21:06:14.611 WARNING (MainThread) [supervisor.addons.options] Option 'dark_mode' does not exist in the schema for Node-RED (a0d7b954_nodered)
2024-04-20 21:06:14.611 WARNING (MainThread) [supervisor.addons.options] Option 'require_ssl' does not exist in the schema for Node-RED (a0d7b954_nodered)
2024-04-20 21:06:14.624 WARNING (MainThread) [supervisor.addons.options] Option 'interface' does not exist in the schema for Samba share (core_samba)
2024-04-20 21:07:53.453 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
2024-04-20 21:11:14.622 WARNING (MainThread) [supervisor.addons.options] Option 'dark_mode' does not exist in the schema for Node-RED (a0d7b954_nodered)
2024-04-20 21:11:14.622 WARNING (MainThread) [supervisor.addons.options] Option 'require_ssl' does not exist in the schema for Node-RED (a0d7b954_nodered)
2024-04-20 21:11:14.636 WARNING (MainThread) [supervisor.addons.options] Option 'interface' does not exist in the schema for Samba share (core_samba)
2024-04-20 21:11:32.536 ERROR (MainThread) [supervisor.jobs] Unhandled exception: Not a gzipped file (b'\xfc\xf8')
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/jobs/decorator.py", line 303, in wrapper
    return await self._method(obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 1244, in restore
    await self.sys_run_in_executor(_extract_tarfile)
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 1237, in _extract_tarfile
    backup.extractall(
  File "/usr/local/lib/python3.12/tarfile.py", line 2260, in extractall
    for member in members:
  File "/usr/local/lib/python3.12/site-packages/securetar/__init__.py", line 285, in secure_path
    for member in tar:
  File "/usr/local/lib/python3.12/tarfile.py", line 2750, in __iter__
    tarinfo = self.next()
              ^^^^^^^^^^^
  File "/usr/local/lib/python3.12/tarfile.py", line 2637, in next
    raise e
  File "/usr/local/lib/python3.12/tarfile.py", line 2610, in next
    tarinfo = self.tarinfo.fromtarfile(self)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/tarfile.py", line 1297, in fromtarfile
    return obj._proc_member(tarfile)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/tarfile.py", line 1319, in _proc_member
    return self._proc_pax(tarfile)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/tarfile.py", line 1405, in _proc_pax
    buf = tarfile.fileobj.read(self._block(self.size))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/gzip.py", line 324, in read
    return self._buffer.read(size)
           ^^^^^^^^^^^^^^^^^^^^^^^
gzip.BadGzipFile: Not a gzipped file (b'\xfc\xf8')
2024-04-20 21:11:32.541 WARNING (MainThread) [supervisor.backups.backup] Can't restore Add-on core_mariadb: 

The actual structure looks like that:

addon_core_mariadb_2_6_1.tar
- backup.json
- core_mariadb.tar.gz
- - addon.json
- - options.json
- - secret
- - databases
- - - ...

I also tried to re-compress the backup and upload it, without success.

@github-actions github-actions bot removed the stale label Apr 20, 2024
Copy link

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by adding a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants