• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[4.4 ROM Flash] bypass set_metadata_xxx fails

Search This thread

daniel_hk

Inactive Recognized Contributor
Nov 12, 2012
1,634
5,342
Hong Kong
428483.jpg


Before we can take a bite on the new KitKat, some of us may encounter the set_metadata.. error at flashing.

Problem:
The new updater-scritpt use set_metadata and set_metadata_recursive to assign the permissions to the newly copied files.
Most of the existing /system partition doesn't support the "capabilities" option. Script in android/build would assign 0x00 to "capabilities".
However, assigning a "capabilities" with 0x00 to the unsuported partition also cause error!
If you are lucky, you might find an updated custom recovery to solve that.
For those who don't have a workable recovey or don't want to update the recovery yet. Here is a solution

Solution:
I patched the script when building my 4.4 rom for GT-7.7. The included "update-binary" would solve that problem at flashing.
Open the zip of the ROM or gapps. Replace the file in /META-INF/com/google/android with this one.
Now you can flash the 4.4 rom and gapps without an recovery update..

It works for cm11 & aosp based ROMs and gapps.

Cheers!

Edit:
Silly me, how can it be hardware independent... This one is compiled for armv7. Different cpu surely need a recompile.:p
Here is the change in the source: http://forum.xda-developers.com/showpost.php?p=47692333&postcount=15
 

Attachments

  • update-binary.zip
    173 KB · Views: 43,034
Last edited:

ibub

Senior Member
Oct 22, 2012
1,728
1,522
Louisville,Ky
@daniel_hk
Thanks for this. But it does not work for my armv6 device (lg p500). Could you please tell us what you changed, so that it can be "ported" to older devices. I have read that some recoveries have merged changes to source, but these devices do not yet have a ported version. So if you have time, this would be much appreciated by my device community. :)

Sent from my LG-P500 using Tapatalk 2
 
  • Like
Reactions: xu3sno

daniel_hk

Inactive Recognized Contributor
Nov 12, 2012
1,634
5,342
Hong Kong
@daniel_hk
Thanks for this. But it does not work for my armv6 device (lg p500). Could you please tell us what you changed, so that it can be "ported" to older devices. I have read that some recoveries have merged changes to source, but these devices do not yet have a ported version. So if you have time, this would be much appreciated by my device community. :)

Sent from my LG-P500 using Tapatalk 2

The theory of what I have done is already mentioned in the thread.

In details, I changed the file in the source of the recovery. The update-binary is generated there.
In the function ApplyParsedPerms, when encounter a 0x0 for "capabilities", I drop the flag .

The attached file was from the rom I built.
For ROMs using the CyanogenMod cm-11 or AOSP 4.4 source, it should work.

Send me the link of your ROM which fail. Let me take a look. ;)
 
Last edited:

ibub

Senior Member
Oct 22, 2012
1,728
1,522
Louisville,Ky
Thank you so much. But I may have spoken too soon. I found an updated recovery (4.3), and new update binary for my phone. I will try it later to see if it works, before asking you to waste your time. :)

Sent from my LG-P500 using Tapatalk 2
 

daniel_hk

Inactive Recognized Contributor
Nov 12, 2012
1,634
5,342
Hong Kong
  • Like
Reactions: ibub

ibub

Senior Member
Oct 22, 2012
1,728
1,522
Louisville,Ky
Yeah, it's set_metadata_recursive error or fail. I think my recovery will copy messages to SD. Will record soon. The devs for this device are now trying to add set_metadata tags in boardconfig.mk, and then use set metadata =false. But I'm not really sure if that would be an actual fix, or just a temporary work around to get it to flash. So I'd rather try to do it your way. Just wish my 32-bit system would compile newer Android. :rolleyes:;)

Sent from my LG-P500 using Tapatalk 2

---------- Post added at 06:37 AM ---------- Previous post was at 06:06 AM ----------

Ok, here's my recovery log. :)

Sent from my LG-P500 using Tapatalk 2

---------- Post added at 06:38 AM ---------- Previous post was at 06:37 AM ----------

http://www.mediafire.com/view/?dddwi6vtbo3a1fg
Sent from my LG-P500 using Tapatalk 2
 

daniel_hk

Inactive Recognized Contributor
Nov 12, 2012
1,634
5,342
Hong Kong
Yeah, it's set_metadata_recursive error or fail. I think my recovery will copy messages to SD. Will record soon. The devs for this device are now trying to add set_metadata tags in boardconfig.mk, and then use set metadata =false. But I'm not really sure if that would be an actual fix, or just a temporary work around to get it to flash. So I'd rather try to do it your way. Just wish my 32-bit system would compile newer Android. :rolleyes:;)

Sent from my LG-P500 using Tapatalk 2

---------- Post added at 06:37 AM ---------- Previous post was at 06:06 AM ----------

Ok, here's my recovery log. :)

Sent from my LG-P500 using Tapatalk 2

---------- Post added at 06:38 AM ---------- Previous post was at 06:37 AM ----------

