Extracting (Unpack) Backup file in OpenWrt 24.10 series

Hi,
I am using OpenWrt for some time, with few previous versions. In all versions before 24.10, I been generating Backup file in, which is by default provided in TAR.GZ format.

If needed, I could extract backup file and read content of each file from there.

This worked well untill 23.05. After upgrading to 24.10, none of the files extracting now. I am using macOS and build in extracter, tried as well with The Unarchiver and Keka. None of the files are exteactable now.

Typically TAR.GZ extract files, but now its just generating folder with TAR file, and TAR file cannot be further extracted.

Same bahaviour on

Does something changed how backup is generated?
How to extract now?

The issue reported when doing extraction in terminal:

tar: Error opening archive: Unrecognized archive format

As I open extracted TAR file (that cannot be further extracted) and opened it in VSCodium Text Editor, I see the content of all files.

What browser are you using to download the backup file. Safari may be stripping the .gz from the download if you allow it to open “safe” files. This could cause the behavior you are experiencing.

1 Like

Safari, but my do not act like that, as I disabled that (this "safe" feature),
but I checked in DuckDuckGo and Google Chrome, same bahaviour.

I don't use "MacOs", sorry I don't have it ... (but it should be similar to linux)

if you open a terminal and give the command:

file your_file_backup.tar.gz; # you will need to move to the directory containing the file

what does he say?

https://stackoverflow.com/questions/51689294/how-to-extract-tar-file-in-mac-terminal

backup-MX4200v2-2025-06-30.tar.gz: gzip compressed data, from Unix, original size modulo 2^32 895035

I tried to unpack it on Windows 11 with 7zip, and not possible.

let's try to do everything from "MacOs" (into terminal) if you give the command:

ps: be careful it extracts it in the directory where it is, if work ...

tar -xzf backup-MX4200v2-2025-06-30.tar.gz

what from?

if it doesn't work try the command:

gunzip -d backup-MX4200v2-2025-06-30.tar.gz

For what its worth, I just performed a backup from one of my OpenWrt devices, via Safari on Mac and I had no problem whatsoever opening the tar.gz file that resulted.

Tested on a Mac Mini M4 Pro with Sequoia 15.5. I don't have the Unarchiver app installed on this machine, but I extracted the files in two different ways.

  • Double click on tar.gz file
  • CLI tar -xvf <basefilename>.tar.gz

The source was an OpenWrt 24.10.2 device.

1 Like

Any way we can investigate further, as got 2 devices behaving like that?

It seems likely that your situation may be related to your specific configuration. To start, let's see the output of:

ubus call system board
cat /etc/sysupgrade.conf

ubus call system board

{
	"kernel": "6.6.93",
	"hostname": "MX4200v2",
	"system": "ARMv8 Processor rev 4",
	"model": "Linksys MX4200v2",
	"board_name": "linksys,mx4200v2",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "24.10.2",
		"revision": "r28739-d9340319c6",
		"target": "qualcommax/ipq807x",
		"description": "OpenWrt 24.10.2 r28739-d9340319c6",
		"builddate": "1750711236"
	}
}

cat /etc/sysupgrade.conf

## This file contains files and directories that should
## be preserved during an upgrade.

# /etc/example.conf
# /etc/openvpn/
/etc/ssl/
/etc/wireguard/
/etc/cloudflared/
/etc/sysctl.d/
/etc/init.d/
/etc/config/
/etc/init.d/
/root/

but also tried with default

## This file contains files and directories that should
## be preserved during an upgrade.

# /etc/example.conf
# /etc/openvpn/

There are some unusual/non-standard things included in your backup... the one that raises eyebrows is this one:

Normally all of the wireguard configs live inside the /etc/config/network file.

The rest are just not necessary to backup unless there are specific additions/edits you've made to those files that might not be picked up in a normal backup.

All that said....

and it still didn't work??

