[Linux] fastboot: error: Couldn't parse partition size '0x'

Hello there,

Update: This applies to Sony Xperia XA2 Ultra and likely many other models, too.

I just had a little Fun™ trying to flash my Sony Xperia X with Sailfish OS on Manjaro Linux (not officially supported, I know!) and I was constantly hitting this wall:

$ sudo ./flash.sh
Flashing boot partition..
fastboot: error: Couldn't parse partition size '0x'.

I sure had Fastboot installed:

$ fastboot --version
fastboot version 30.0.5

Then I remembered that I had seen this before, and dug up the Download Platform Tools page, and downloaded version 29.0.5 for Linux. I extracted only the fastboot binary to the folder with flash.sh, chmod +x fastbooted it, and finally succeeded flashing my device with this command:

# PATH=./:$PATH ./flash.sh

That is, temporarily prepend the current folder to the path, so that the older Fastboot gets found first, and it can successfully flash the boot partition, and all the remaining operations succeed as well.

Before you suggest running this command:

# fastboot flash:raw boot hybris-boot.img

I did try raw flashing with my Sony Xperia Z3 Compact Tablet, and it didn’t solve the issue. So, the only thing that worked for me was downgrading Fastboot. I don’t know about other Linux distributions at the moment, but it is very likely that the Fastboot version can and will cause issues sooner or later. Perhaps the flashing documentation could be updated accordingly?


Are you using USB3? Quite interesting that downgrading helped.
I have been messing around with building fastboot myself without any specialized environment… but so far not found a solution to the USB3 issues.
I have hacked in retries to getvar, which seems to work well enough, but actual flashing still fails.

It is almost like commands, and in your case replies, are segmented and reassembly isn’t handled.

Actually I used USB 3.1 because USB 3.0 and 2.0 ports “failed to bring the device up” or something similar. I tried with three known good cables. Once the device got set up correctly and was recognised in the first place, the fastboot version was 100% the cause. Strange, but verified…

And now I’m trying to flash my XA2 Ultra. The thing is that every time I run fastboot devices with the new or the old fastboot, the USB device disconnects and the flashing process stops before it even begins. Oh how very frustrating!

I found a solution, and this may affect a whole bunch of devices!

Connect the device in desired mode (vol up + connect USB cable for me), run powertop and disable autosuspend in Tunables view, something like this:

After that, my phone keeps connected after running fastboot commands on it!

Edit: I still have to use the old fastboot binary - I’m having exactly the same error regarding the boot partition… Updating the opening post accordingly.


For me it is already set to Bad… so not much to do?

I guess so :slight_smile:

Having said that, my computer still rejects the phone (the fastboot gets stuck and kernel gets tainted and stuff), and I have to fire up my ol’ faithful Windows 8.1… Once again… Oh well!

Thank you! This has saved me some head-banging, as I ran into the same issue when flashing an Xperia X under Arch Linux. Your solution worked perfectly!

1 Like

I’m new to SFOS and have just downloaded Sailfish_OS-Jolla- and been through the instructions for the Mac OS unlock, homebrew & fastboot installation and flashing… however i also face the same error… here’s what i’ve done to get to this point so far…
sudo fastboot devices
CB512E5MAP fastboot
fastboot oem unlock 0x8EE18D8AB4859C33
OKAY [ 1.347s]
Finished. Total time: 1.347s
cd Sailfish_OS-Jolla-
sudo bash ./flash.sh
Detected Mac OS X - Version: 11 2-
Searching device to flash…
Found F5121, baseband:1300-4911_34.4.A.2.50, bootloader:1299-4841
Found 1 devices: CB512E5MAP
Fastboot command: fastboot -s CB512E5MAP
Flashing boot partition…
fastboot: error: Couldn’t parse partition size ‘0x’.
fastboot --version
fastboot version 31.0.1-7187441

So i’ve followed the advice above in this post to the best of my ability but my tech skills fall short and i’m not sure if i need to follow the steps of the original post to resolve my issue. Any help appreciated.

We are working to find a solution for this issue.

So this is apparently a thing:

It was merged just recently, on 29 Mar. However, i can’t reproduce the problem, even with reverting that (or using a mid-March version), so it is hard to tell whether it actually fixes your version of the problem.

To me the code looks like returning a 0 size will case problems too, just slightly later.
But anyway, since i’m already set up to build fastboot on my own, i updated to the latest versions, and pushed a new version to:

I made a release for it, but building it yourself is preferable over trusting random people on the internet. :slight_smile:

The 31.0.1 version mentioned by @beebolbod doesn’t seem to exist neither here or as a tag in the repo. Nor does 7187441 resolve to a version in the repo (platform/system/core) that contains fastboot, so not sure when that is from. Edit: but XDA says that’s from February, so i guess it doesn’t have the fix.

Version 31.0.2 is now available over at Android Studio and the fix is mentioned, too! I’ll give it a spin.

Hello direc85, could you please help me finding a pure data cable? Even a cable titled “data cable” that I bought is charging the phone. Thanks, adam11.