3

I'm trying to flash a custom ROM on my Android smartphone using fastboot on the Ubuntu based Pop!_OS. When trying to flash the recovery, the command does not output anything and is stuck. However I don't face this issue when using Windows 10 with the same hardware.

./fastboot flash recovery recovery.img

Environment:

                 /////////////                user@pop-os 
             /////////////////////            ------------- 
          ///////*767////////////////         OS: Pop!_OS 20.04 LTS x86_64 
        //////7676767676*//////////////       Host: 80F6 Lenovo B40-80 
       /////76767//7676767//////////////      Kernel: 5.15.8-76051508-generic 
      /////767676///*76767///////////////     Uptime: 54 mins 
     ///////767676///76767.///7676*///////    Packages: 1896 (dpkg), 27 (flatpak) 
    /////////767676//76767///767676////////   Shell: bash 5.0.17 
    //////////76767676767////76767/////////   Resolution: 1366x768 
    ///////////76767676//////7676//////////   DE: GNOME 
    ////////////,7676,///////767///////////   WM: Mutter 
    /////////////*7676///////76////////////   WM Theme: Pop 
    ///////////////7676////////////////////   Theme: Pop-dark [GTK2/3] 
     ///////////////7676///767////////////    Icons: Pop [GTK2/3] 
      //////////////////////'////////////     Terminal: gnome-terminal 
       //////.7676767676767676767,//////      CPU: Intel i5-5200U (4) @ 2.700GHz 
        /////767676767676767676767/////       GPU: Intel HD Graphics 5500 
          ///////////////////////////         Memory: 2679MiB / 7865MiB 
             /////////////////////
                 /////////////

(Also tried, unsuccessfully in the older Kubuntu 18.04, with the same result)

I've tried using both the system supplied (Ubuntu repository) version of fastboot and the one shipped with Android's platform tools. Installed the system version with sudo apt install android-tools-adb android-tools-fastboot.

fastboot Versions:

user@pop-os:~$ fastboot --version
fastboot version 1:8.1.0+r23-5ubuntu2
Installed as /usr/lib/android-sdk/platform-tools/fastboot
user@pop-os:~/Android/platform-tools$ ./fastboot --version
fastboot version 31.0.3-7562133
Installed as /home/user/Android/platform-tools/fastboot

Prerequisites:

Have configured udev rules as shown below (to avoid "no permission" error when running fastboot without sudo)

#/etc/udev/rules.d/51-android.rules

SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev"

And added current user to the 'plugdev' group with sudo usermod -aG plugdev $LOGNAME

Issue:

After rebooting into fastboot mode through either the hardware keys (VOLUME UP + POWER) or the command ./adb reboot bootloader, my device is recognized by fastboot.

user@pop-os:~/Android/platform-tools$ ./fastboot devices
XXXXXXXX04HP    fastboot

But when I try to flash the recovery, the command gives no output and is stuck

user@pop-os:~/Android/platform-tools$ ./fastboot flash recovery recovery.img

And just when I unplug the device from the PC, it gives an error

user@pop-os:~/Android/platform-tools$ ./fastboot flash recovery recovery.img
Sending 'recovery' (21517 KB)                      FAILED (Write to device failed (No such device))
fastboot: error: Command failed

Conclusion:

As recommended in the hyperlinked guide and many other resources, I have tried using different USB ports (both 2.0 & 3.0), different cables and, as mentioned, different PC and version of Ubuntu. Nothing resolved the issue.

However, using Windows 10 with the same PC (its dual-booted), USB port, cable and the mobile device, I was able to successfully flash the recovery and, later, also the ROM.

There are similar questions to this one on other StackExchange sites, with some whose accepted answers are not very helpful and most of them are old. Besides, as advised by @alecxs here, this issue seems to be specific to Linux based systems. I would really appreciate some help with this.

Thanks in advance for your inputs.

Attachments:

  1. dmesg grep usb
  2. dmesg alert,crit,err,warn