I have just run backups on 2 more devices and unpacked them with a simple double-click on my Mac. No issues whatsoever. (all of the devices are running 24.10.2). I've attached one of the devices' backups (it's a completely default config, no personal information) -- try downloading it and see if your computer opens it. If it doesn't open, something is wrong on your Mac. (and if it does open, that suggests something is wrong with your OpenWrt device.)

backup-OpenWrt-2025-06-23.tar.gz (6.9 KB)

Hi,
Your is extracting correctly.

My issue is not OS specific as I am struggling to unpack it on Windows 11 as well.

I will check 2nd device that I am using, and got the same problem on 24.10, over next few days, and will let know.

It is good that we've now eliminated Mac/Windows from the equation.

The file I provided is from 24.10.2, just as yours. So there's no obvious reason why yours is creating invalid files while mine is okay.

Probably more important will be to understand the details of your devices. Specifically, have you added packages and/or removed any? And what have you changed in your configs that would be less common?

Critically, can OpenWrt read the file it created to restore your config?

I just reset askey rt4230w-rev6 and tried various things, installing various packages and doing things that I am typically doing or intalling on main device, and backup is working well, no issues.

I struggling to understand whats wrong.

I think its something that I installed/added manually to router that causing this on my device.

I will try to re-set and setup all again and see at what stage is generating corrupted backup file.

I will need to investigate how to generate backup from terminal rather than luci do see if thats throing any errors.

So far, tried to generate backuo using advised terminal command

# Generate backup
umask go=
sysupgrade -b /tmp/backup-${HOSTNAME}-$(date +%F).tar.gz
ls /tmp/backup-*.tar.gz

and unpack it using tar zxvf ... and got

# tar -zxvf backup-MX4200v2-2025-07-03.tar.gz 
tar: invalid tar magic

installed tar package opkg install tar

and now got

root@MX4200v2:/tmp/test# tar -zxvf backup-MX4200v2-2025-07-03.tar.gz 
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors

and thats directly on the router.


May be related?

as stated here

This command:

sysupgrade -l | tar -czf backup.tar.gz -T -

Produce backup in valid TAR.GZ that can be extracted correctly.

Strange.

1 Like

Hi All,

I got new device, Flint 2 (GL-MT6000).

I been doing random test

  1. install openwrt
  2. login and set name
  3. set password - checked, backup generated ok
  4. change ssh to 9922 - backup ok
  5. set wifi name, country, channel auto, encryption wpa2, saved and applied settings - tried generate backup, backup generated corrupted

I am not sure whats going on, but this cannot be a coincidence.

The funny part is, that I can reset to default, repeat steps and do not got that issue untill some other point. Crazy!

How did you generate the backup? If with a browser, what browser/OS? What are the specific symptoms (i.e. can't restore to your router? won't extract at all or messed up files after extraction --- how are you extracting)?

Are you running the GL-inet firmware or did you install official OpenWrt (downloaded from OpenWrt.org)?

Not related, but why?

1 Like

As mentioned earlier, throigh Luci panel (using Chrome): System > Backup / Flash Firmware > Generate Archive.

But, as already [mentioned]( Extracting (Unpack) Backup file in OpenWrt 24.10 series - #15 by idarek ), I can generate it from terminal with same output.

Yes, the file is corrupted so cannot use it to restore.

Instead of extracting with folders, like /root /etc, the extraction generate one useless file.

We went through that already in conversation. I can use plenty of ways to extrac, including doing it directly on the router with terminal. Same issues.

The problem is that this issue is hard to replicate. On my recent device (Flint 2) I do some basic setup of wifi and lan IP than noticed that backup is corrupted. I reset to factory settings and setup again, and only after some advance steps, the backup becomes corrupted. Its really hard to find at what stage and whats causing it.

No, OpenWrt.

My preference.

Do you have any custom packages installed on your OpenWrt setup? Or are you changing anything in the backup routines (specifically around the items that are saved)?

Yes, but I don’t find that as a main cause as first time I got corrupted backup on Flint 2 when I just do this steps.

  1. reset to factory settings
  2. login, set password, change router name and set timezone
  3. change LAN default ip form 192.168.1.1
  4. set wifi country code, channels, network names and encryption
  5. set ssh port
  6. set DNS for Lan, wan and wan 6

After that I generated backp and it was already corrupted (nothing added to backup routine at this stage yet).

I do factory reset, and could get that issue again at that stage.

The issue happen when I haven’t used opkg at all or install any external package. This would explain that something causing it.

I am baffled, a not been able to replicate it at exactly same time is guessing what could probably causing it.