Closed Bug 1066495 Opened 10 years ago Closed 6 years ago

[dolphin][flame] OTA update decompress to /system instead of sdcard

Categories

(Firefox OS Graveyard :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(blocking-b2g:-, b2g-v1.4 affected, b2g-v2.0 affected, b2g-v2.1 affected)

RESOLVED WONTFIX
blocking-b2g -
Tracking Status
b2g-v1.4 --- affected
b2g-v2.0 --- affected
b2g-v2.1 --- affected

People

(Reporter: angelc04, Unassigned)

References

Details

(Keywords: regression)

STR
-----------------------------------------------------------------------
0. prepare a device with sdcard and an old build installed
1. Enable remote debugging and connect device to PC
2. Start device and wait until there is OTA update notification
3. Tap on the update notification and start downloading
4. Run command "watch adb shell df" to monitor the run-time partition usage
   You will see the free space for sdcard decreased
5. Wait until download finish, decompressing process started
   --> You will see /system partition will be used for decompressing. OTA update will fail if there is not enough space in /system.


Note
v1.3 and v1.3t does not have this problem. OTA update decompress ota package to sdcard.
ni on me to check 2.0 and 2.1
Flags: needinfo?(pcheng)
[Blocking Requested - why for this release]: 
regression from 1.3 and 1.3t. User will not be able to do OTA update if there is not enough space on /system partition.
blocking-b2g: --- → 1.4?
Keywords: regression
This won't help devices without sdcard or where the sdcard is full.

I'd like it better if the b2g updater unpacked the files to /system one by one, or straight to the right place (overwriting the old one), instead of unpacking all of them side by side of the old ones.
(In reply to Andreas Pehrson [:pehrsons] (Telenor) from comment #3)
> This won't help devices without sdcard or where the sdcard is full.
> 
> I'd like it better if the b2g updater unpacked the files to /system one by
> one, or straight to the right place (overwriting the old one), instead of
> unpacking all of them side by side of the old ones.

If the update fails partway through, then the updater will throw away the new files.

Also - the files in /system are the ones currently being executed (b2g is running while the update is being applied), so updating in-place is a disaster waiting to happen.

The only safe way to do updates that overwrite the files is to use FOTA (because then another agent - the recovery ROM) is doing the updates.
(In reply to Dave Hylands [:dhylands] from comment #4)
> Also - the files in /system are the ones currently being executed (b2g is
> running while the update is being applied), so updating in-place is a
> disaster waiting to happen.
Right. FOTA is the way to go here then.

What about decompressing to another place than /system? Does gecko check for an unfinished update on boot and wipe it (if battery was pulled out half-way for instance), or how does that work?
The way that gecko installs OTA updates is the following:

- Copy /system/bin to a temp dir
- Uncompress update and apply update to temp dir
- Restart B2G and mv /system/bin out of the way, then mv temp dir to /system/bin
- remove old version of /system/b2g

So the only way that mechanism can work is if tempdir is on /system
Dave,

Going back to the reported bug here, did we make change intentionally to extract to system rather than to SD card since 1.4?
According to Peipei's testing, pre-1.4 releases would extract to SD card instead.
Flags: needinfo?(dhylands)
(In reply to Wayne Chang [:wchang] from comment #7)
> Dave,
> 
> Going back to the reported bug here, did we make change intentionally to
> extract to system rather than to SD card since 1.4?
> According to Peipei's testing, pre-1.4 releases would extract to SD card
> instead.

What I described is the way its always worked (to the best of my knowledge):

There are several distinct phases of update though.

The first is downloading the .mar file. This will happen to either /data or /sdcard depending on which has available space, and I believe that /sdcard is preferred over /data.
http://dxr.mozilla.org/mozilla-central/source/b2g/components/DirectoryProvider.js#147

Then the updater goes through the process described in comment #6. There are some optimizations in the file copying process in that it will use hard-links when it can.

For OTA, the .mar file also isn't unpacked and then processed, it's actually unpacked and processed on the fly. For FOTA, the .mar file only contains a .zip, a manifest and a couple other files. For FOTA, it will uncompress the .mar to get the .zip so it can pass the .zip to the recovery ROM, but IIRC that puts the .zip in the same directory as the .mar.
Flags: needinfo?(dhylands)
With Dave's information and speaking with Kai-Zhen off line, I understand this hasn't changed and we're not doing any decompression with the downloaded OTA package. 
Partner has corrected Dolphin's partitioning and OTA is working again per https://bugzilla.mozilla.org/show_bug.cgi?id=1061132#c39
blocking-b2g: 1.4? → -
Flags: needinfo?(pcheng)
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.