4
  • 1
    @alecxs i have update the post with links to dmesg outputs. i don't see any errors related to usb as such. Commented Dec 31, 2021 at 3:02
  • thx for the update. according to your comments in dmesg log I can only imagine some usb-speed related issue with linux kernel, but that's guesswork. you need some expert Commented Dec 31, 2021 at 8:21
  • @alecxs okay. i might be at the right place then :). also i did receive an update when i was trying this out. so i can say that i've tried it over two diff kernels. Commented Dec 31, 2021 at 13:07
  • if someone could point me to a specific linux distro or kernel version where fastboot works without any issues i would give it a try. Commented Dec 31, 2021 at 13:39

3 Answers 3

5

I had the same issue on a fresh install of Pop!_OS 22.04, whether I was using fastboot from Google (their platform tools package) or the one available in apt (apt install android-tools-fastboot). Then I decided to try Ubuntu 22.04 and it behaved the same way. The suggestion from this answer worked for me on Ubuntu, so I assume it'll work on Pop as well:

  1. Remove cable / keep cable to phone unattached
  2. Execute fastboot ... command
  3. Only when it shows "`> waiting for device", attach the phone
  4. The command works as expected (at least for me)

Hope that helps!

2
  • Hi Alan, When I re-connect the phone after running the fastboot flash command, sometimes nothing happens and other times the phone comes out of Fastboot mode with a message "Press any key to shutdown". I am not sure, but I think this happened even when I ran the command from Windows once or twice. But eventually, as mentioned, it worked from Windows. Let me know if I can try something else. Meanwhile I will give it a try from another Linux machine and update if there's any change. Commented Feb 4, 2023 at 8:53
  • YES ! It worked for me with Windows 11 on April 2025 (latest version). I had the same problem, and I followed your indications: Holly Molly Malone, success at the first try ! thanks a lot. Commented Apr 13 at 10:13
0

Look at syslog for fwupd errors.

If it's is your case:

I started to searching about fwupd, and I realize that it's a tool to update firmware and it has a daemon that listens to new devices attached in "fastboot mode".

The cause

In a recent version of fwupd was introduced support to update firmware of some vendors like Lenovo that had bought Motorola.

So when we attache the phone Motorola (in my case G7 Play), the fwupd daemon tries to recognize the device bootloader of this vendor by the command getvar version-bootloader, But that fastboot mode isn't the type supported by fwupd, because android dont have the version-bootloader` variable and here starts the bug.

So fwupd throw the error failed to add device ...: failed to getvar version-bootloader: no response to read, and it isn't unable to hangup the devices port. Now fastboot CLI of android can recognize the device in fastboot mode, but when we send command to the device, fastboot CLI wait for fwupd hangup to do it, but never happen. ("freezing command")

More about you can look here: https://github.com/fwupd/fwupd/issues/3187

Solution (my solution)

I just removed all the package fwupd, but I really removed, not disable like they said in the issue https://github.com/fwupd/fwupd/issues/3187

Probably a downgrade to a version that don't add those vendors could solve too.

Now any version of fastboot CLI is working in Ubuntu and Pop OS!

3
  • Hi @ayelsew, thanks a lot for taking the time to research and post this answer. But I tested the solution and it still isn't working for me. I have an Asus device. I removed fwupd completely as you have suggested here however, I had to use apt remove fwupd and apt autoremove to do it after modifying the dpkg status. I checked my syslog again through dmesg and don't see any errors. Commented May 31, 2023 at 18:26
  • To others - you can also follow this issue in GitHub where @ayelsew has commented about the same. Commented May 31, 2023 at 18:32
  • 1
    Solution worked perfectly, thank you. For my case it was sufficient to temporary stop the service: systemctl stop fwupd. Use of USB hub was required as well. Commented Nov 10, 2024 at 13:25
0

If you use LineageOS, you can tap Advanced -> Enter fastboot in recovery into fastbootd mode to solve this problem.I don't know the principle about this.But it will work fine.

In fastboot mode:

3m46s ⊘ fastboot devices                                                         ⌂ 10:13
6d499f7d     fastboot

◉ fastboot flash boot Downloads/boot.img                          ⌂ 10:14
^C

In fastbootd mode:

⊘ fastboot devices                                                               ⌂ 10:16
6d499f7d     fastbootd

◉ fastboot flash boot Downloads/boot.img                          ⌂ 10:16
Sending 'boot' (65536 KB)                          OKAY [  1.603s]
Writing 'boot'                                     OKAY [  0.279s]
Finished. Total time: 1.932s

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.