scripts icon indicating copy to clipboard operation
scripts copied to clipboard

Stock firmware backup confirmed, but nowhere to be found (written to EFI partition!)

Open jjabba opened this issue 4 years ago • 7 comments

I backed up the stock firmware of a HP Chromebox yesterday. The usb stick I had around was formatted as FAT32, but alas as it turns out, formatted using OS X...

The Firmware backup was successful, so after removing the stick I proceeded to patch the chromebox, which went as expected.

But when plugging the USB stick into my main Computer (Mac) the firmware file was nowhere to be found. Luckily I've been around the block a few times so I proceeded to investigate what exactly firmware.sh does as well as scanning the USB stick using testdisk. As it turns out, the firmware had been written, not to the OSX mountable part of the stick, but to the hidden first partition (EFI System) (!).

In the end, testdisk was able to successfully copy the file off the EFI partition but I doubt the average user would know to try such methods if the firmware file isn't there despite successful backup and confirmation from the script.

savedbytestdisk

jjabba avatar May 17 '20 23:05 jjabba

the script backs up to the first mountable partition available on the device, in this case the FAT32 EFS partition. I don't have any logic to check the partition type, status, etc. Just checks for a mountable filesystem.

MrChromebox avatar May 18 '20 03:05 MrChromebox

My point is that the user experience isn't what one might expect. And I fear there is a risk of stock firmware loss should the USB drive used have been formatted as FAT32 on a MacOS machine. Would you accept a patch which favors the largest partition rather than the first?

jjabba avatar May 19 '20 18:05 jjabba

I'd consider it, but sounds like the real issue was MacOS not repartitioning the stick properly when wiping/formatting

MrChromebox avatar May 19 '20 18:05 MrChromebox

I would agree, but I feel I might have a better chance for you accepting a PR than apple 😅

jjabba avatar May 19 '20 18:05 jjabba

how about I simply skip hidden partitions and/or the EFS? Then if the next partition fails to mount due to incompatible FS, the user will be alerted

MrChromebox avatar May 19 '20 19:05 MrChromebox

That sound's like an awesome solution to me!

jjabba avatar May 21 '20 16:05 jjabba

I don't have time to implement this ATM, but would certainly take a pull request to implement it :)

MrChromebox avatar May 21 '20 16:05 MrChromebox