[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 3.4.0.24 on Manjaro Linux (not officially supported, I know!) and I was constantly hitting this wall:

$ sudo ./flash.sh
----8<----
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?

11 Likes

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.

2 Likes

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

Hi,
I’m new to SFOS and have just downloaded Sailfish_OS-Jolla-4.0.1.48-f5121-0.2.2.42 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
Password:
CB512E5MAP fastboot
fastboot oem unlock 0x8EE18D8AB4859C33
OKAY [ 1.347s]
Finished. Total time: 1.347s
cd Sailfish_OS-Jolla-4.0.1.48-f5121-0.2.2.42
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:
https://android.googlesource.com/platform/system/core/+/a495be742c6ec7609c85f0e6b1bfe1ec50c2a86a

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.

I found and alternative method to do it:

# echo -1 > /sys/module/usbcore/parameters/autosuspend

Now when you connect the phone, it won’t be suspended! And now I’m having success with my main computer, even with a USB3 port, in the front panel, with a long cable! First try!

Perhaps this could be integrated to flash.sh to further improve compatibility @jovirkku?

Edit: I’m using Manjaro Linux 64-bit, with fastboot version 31.0.2 which contains the fix.

Edit edit: I still had to flash my sisters brand new Xperia 10 II twice to resolve boot loop (with a broken Android mascot quickly flashing on the screen). Both of the X10II’s I bought did exactly the same thing.

(To make it survive reboot, you can add kernel parameter usbcore.autosuspend=-1 to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub.)

3 Likes

My friend bought an X10II, too, and asked me to flash Sailfish X (4.1) on it (paid version). All went well, but the flashing srill had to be done twice, because the device went into boot loop after the initial successful flash.

Three out of three devices so far.

Did you let the phone boot up to the UI after unlocking the bootloader and before installing Sailfish?

We will consider that. Thanks for the hint.

1 Like

No, I didn’t. I had somehow glanced over that part in the readme… Whoops. Thanks for pointing it out :slight_smile:

Hi.

I just stumbled on this post and I am just curious as to how this could be related to a problem I have in my Xperia 100ii.

All the flashing process goes perfect, but for some reason, when I boot the first time into Sailfish, the sine tone mentioned in the flashing instructions does not play at all, and after that, Sailfish boots ok, except for pulseaudio dying and some of the filesystems not mounted at boot time.

See here:

It’s been almost one month since I opened an issue at Zendesk, with boot logs and stuff…to no avail.

Best Regards.
Pasko

“Disable autosuspend while flashing” was added to OS release 4.4.0.

1 Like