http://www.mediafire.com/view/?dddwi6vtbo3a1fg
Sent from my LG-P500 using Tapatalk 2

in line 1260:
-> ApplyParsedPerms: removexattr of /system/xbin/su to 0 failed: Operation not supported on transport endpoint

seems the file system doesn't support XATTR, remove a non exsist attr probably cause error.

Did the log come from my update-binary?

If so, you need to tell the rom developer to check the kernel source:
if the kernel support selinux and file system is EXT, you need the following
CONFIG_EXT4_FS_XATTR=y
or
CONFIG_EXT3_FS_XATTR=y
Either one must be enabled dependent on the file system.
If kernel doesn't support selinux, disable it.

For YAFFS, there might be similar config for kernel need to enable or disable

Good luck!;)
 
  • Like
Reactions: Rminsh and ibub

ibub

Senior Member
Oct 22, 2012
1,728
1,522
Louisville,Ky
in line 1260:
-> ApplyParsedPerms: removexattr of /system/xbin/su to 0 failed: Operation not supported on transport endpoint

seems the file system doesn't support XATTR, remove a non exsist attr probably cause error.

Did the log come from my update-binary?

If so, you need to tell the rom developer to check the kernel source:
if the kernel support selinux and file system is EXT, you need the following
CONFIG_EXT4_FS_XATTR=y
or
CONFIG_EXT3_FS_XATTR=y
Either one must be enabled dependent on the file system.
If kernel doesn't support selinux, disable it.

For YAFFS, there might be similar config for kernel need to enable or disable

Good luck!;)

No, that was the original update binary, built with the rom. I don't know for certain, but have read that the binary is specific to the chipset. Anyway, I'm gonna search through the commits to see if the xattr has been used. Remember seeing it... somewhere. :confused: Again thanks. :)

Sent from my LG-P500 using Tapatalk 2
 

daniel_hk

Inactive Recognized Contributor
Nov 12, 2012
1,634
5,342
Hong Kong
No, that was the original update binary, built with the rom. I don't know for certain, but have read that the binary is specific to the chipset. Anyway, I'm gonna search through the commits to see if the xattr has been used. Remember seeing it... somewhere. :confused: Again thanks. :)

Sent from my LG-P500 using Tapatalk 2

I think you haven't try my update-binary. I don't know why you said it fail? :eek:

You better try my update-binary again. "capacities" is one of the xattr. update-binary is just a set of functions calling the kernel's routine to do
things. I don't know who told you its hardware related. I already point you out where in the source creating it. Take a look at that part of the source is what you needed...

It would not waste our time if you have tried.I don't know how to help if you don't try it.

Good luck!
 
  • Like
Reactions: mirushi and ibub

ibub

Senior Member
Oct 22, 2012
1,728
1,522
Louisville,Ky
Thank you. I did try with your binary previously. But I will try again with an updated recovery and your binary. And then copy the recovery log again. Sorry for misunderstanding.

Sent from my LG-P500 using Tapatalk 2

---------- Post added at 09:56 PM ---------- Previous post was at 09:08 PM ----------

Ok, I tried again with no luck. And here is the log:
http://www.mediafire.com/view/?hcibdddd1vxtcr3
Again... thanks.

Sent from my LG-P500 using Tapatalk 2
 
  • Like
Reactions: mirushi

ibub

Senior Member
Oct 22, 2012
1,728
1,522
Louisville,Ky
Ok, I don't see any indication in the log as to what caused the error with binary. But I opened it in hex viewer. On line 044f21 the platform is listed as arm v7. I think my arm v6 device cannot use this. Anyway, thanks for helping. I guess I have MORE research to do. :)

Sent from my LG-P500 using Tapatalk 2
 

daniel_hk

Inactive Recognized Contributor
Nov 12, 2012
1,634
5,342
Hong Kong
Thank you. I did try with your binary previously. But I will try again with an updated recovery and your binary. And then copy the recovery log again. Sorry for misunderstanding.

Sent from my LG-P500 using Tapatalk 2

---------- Post added at 09:56 PM ---------- Previous post was at 09:08 PM ----------

Ok, I tried again with no luck. And here is the log:
http://www.mediafire.com/view/?hcibdddd1vxtcr3
Again... thanks.

Sent from my LG-P500 using Tapatalk 2

Just returned and studied your log. It is not set_metadata fail issue. The update-binary can not run on the devices

I found that p500 use Qualcomm MSM7227 (ARM11) on the web. I can't find the cm11 device tree for p500 nor the kernel source. However, I think the update-binary is not work on the kernel and/or cpu.

The easiest way would be including the following commit and rebuild again: (I simplify it for you, just change one line)

Change the file in (cm11 source):
<cm11 source dir>/bootable/recovery/updater/install.c
in line 694 (under the function ParsePermArgs(int argc, char** args):
694:- parsed.has_capabilities = true;
694:+ parsed.has_capabilities = false;

That is the simpliest way I can think of to fix the set_metadata fail in your device.

Good luck!;)
 

ibub

