What is the "invalid backup GPT header, but valid main header" Message I receive when loading Android to eMMC via the MFGTool

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What is the "invalid backup GPT header, but valid main header" Message I receive when loading Android to eMMC via the MFGTool

7,567 Views
mdomondon
Contributor I

When I try to load the android images I have built for our android device, I get this error from the Serial Log:

UTP: received command '$ hdparm -z /dev/mmcblk3'
UTP: executing "hdparm -z /dev/mmcblk3"

/dev/mmcblk3:
re-reading partition table
Alternate GPT is invalid, using primary GPT.
mmcblk3: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11
UTP: sending Success to kernel for command $ hdparm -z /dev/mmcblk3.
utp_poll: pass returned.
UTP: received command '$ gdisk -l /dev/mmcblk3 '
UTP: executing "gdisk -l /dev/mmcblk3 "
GPT fdisk (gdisk) version 1.0.1

Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.

Warning! One or more CRCs don't match. You should repair the disk!

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: damaged

****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Disk /dev/mmcblk3: 14417920 sectors, 6.9 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 6BD25717-74A0-4DC6-9034-3E958FB68FE8
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 14050884
Partitions will be aligned on 2048-sector boundaries
Total free space is 3619 sectors (1.8 MiB)

Number Start (sector) End (sector) Size Code Name
1 2048 67583 32.0 MiB FFFF boot
2 67584 133119 32.0 MiB 8300 recovery
3 133120 3278847 1.5 GiB FFFF system
4 3278848 4327423 512.0 MiB FFFF cache
5 4327424 4343807 8.0 MiB FFFF device
6 4343808 4351999 4.0 MiB FFFF misc
7 4352000 4356095 2.0 MiB FFFF datafooter
8 4356096 4360191 2.0 MiB FFFF metadata
9 4360192 4362239 1024.0 KiB FFFF presistdata
10 4362240 14047231 4.6 GiB FFFF userdata
11 14047232 14049279 1024.0 KiB 0700 fbmisc
UTP: sending Success to kernel for command $ gdisk -l /dev/mmcblk3 .
utp_poll: pass returned.
UTP: received command 'send'
UTP: sending Success to kernel for command send.
UTP: received command '$ echo `gdisk -l /dev/mmcblk3 | grep -w boot | awk '{print $1}'` > /tmp/partIdx'
UTP: executing "echo `gdisk -l /dev/mmcblk3 | grep -w boot | awk '{print $1}'` > /tmp/partIdx"
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.

Warning! One or more CRCs don't match. You should repair the disk!

Even with the error above, the loading of the images completes successfully, and the Android OS loads properly as well. But I just want to know the cause of the error I am seeing. I am using my own partition-table.img which I modified via the device-partitions.bpt:

{
"settings": {
"disk_size": "6.7 GiB",
"disk_alignment": 1048576
},
"partitions": [
{
"label": "boot",
"size": "32 MiB",
"guid": "auto",
"offset": 0,
"type_guid": "bb499290-b57e-49f6-bf41-190386693794"
},
{
"label": "recovery",
"size": "32 MiB",
"guid": "auto",
"type_guid": "0fc63daf-8483-4772-8e79-3d69d8477de4"
},
{
"label": "system",
"size": "1536 MiB",
"guid": "auto",
"type_guid": "0f2778c4-5cc1-4300-8670-6c88b7e57ed6"
},
{
"label": "cache",
"size": "512 MiB",
"guid": "auto",
"type_guid": "aa3434b2-ddc3-4065-8b1a-18e99ea15cb7"
},
{
"label": "device",
"size": "8 MiB",
"guid": "auto",
"type_guid": "1fd63daf-8583-4772-8e79-3d69d8477de5"
},
{
"label": "misc",
"size": "4 MiB",
"guid": "auto",
"type_guid": "6b2378b0-0fbc-4aa9-a4f6-4d6e17281c47"
},
{
"label": "datafooter",
"size": "2 MiB",
"guid": "auto",
"type_guid": "314f99d5-b2bf-4883-8d03-e2f2ce507d6a"
},
{
"label": "metadata",
"size": "2 MiB",
"guid": "auto",
"type_guid": "b598858a-5fe3-418e-b8c4-824b41f4adfc"
},
{
"label": "presistdata",
"size": "1 MiB",
"guid": "auto",
"type_guid": "e99d84d7-2c1b-44cf-8c58-effae2dc2558"
},
{
"label": "userdata",
"grow": true,
"guid": "auto",
"type_guid": "0bb7e6ed-4424-49c0-9372-7fbab465ab4c"
},
{
"label": "fbmisc",
"size": "1 MiB",
"guid": "auto",
"type_guid": "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7"
}
]
}

