Writing GPT backup header failed: error on restore

Hello, I’m trying to debug an issue restoring a Windows 10 image.
The main issue is that the GPT table is not restoring correctly with the urbackuprestoreclient

First of all, version of urbackuprestoreclient is

UrBackup Client Backend v2.5.25.0

This is the MBR file that I’m trying to restoring
Image_C_240108-1200.vhdz.zip (689 Bytes)

When I run the

urbackuprestoreclient --restore-mbr Image_C_240108-1200.vhdz.mbr -o /dev/nvme2n1

I got this error:

2024-06-18 13:41:02: Writing MBR data...
2024-06-18 13:41:02: done.
2024-06-18 13:41:02: Writing GPT header...
2024-06-18 13:41:02: Writing GPT table...
2024-06-18 13:41:02: Writing GPT backup header...
2024-06-18 13:41:02: ERROR: Writing GPT backup header failed. No space left on device (code: 28)
2024-06-18 13:41:02: Writing GPT backup table...
2024-06-18 13:41:02: ERROR: Writing backup GPT table failed. No space left on device (code: 28)

So then if i’m also checking the partition with sfdisk, this is the result

label: gpt
label-id: EB604E84-18D9-754F-88D5-7E8E176FB883
device: /dev/nvme2n1
unit: sectors
first-lba: 2048
last-lba: 500118158

Searching on the forum, I saw that the backup table is not important, but at the end Windows 10 doesn’t boot up (blue screen at boot), so for sure is not the only issue (the partition table is empty indeed)

Instead the original GPT table is this one

label: gpt
label-id: 6293F990-B3B4-423D-B501-12BA189115D4
device: /dev/nvme2n1
unit: sectors
first-lba: 34
last-lba: 500118158

/dev/nvme2n1p1 : start=        2048, size=     1021952, type=DE94BBA4-06D1-4D40-A16A-BFD50179D6AC, uuid=042D4D55-18B1-43E2-9282-9DE503A4EB2F, name="Basic data partition"
/dev/nvme2n1p2 : start=     1024000, size=      204800, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=7C889618-446A-4934-AB5B-0B08E6026031, name="EFI system partition"
/dev/nvme2n1p3 : start=     1228800, size=       32768, type=E3C9E316-0B5C-4DB8-817D-F92DF00215AE, uuid=D7C18637-03F8-4458-9A67-4CB328CCFC1B, name="Microsoft reserved partition"
/dev/nvme2n1p4 : start=     1261568, size=   498856591, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=8AEF1E21-46B9-46C4-8DE7-73DD79B65129, name="Basic data partition"

And if i’m restoring it with

sudo sfdisk /dev/sdX < backup.txt

everything works.

Is it a known bug so?
Thanks

@uroni i guess here urbackup_backend/urbackupclient/client_restore.cpp at 43a178e138e349f689975c749fe4d1a1c3971724 · uroni/urbackup_backend · GitHub

you should replace false with true as you did here urbackup_backend/urbackupclient/client_restore_http.cpp at 43a178e138e349f689975c749fe4d1a1c3971724 · uroni/urbackup_backend · GitHub

?

I’m trying this solution in the mean time and I will keep posted

pull request here do_restore_write_mbr without fixing_gpt flag by cagnulein · Pull Request #104 · uroni/urbackup_backend · GitHub