Senior Member
Oct 22, 2012
1,728
1,522
Louisville,Ky
Thank you so much. I would have never found it. Now I just need to fork the repo, make the change, init repo, build/envsetup sh, sync, add to local manifest, and try to compile. :) ... Or just submit a pull request. That code is interesting. I think I'm gonna learn some more soon. :):):)

Sent from my LG-P500 using Tapatalk 2
 
  • Like
Reactions: Bonoboo

chrisc60

Senior Member
Feb 8, 2012
236
69
Spokane
I have a galaxy SIII (at&t). I have gotten this error instantly when trying to flash a 4.4 rom. Once I replace the aforementioned file with the contents of your zip, won't I need to re-zip the rom and somehow sign it? And if so, do you have a zip "signer"?

Sent from my SAMSUNG-SGH-I747 using Tapatalk
 

srelyt

Senior Member
Apr 19, 2011
160
129
Ahah too bad I saw the thread only today.

I had this error yesterday and had to waste a lot of time finding a solution. I finally had to flash a stock recovery , a stock system partition and adb sideload the update to resolve it without losing any data.

Sounds like your solution would have been a lot easier, I hope people can see it before attempting more complicated things like me ;)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 89
    428483.jpg


    Before we can take a bite on the new KitKat, some of us may encounter the set_metadata.. error at flashing.

    Problem:
    The new updater-scritpt use set_metadata and set_metadata_recursive to assign the permissions to the newly copied files.
    Most of the existing /system partition doesn't support the "capabilities" option. Script in android/build would assign 0x00 to "capabilities".
    However, assigning a "capabilities" with 0x00 to the unsuported partition also cause error!
    If you are lucky, you might find an updated custom recovery to solve that.
    For those who don't have a workable recovey or don't want to update the recovery yet. Here is a solution

    Solution:
    I patched the script when building my 4.4 rom for GT-7.7. The included "update-binary" would solve that problem at flashing.
    Open the zip of the ROM or gapps. Replace the file in /META-INF/com/google/android with this one.
    Now you can flash the 4.4 rom and gapps without an recovery update..

    It works for cm11 & aosp based ROMs and gapps.

    Cheers!

    Edit:
    Silly me, how can it be hardware independent... This one is compiled for armv7. Different cpu surely need a recompile.:p
    Here is the change in the source: http://forum.xda-developers.com/showpost.php?p=47692333&postcount=15
    11
    Thank you. I did try with your binary previously. But I will try again with an updated recovery and your binary. And then copy the recovery log again. Sorry for misunderstanding.

    Sent from my LG-P500 using Tapatalk 2

    ---------- Post added at 09:56 PM ---------- Previous post was at 09:08 PM ----------

    Ok, I tried again with no luck. And here is the log:
    http://www.mediafire.com/view/?hcibdddd1vxtcr3
    Again... thanks.

    Sent from my LG-P500 using Tapatalk 2

    Just returned and studied your log. It is not set_metadata fail issue. The update-binary can not run on the devices

    I found that p500 use Qualcomm MSM7227 (ARM11) on the web. I can't find the cm11 device tree for p500 nor the kernel source. However, I think the update-binary is not work on the kernel and/or cpu.

    The easiest way would be including the following commit and rebuild again: (I simplify it for you, just change one line)

    Change the file in (cm11 source):
    <cm11 source dir>/bootable/recovery/updater/install.c
    in line 694 (under the function ParsePermArgs(int argc, char** args):
    694:- parsed.has_capabilities = true;
    694:+ parsed.has_capabilities = false;

    That is the simpliest way I can think of to fix the set_metadata fail in your device.

    Good luck!;)
    3
    Thanks dude

    Sent from my LG-P500 using xda premium
    3
    @daniel_hk
    Thanks for this. But it does not work for my armv6 device (lg p500). Could you please tell us what you changed, so that it can be "ported" to older devices. I have read that some recoveries have merged changes to source, but these devices do not yet have a ported version. So if you have time, this would be much appreciated by my device community. :)

    Sent from my LG-P500 using Tapatalk 2

    The theory of what I have done is already mentioned in the thread.

    In details, I changed the file in the source of the recovery. The update-binary is generated there.
    In the function ApplyParsedPerms, when encounter a 0x0 for "capabilities", I drop the flag .

    The attached file was from the rom I built.
    For ROMs using the CyanogenMod cm-11 or AOSP 4.4 source, it should work.

    Send me the link of your ROM which fail. Let me take a look. ;)
    2
    No, that was the original update binary, built with the rom. I don't know for certain, but have read that the binary is specific to the chipset. Anyway, I'm gonna search through the commits to see if the xattr has been used. Remember seeing it... somewhere. :confused: Again thanks. :)

    Sent from my LG-P500 using Tapatalk 2

    I think you haven't try my update-binary. I don't know why you said it fail? :eek:

    You better try my update-binary again. "capacities" is one of the xattr. update-binary is just a set of functions calling the kernel's routine to do
    things. I don't know who told you its hardware related. I already point you out where in the source creating it. Take a look at that part of the source is what you needed...

    It would not waste our time if you have tried.I don't know how to help if you don't try it.

    Good luck!