The user capacity of our eMMC is 6.9 GB

Labels (2)
0 Kudos
3 Replies

5,819 Views
dwarakeshradhak
Contributor II

Hi Mike,

Generally there are 2 GPTs located. One at the beginning called primary GPT. While there is backup GPT at the end(this comes into picture if primary is corrupt. Thats why you see success in loading Android. But backup GPT should be made to match primary GPT, in case of primary is corrupt, it will stop booting).

Generally when you flash partition-table.img, it gets flashed in the primary GPT. So secondary GPT will be a mis-match.

Once MFGtool flashes, you can check if it has corrected the backup GPT, by typing in command line

# gdisk -l /dev/mmcblk3

Ideally MFGtool should do the following(I have not used it, so can't comment on it)

# echo -e 'r\ne\nY\nw\nY\nY' | gdisk /dev/mmcblk3

If not you can use the above command to correct it. Also see if you can add it to MFGTool(not sure though) scpriting

0 Kudos

5,819 Views
mdomondon
Contributor I

Hi,

Thanks for the reply. I tried adding in the command like you suggested:

<CMD state="Updater" type="push" body="$ echo -e 'r\\ne\\nY\\nw\\nY\\nY' |  gdisk /dev/mmcblk%mmc%">re-write back up gpt table</CMD>

But when I did, it looks like the command does not complete successfully. Loading the images vai the mfgtool failed. Below is a log snippet of the failure:

UTP: sending Success to kernel for command $ gdisk -l /dev/mmcblk3 .
utp_poll: pass returned.
UTP: received command '$ echo -e 'r\ne\nY\nw\nY\nY' | gdisk /dev/mmcblk3'
UTP: executing "echo -e 'r\ne\nY\nw\nY\nY' | gdisk /dev/mmcblk3"
GPT fdisk (gdisk) version 1.0.1

Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.

Warning! One or more CRCs don't match. You should repair the disk!

Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: damaged

****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************

Command (? for help):
Recovery/transformation command (? for help): Warning! This will probably do weird things if you've converted an MBR to
GPT form and haven't yet saved the GPT! Proceed? (Y/N):
Recovery/transformation command (? for help): Warning! Secondary header is placed too early on the disk! Do you want to
correct this problem? (Y/N): Have moved second header and partition table to correct location.

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): OK; writing new GUID partition table (GPT) to /dev/mmcblk3.
Unable to save backup partition table! Perhaps the 'e' option on the experts'
menu will resolve this problem.
Warning! An error was reported when writing the partition table! This error
MIGHT be harmless, or the disk might be damaged! Checking it is advisable.

Recovery/transformation command (? for help): UTP: sending Non-success to kernel for command $ echo -e 'r\ne\nY\nw\nY\nY' | gdisk /dev/mmcblk3.
utp_poll: exit with status 1280

0 Kudos

5,819 Views
dwarakeshradhak
Contributor II

Hi Mike,

"Unable to save backup partition table! Perhaps the 'e' option on the experts'
menu will resolve this problem.
Warning! An error was reported when writing the partition table! This error
MIGHT be harmless, or the disk might be damaged! Checking it is advisable."

As suggested, please try the 'e' option and see if it fixes the issue. You can try command line in the target, before sending it via MFGTool.

0 Kudos