Closed
Bug 1163956
Opened 10 years ago
Closed 9 years ago
[nexus-5-l] Can't perform FOTA from 2.2 to 2.2
Categories
(Firefox OS Graveyard :: General, defect)
Tracking
(firefox42 fixed)
RESOLVED
FIXED
FxOS-S2 (10Jul)
Tracking | Status | |
---|---|---|
firefox42 | --- | fixed |
People
(Reporter: gchang, Assigned: etsai)
References
(Depends on 1 open bug)
Details
Attachments
(8 files, 5 obsolete files)
(deleted),
text/plain
|
Details | |
(deleted),
text/plain
|
Details | |
(deleted),
text/plain
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
text/x-github-pull-request
|
gsvelto
:
review+
|
Details |
(deleted),
text/x-github-pull-request
|
gsvelto
:
review+
|
Details |
(deleted),
patch
|
Details | Diff | Splinter Review |
Trying to upgrade 2.2 to 2.2 using FOTA, but got errors when entering recovery mode. Which will cause me to use adb sideload to update device.
The log shows
"Rebooting into recovery to apply FOTA update: /storage/emulated/legacy/updates/fota/update.zip"
STR:
1. Build 2.2 fota image locally and put the image in local server.
2. Flash nexus-5-l from pvt
3. Change ota url in "Developer" in Settings app
4. Go to Settings > Device information
5. Tap "Check now" button
6. Perform upgrade in notification bar
### Expected:
1. The device should be upgraded
### Actual:
1. The device failed to upgrade
### Reproduce rate
always
Reporter | ||
Updated•10 years ago
|
QA Whiteboard: [COM=OTA]
Updated•10 years ago
|
Assignee | ||
Comment 1•10 years ago
|
||
Two problems to be solved:
1) Command for recovery is set: "/updates/fota/update.zip", path should be fixed
2) When using sideload, the update-binary is too old to support new function. Need to package a new one with update.zip
Assignee: nobody → etsai
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•10 years ago
|
||
For first problem, set RECOVERY_EXTERNAL_STORAGE to /sdcard in full_hammerhead.mk doesn't work on my build or google's LMY47D recovery image, file not found. TWRP will mount /sdcard and there is update.zip in /sdcard/updates/fota, need to know how android L works.
Assignee | ||
Comment 3•10 years ago
|
||
For 1) Using stock recovery, only /cache is mounted, it doesn't match with b2g update service's download path. Per-discussed with :kli, we will modify recovery to mount external storage. Then it will work as b2g.
For 2) copy system/bin/updater to device/, add TARGET_UPDATE_BINARY to BoardConfig.mk.
Assignee | ||
Comment 4•10 years ago
|
||
For 2) Update: our edify script generator uses set_perm and set_perm_recursive, these two functions are deprecated.
Comment 5•10 years ago
|
||
(In reply to Eric Tsai from comment #3)
> For 1) Using stock recovery, only /cache is mounted, it doesn't match with
> b2g update service's download path. Per-discussed with :kli, we will modify
> recovery to mount external storage. Then it will work as b2g.
> For 2) copy system/bin/updater to device/, add TARGET_UPDATE_BINARY to
> BoardConfig.mk.
I think you can also just make TARGET_UPDATE_BINARY to be like:
TARGET_UPDATE_BINARY := $(PRODUCT_OUT)/system/bin.updater
Gerry, we cannot debug blindly this kind of error. Next time you should include the content of /cache/recovery/last_log for example.
Flags: needinfo?(gchang)
Reporter | ||
Comment 6•10 years ago
|
||
Flags: needinfo?(gchang)
Assignee | ||
Comment 7•10 years ago
|
||
Summarize problems to solve:
1) Command for recovery is set: "/updates/fota/update.zip", path should be fixed
2) updater-script uses "set_perm" and "set_perm_recursive" those are deprecated and replaced by "set_metadata" and "set_metadata_recursive" in new update-binary
:gsvelto, for this bug, my proposed solution is:
1) add RECOVERY_EXTERNAL_STORAGE to device/lge/hammerhead/hammerhead.mk
2) fork bootable/recovery branch 5.1.0_r1 from CAF, patch install.c with the two functions: "set_perm" and "set_perm_recursive". Then modify manifest.xml for nexus-5-l using the new revision.
If it's ok, :kli and I will finish in this week.
Flags: needinfo?(gsvelto)
Comment 8•10 years ago
|
||
(In reply to Eric Tsai from comment #7)
> 1) add RECOVERY_EXTERNAL_STORAGE to device/lge/hammerhead/hammerhead.mk
+1
> 2) fork bootable/recovery branch 5.1.0_r1 from CAF, patch install.c with the
> two functions: "set_perm" and "set_perm_recursive". Then modify manifest.xml
> for nexus-5-l using the new revision.
From what I can tell the edify script generator already supports using set_metadata and set_metadata_recursive, you have to add the 'use_set_metadata=1' flag to the META/misc_info.txt for it to work though.
Flags: needinfo?(gsvelto)
Assignee | ||
Comment 9•10 years ago
|
||
Using my proposed solution works to adopt FOTA. But after FOTA, b2g can't start. I use ./build.sh gecko-update-fota-full to generate a full fota package.
It's strange because I can push update.zip and write recovery command as FOTA does, b2g works fine.
No matter download or manually FOTA, the FOTA log is the same, with unmount data partition fail, device busy.
:kli and I did some experiments and we found two ways to recovery from the status:
1. reboot to recovery mode, use vol/power button, reboot to system, then b2g starts.
2. flash clear data or cache partition by fastboot and reboot, then b2g starts
Still trying what can help.
Assignee | ||
Comment 10•10 years ago
|
||
Assignee | ||
Comment 11•10 years ago
|
||
I think :gsvelto said 'use_set_metadata=1' flag to META/misc_info.txt doesn't works for "./build.sh gecko-fota-update-full". Let updater-binary support set_perm should be better?
Assignee | ||
Comment 12•10 years ago
|
||
More experiments on FOTA pcakage
1. Remove all mount/extract/delete command in updater-script, do FOTA->b2g can't start
2. Download and extract to update.zip, don't write command and reboot to recovery. Manually reboot to system or reboot to recovery then to system->b2g starts
3. Download and extract to update.zip, don't write any command but auto reboot to recovery->b2g starts
4. Change EXTERNAL_STORAGE to /cache, but RECOVERY_EXTERNAL_STORAGE in /data/media/0, make a fail update->b2g can't start
5. Change EXTERNAL_STORAGE and RECOVERY_EXTERNAL_STORAGE to /cache and do FOTA->b2g can't start
Assignee | ||
Comment 13•10 years ago
|
||
Some more experiments, when b2g can't start, move /cache/recovery to /cache/recovery2, then b2g starts.
Not sure why but may be I can check bootable/recovery and see something related with /cache/recovery
Assignee | ||
Comment 14•9 years ago
|
||
Only /cache/recovery/last_install will cause b2g can't start. After change recovery.cpp not copy /tmp/last_install to /cache/recovery/last_install, the FOTA works fine and b2g can start. I think the last_install format should be fine but need to figure out why can't start b2g.
Comment 15•9 years ago
|
||
Eric, can you be more precise for what happens when you say "b2g cannot start"?
Does the system not even boot?
Does it boots but the process /system/b2g/b2g never gets created?
Does /system/b2g/b2g gets executed but stalls at some point?
Flags: needinfo?(etsai)
Assignee | ||
Comment 16•9 years ago
|
||
Hi Alexandre, in my case b2g starts but crash. Some watchdog will start b2g again. I can use b2g-ps see the PID increase. Screen stay in Google logo, doesn't change to b2g animation.
When I remove (or rename) last_install, b2g starts and I can boot to home screen
I have a back trace log but I can't find the root cause.
Flags: needinfo?(etsai)
Assignee | ||
Comment 17•9 years ago
|
||
Assignee | ||
Comment 18•9 years ago
|
||
Fix RECOVERY_EXTERNAL_STORAGE for nexus 5
Assignee | ||
Comment 19•9 years ago
|
||
Add set_perm for backward compatible for gecko-update-fota-full which will not use set_metadata
Assignee | ||
Comment 20•9 years ago
|
||
Hi Alexandre, the two patches can helps to duplicate my current status.
Comment 21•9 years ago
|
||
That's strange, I cannot find any trace of playing with last_install in Gecko
Comment 22•9 years ago
|
||
Hm are you sure Gecko is at fault? It's only librecovery and recovery itself that manipulates this last_install file. And you did hack recovery ...
Comment 23•9 years ago
|
||
Eric, last_install is being read by librecovery in |getFotaUpdateStatus()| and this is being used by Gecko https://dxr.mozilla.org/mozilla-central/search?q=getFotaUpdateStatus&case=true
Maybe it's this code that is choking ?
Flags: needinfo?(etsai)
Assignee | ||
Comment 24•9 years ago
|
||
I can try this later. But in my experience, I didn't see any related log from logcat.
Flags: needinfo?(etsai)
Assignee | ||
Comment 25•9 years ago
|
||
Alexandre, I did some experiments and find
https://dxr.mozilla.org/mozilla-central/source/b2g/components/RecoveryService.js#145
Accessing cStatus.result cause b2g crash, any idea?
Comment 26•9 years ago
|
||
No idea, at all.
Comment 27•9 years ago
|
||
(In reply to Eric Tsai from comment #25)
> Alexandre, I did some experiments and find
>
> https://dxr.mozilla.org/mozilla-central/source/b2g/components/
> RecoveryService.js#145
>
> Accessing cStatus.result cause b2g crash, any idea?
Vivien suggested maybe we have simply a discrepency with the ctypes ?
Assignee | ||
Comment 28•9 years ago
|
||
Vivien, may I know what's "simply a discrepency with the ctypes" means? I don't have any idea about this.
I print the status object/structure address in 1) RecoveryService.js, after create cStatus, 2) librecovery.c, before leave getFotaUpdateStatus and 3) RecoveryService.js, after calling getFotaUpdateStatus.
1 and 2 are the same address, but 3 is different. Is this why b2g crashes?
> I/Gecko ( 736): -*- RecoveryService: before getFotaUpdateStatus, cStatus.address: FotaUpdateStatus.ptr(ctypes.UInt64("0xb1e4ee10"))
> W/librecovery( 736): before leave getFotaUpdateStatus, status address: 0xb1e4ee10
> I/Gecko ( 736): -*- RecoveryService: after getFotaUpdateStatus, cStatus.address: FotaUpdateStatus.ptr(ctypes.UInt64("0x656d2f61"))
Flags: needinfo?(21)
Comment 29•9 years ago
|
||
(In reply to Eric Tsai from comment #28)
> Vivien, may I know what's "simply a discrepency with the ctypes" means? I
> don't have any idea about this.
>
> I print the status object/structure address in 1) RecoveryService.js, after
> create cStatus, 2) librecovery.c, before leave getFotaUpdateStatus and 3)
> RecoveryService.js, after calling getFotaUpdateStatus.
> 1 and 2 are the same address, but 3 is different. Is this why b2g crashes?
>
> > I/Gecko ( 736): -*- RecoveryService: before getFotaUpdateStatus, cStatus.address: FotaUpdateStatus.ptr(ctypes.UInt64("0xb1e4ee10"))
> > W/librecovery( 736): before leave getFotaUpdateStatus, status address: 0xb1e4ee10
> > I/Gecko ( 736): -*- RecoveryService: after getFotaUpdateStatus, cStatus.address: FotaUpdateStatus.ptr(ctypes.UInt64("0x656d2f61"))
Eric, what Vivien said is that maybe the ctypes binding are not in sync with your current librecovery's prototype.
Flags: needinfo?(21)
Assignee | ||
Comment 30•9 years ago
|
||
Looks the same in RecoveryService.js
> let FotaUpdateStatus = new ctypes.StructType("FotaUpdateStatus", [
> { result: ctypes.int },
> { updatePath: ctypes.char.ptr }
> ]);
and librecovery.h
> typedef enum {
> FOTA_UPDATE_UNKNOWN = 0,
> FOTA_UPDATE_FAIL = 1,
> FOTA_UPDATE_SUCCESS = 2
> } FotaUpdateResult;
>
> typedef struct {
> FotaUpdateResult result;
> // The path to the update that was installed
> char updatePath[PATH_MAX];
> } FotaUpdateStatus;
Comment 31•9 years ago
|
||
Comment 32•9 years ago
|
||
Eric, could you give a try to this patch on v2.2 branch ? I suspected maybe
there was something wrong with ctypes itself so we checked with :nbp but while
verifying he suspecting the line making use of FotaUpdateStatus struct was quite
strange, so we dig up into Gecko for other uses and it showed that all others
were declaring the struct like it is done right now, but we using it in another
way:
- either accessing directly the variable declared as ctypes.StructType()
without any use of '()', 'new' and playing around with '.ptr'
- or accessing the variable declared as ctypes.StructTypes() with '()', a 'new'
statement and using '.address()'
This patch should make us in the second case properly, by adding the 'new'
statement. I have no idea why this would not have been caught previously :(
Updated•9 years ago
|
Flags: needinfo?(etsai)
Assignee | ||
Comment 33•9 years ago
|
||
Alexandre, patch from attachment 8621539 [details] [diff] [review] doesn't help :( How could I try the first case?
Flags: needinfo?(etsai)
Assignee | ||
Comment 34•9 years ago
|
||
I run the same code on flame-2.2, cStatus.address() is the same before/after getFotaUpdateStatus. I think if we can figure out why address change on nexus 5, this bug can be solved.
Comment 35•9 years ago
|
||
Attachment #8621536 -
Attachment is obsolete: true
Comment 36•9 years ago
|
||
Attachment #8621539 -
Attachment is obsolete: true
Comment 37•9 years ago
|
||
Eric, can you try attachment 8622474 [details] [diff] [review] ?
Flags: needinfo?(etsai)
Assignee | ||
Comment 38•9 years ago
|
||
attachment 8622474 [details] [diff] [review] doesn't work for me and will get the following gecko error:
W/GeckoConsole( 196): [JavaScript Error: "TypeError: expected type pointer, got ctypes.StructType("FotaUpdateStatus", [{ "result": ctypes.int }, { "updatePath": ctypes.char.ptr }]).ptr" {file: "jar:file:///system/b2g/omni.ja!/components/RecoveryService.js" line: 144}]
W/GeckoConsole( 196): [JavaScript Error: "NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS: [JavaScript Error: "expected type pointer, got ctypes.StructType("FotaUpdateStatus", [{ "result": ctypes.int }, { "updatePath": ctypes.char.ptr }]).ptr" {file: "jar:file:///system/b2g/omni.ja!/components/RecoveryService.js" line: 146}]'[JavaScript Error: "expected type pointer, got ctypes.StructType("FotaUpdateStatus", [{ "result": ctypes.int }, { "updatePath": ctypes.char.ptr }]).ptr" {file: "jar:file:///system/b2g/omni.ja!/components/RecoveryService.js" line: 144}]' when calling method: [nsIRecoveryService::getFotaUpdateStatus]" {file: "jar:file:///system/b2g/omni.ja!/components/nsUpdateService.js" line: 1848}]
W/GeckoConsole( 196): [JavaScript Error: "NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS: [JavaScript Error: "expected type pointer, got ctypes.StructType("FotaUpdateStatus", [{ "result": ctypes.int }, { "updatePath": ctypes.char.ptr }]).ptr" {file: "jar:file:///system/b2g/omni.ja!/components/RecoveryService.js" line: 146}]'[JavaScript Error: "expected type pointer, got ctypes.StructType("FotaUpdateStatus", [{ "result": ctypes.int }, { "updatePath": ctypes.char.ptr }]).ptr" {file: "jar:file:///system/b2g/omni.ja!/components/RecoveryService.js" line: 144}]' when calling method: [nsIRecoveryService::getFotaUpdateStatus]" {file: "jar:file:///system/b2g/omni.ja!/components/nsUpdateService.js" line: 1848}]
Flags: needinfo?(etsai)
Assignee | ||
Comment 39•9 years ago
|
||
Bobby, could you help me to figure out why cStatus.address() changes after:
https://dxr.mozilla.org/mozilla-central/source/b2g/components/RecoveryService.js#144
I did some experiments and find on my Nexus 5, the status structure's address changes then cause b2g crashes. But this will not happen on flame. RecoveryService.js and librecovery.c are the same between nexus 5 and flame's code base.
Flags: needinfo?(bobbyholley)
Comment 40•9 years ago
|
||
cStatus is |new ctypes.StructType("FotaUpdateStatus", ...)| right? That means that it represents a type, not data. You can't take the address of a type. ;-)
You should really rename cStatus to "cStatus_t", and then do "cStatus = new cStatus_t(...)", and take .address() of that.
Flags: needinfo?(bobbyholley)
Assignee | ||
Comment 41•9 years ago
|
||
Boddy, I think FotaUpdateStatus represents a type now, from:
https://dxr.mozilla.org/mozilla-central/source/b2g/components/RecoveryService.js#29
I guess Alexandre's attachment 8621539 [details] [diff] [review] works the same as you said? I've tried this but still get two different addresses, b2g crashes when access cStatus.result.
Assignee | ||
Updated•9 years ago
|
Flags: needinfo?(bobbyholley)
Assignee | ||
Comment 42•9 years ago
|
||
Looks like the RecoveryService.js jsctype structure doesn't match with librecovery stucture. I fix updatePath with:
let FotaUpdateStatus = new ctypes.StructType("FotaUpdateStatus", [
{ result: ctypes.int },
{ updatePath: ctypes.char.array(4096) }
]);
then everything works good now.
Flags: needinfo?(bobbyholley)
Assignee | ||
Comment 43•9 years ago
|
||
Attachment #8617855 -
Attachment is obsolete: true
Assignee | ||
Comment 44•9 years ago
|
||
Attachment #8617857 -
Attachment is obsolete: true
Assignee | ||
Comment 45•9 years ago
|
||
Change FotaUpdateStatus.updatePath from ctypes.char.ptr to ctyps.char.array(4096), sync with librecovery.h
Attachment #8630335 -
Flags: review?(gsvelto)
Assignee | ||
Updated•9 years ago
|
Attachment #8629267 -
Flags: review?(gsvelto)
Assignee | ||
Updated•9 years ago
|
Attachment #8628672 -
Flags: review?(gsvelto)
Comment 46•9 years ago
|
||
Eric, did you had time to check on other devices that this was not regressing?
Flags: needinfo?(etsai)
Updated•9 years ago
|
Flags: needinfo?(taz)
Assignee | ||
Comment 47•9 years ago
|
||
I've tested attachment 8630335 [details] [diff] [review] on flame-kk at branch 2.2 only, it works fine so I think will not cause regression.
As I mentioned in Comment 39, I don't know why original code works on flame but crashes nexus 5. Maybe Gerry can helps to verify attachment 8630335 [details] [diff] [review] for more devices?
Flags: needinfo?(etsai) → needinfo?(gchang)
Comment 48•9 years ago
|
||
Comment on attachment 8630335 [details] [diff] [review]
0001-Bug-1163956-Modify-updatePath-to-fixed-char-array.patch
LGTM but it be worth mentioning in a comment that this is due to librecovery.h using PATH_MAX as the size for that particular field so that someone reading the code doesn't wonder where that number is coming from.
Attachment #8630335 -
Flags: review?(gsvelto) → review+
Comment 49•9 years ago
|
||
Comment on attachment 8628672 [details]
Add RECOVERY_EXTERNAL_STORAGE
LGTM.
Attachment #8628672 -
Flags: review?(gsvelto) → review+
Comment 50•9 years ago
|
||
Comment on attachment 8629267 [details]
Support USE_SET_METADATA for build fota package
LGTM, I've just added a nit about commenting this change a little more. Our scripts are already fairly obscure and I think we should leave small comments in our code to explain why we're doing certain things otherwise it will be hard for future readers to figure out why we did.
Attachment #8629267 -
Flags: review?(gsvelto) → review+
Assignee | ||
Comment 51•9 years ago
|
||
Update with comment for changes to char.array, and where the size from
Attachment #8630335 -
Attachment is obsolete: true
Comment 52•9 years ago
|
||
(In reply to Eric Tsai from comment #51)
> Created attachment 8630924 [details] [diff] [review]
> [final]0001-Bug-1163956-Modify-updatePath-to-fixed-char-array-v2.patch,
> r=gsvelto
>
> Update with comment for changes to char.array, and where the size from
Just my 2 cents, maybe to avoid potential issues we should reuse the PATH_MAX define rather than hardcoding 4096 ? Long shot, but still ...
Assignee | ||
Comment 53•9 years ago
|
||
Agree, my original idea is to reuse the PATH_MAX define from limits.h. But I don't have proper way so finally hardcoding 4096.
Comment 54•9 years ago
|
||
(In reply to Eric Tsai from comment #53)
> Agree, my original idea is to reuse the PATH_MAX define from limits.h. But I
> don't have proper way so finally hardcoding 4096.
Yeah that would be best but I don't know of any reasonable way to pull a constant such as PATH_MAX defined in a header into JavaScript :-( Maybe we can put it in a global somewhere and read that using jsctypes but that feels like overkill for this patch. We can open a bug for that though, it might be a good first bug (low priority, high reward in terms of learning how our stuff works).
Reporter | ||
Updated•9 years ago
|
Flags: needinfo?(gchang)
Assignee | ||
Comment 55•9 years ago
|
||
Please help to land attachment 8630924 [details] [diff] [review], try server result:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=1e7ed693d7cb
After that, land attachment 8629267 [details] then attachment 8628672 [details]
Keywords: checkin-needed
Comment 56•9 years ago
|
||
Keywords: checkin-needed
Comment 57•9 years ago
|
||
Comment 58•9 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox42:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → FxOS-S2 (10Jul)
You need to log in
before you can comment on or make changes to this bug.
Description
•