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