badabing2005 / PixelFlasher

Pixel™ phone flashing GUI utility with features.
GNU General Public License v3.0
1.33k stars 111 forks source link

Not working on M1 Macbook Air, working fine on Intel iMac #51

Closed MSTRKKRFT closed 1 year ago

MSTRKKRFT commented 1 year ago

Hi,

First, thanks for this nice tool !

I tried to root my Pixel 7 pro with your tool on the M1 Macbook Air, but it failed after flashing the bootloader (couldn't pass to radio/image flashing). So I bricked my phone, but was able to recover it by flashing manually each files. No big deal here! It seems like PixelFlasher couldn't reboot the phone to pass to the second flash, but I'm really not sure, as it was able to pass from adb to fastboot without issue.

After trying/failing a second time on the macbook I tried the tool on my Intel iMac and everything went smooth !

Tell me if you need more information.

badabing2005 commented 1 year ago

Sorry for your troubles and thanks for reporting and offering to provide more to help out, it goes a long way towards making this tool safer and more robust. What I would need is the support.zip file which you can generate from the help menu. You can generate it now, even though what is done is done, as the logs are kept and are extremely useful for troubleshooting. Don't worry about leaking any sensitive info as the logs are sanitized to REDACT anything that is private.

Thanks

MSTRKKRFT commented 1 year ago

Hi, thanks for your answer !

I couldn't start PixelFlasher (last update) today, it freeze on splash screen, looking at activity monitor I realized that the app tries to launch fastboot & adb at start. Moving/renaming the "platform-tools" folder solve the issue, as PixelFlasher doesn't load adb/fastboot.

By checking macOS activity monitor, I just realized that APT & PixelFlasher are Intel apps, so I guess the culprit here is Rosetta somehow. That would explain why it's working great on my Intel iMac! Hope google will release an ARM version of these tools one day.

About the support.zip file : I did open "files.txt" and my full username is in here multiple times, which is my real name. I saw that it was replaced by "REDACT" in directories but not in rwx permissions. Can I PM you this file somehow ?

Few more information :

badabing2005 commented 1 year ago

Good work.

The freeze at start problem occurs also if I manually install/use platform tools in Users/username/Documents on my M1 mac Is this with using Intel SDK on ARM Mac?

What happens when you open a terminal and issue the commands adb --version and fastboot --version

MSTRKKRFT commented 1 year ago

Yep, SDK v34 would give you the issues you had, I'm surprised it worked on Intel iMac, the issue is that it can't get into userspace fastbootd, maybe it does not have that issue on Intel iMac, but it definitely has that issue on Intel Windows.

Huuum, now that you said that, I did a full clean install using https://flash.android.com/ to start from scratch and be sure everything was back to stock before rooting again with my iMac. I noticed that when using https://flash.android.com/ the "fastbootd" screen did show up, but I'm quite sure (not 100% sure, I wasn't watching the phone all the time) it didn't show up when using PixelFlasher on my iMac. Is it possible that the flash/root using PixelFlasher & APT v34 did work without passing through fastbootd state ? As my phone is working great now, banking apps/google wallet/Netflix (Widevine : L1) and everything is working. In a previous version of my message I said I had to sideload Netflix (showed as not compatible in playstore) but just tried to delete PlayStore appdate/cache and the issue is gone.

What happens when you open a terminal and issue the commands adb --version and fastboot --version

Here is the output :

Android Debug Bridge version 1.0.41 Version 33.0.3-8952118 Installed as /Users/username/Documents/platform-tools/adb

fastboot version 33.0.3-8952118 Installed as /Users/username/Documents/platform-tools/fastboot

Actually, adb/fastboot are working without any issue if I manually do all the steps to flash/root the phone. I used my M1 MacBook to reflash stock bootloader/radio/image after bricking the phone with PixelFlasher.

I noticed that if I first do "cd /Users/username/Documents/platform-tools/" and then just type "adb --version" I get the error "zsh: command not found: adb" But, if I use direct path to adb/fastboot, like so : "/Users/username/Documents/platform-tools/adb --version", then it shows me the output I just sent you, with adb/fastboot versions. Maybe this info is the most useful.

badabing2005 commented 1 year ago

I noticed that if I first do "cd /Users/username/Documents/platform-tools/" and then just type "adb --version" I get the error "zsh: command not found: adb" But, if I use direct path to adb/fastboot, like so : "/Users/username/Documents/platform-tools/adb --version", then it shows me the output I just sent you, with adb/fastboot versions. Maybe this info is the most useful.

That's because adb is not in the path, and current directory on MAC and Linux is intentionally not added to the path, so you'd have to invoke it like this (while in the correct directory) ./adb --version

I find it odd that they work from a terminal but not in PF So if you launch PF, and set the Android Platform Tools path to: /Users/username/Documents/platform-tools/ does PF give you an error or does it hang or display the version? Do you see any errors in the console?

By the way, the configuration file is at: /Users/username/Library/Application Support/PixelFlasher/PixelFlasher.json You can clear the value for "platform_tools_path" if it is hanging.

MSTRKKRFT commented 1 year ago

That's because adb is not in the path, and current directory on MAC and Linux is intentionally not added to the path, so you'd have to invoke it like this (while in the correct directory) ./adb --version

Yes you're right, I forget about that, I'm not using cli tools that often.

I find it odd that they work from a terminal but not in PF So if you launch PF, and set the Android Platform Tools path to: /Users/username/Documents/platform-tools/ does PF give you an error or does it hang or display the version? Do you see any errors in the console?

No error, the console display that :

2023-02-16 14:04:15 Selected Platform Tools Path: /Users/username/Documents/platform-tools. SDK Version: 33.0.3-8952118

But if I close PixelFlasher and start it again, then it hangs on the splash screen until I rename platform-tools folder or edit the config file...

badabing2005 commented 1 year ago

Can you submit support.zip file? You can modify the files.txt to redact your name.

MSTRKKRFT commented 1 year ago

I can also see my username in PixelFlasher4.db, but I don't want to mess the file modifying it. Can I PM you that somehow ? I don't mind you seeing that, I just don't want that on a public website.

badabing2005 commented 1 year ago

I don't the db file to troubleshoot this issue. If I do, I'll let you know, please send the rest.

MSTRKKRFT commented 1 year ago

Ok great, here is the zip file

badabing2005 commented 1 year ago

Thanks for the support file. I see nothing obvious in there. Here's what I know. When you don't have the Android Platform Tools set, and you select a path, it looks for adb and fastboot, issues the version command of each, makes sure it responds correctly, and then displays the version (that part is working fine) At this point it does not do a device scan. If you quit and restart, and PixelFlasher starts with Android Platform Tools Path set, it does automatic device scan at startup

2023-02-16 15:11:52 Selected Platform Tools Path:
/Users/REDACTED/Documents/platform-tools.
SDK Version: 33.0.3-8952118

Please Process the firmware!

Loading Device list ...
This could take a while, please be patient.

So the problem is with scanning devices. To do that PixelFlasher issues two commands: adb devices and fastboot devices and tries to parse the output of those.

I suspect that after setting the Platform Tools and attempting to scan for devices, you would run into the same issue. What I'd like you to do is: Issue these two commands from terminal adb devices and fastboot devices You can redact the device IDs, but I need the full output of those to see if there is anything that would cause the parsing to break. On the other hand if any of those commands hang from terminal, then that would explain the situation of why PixelFlasher is hanging.

Thanks for your continued efforts to help with troubleshooting this issue.

MSTRKKRFT commented 1 year ago

Ok, you just made me realize something else. When the phone is plugged on the M1 mac, with ADB ON, PixelFlasher is starting without any issue (sorry I didn't try that earlier). It only freezes when the phone is not plugged in (with APT path already set). On my Intel iMac, I can start PixelFlasher without the phone plugged in without any issue (with APT path also set).

Here is the output for adb/fastboot device :

username@MacBook-Air platform-tools % ./adb devices List of devices attached DEVICEIDREDACT device username@MacBook-Air platform-tools % ./adb reboot bootloader username@MacBook-Air platform-tools % ./fastboot devices
DEVICEIDREDACT fastboot

Again, using adb/fastboot directly with terminal works fine, only PixelFlasher had troubles using the tools. Did you find the logs where the flash failed ? You should have 2 or 3 attempts on the 11 of February.

Edit : If I do a "Dry Run" it should not do anything, right ? Maybe I can try that to see if latest PixelFlasher version & previous APT version helped. As we can't do NAND backup with TWRP yet, I don't want to re-flash the phone as I need it on a daily basis and can't spend a day on re-setup everything right now.

badabing2005 commented 1 year ago

Thanks for the tests, I don't have a Mac, so your feedback and testing is invaluable towards fixing such issues.

When you select your flash options and press the flash button, PF display a dialog of your choices and asks for you confirmation before proceeding, you can cancel at that point, and nothing will happen. What it also does is output into console the script that it would execute if you proceed. You can inspect that script. What dry run actually does is it generates that script as if it's not a dry run, adding an echo command on the actual lines that would do the flashing. So what you would be getting is basically echo statements and few reboots. No flashing will be attempted.

Thanks

MSTRKKRFT commented 1 year ago

On my M1 mac, phone not plugged in :

(no hang)

And then it hangs, waiting for a device, I guess. I have to close/reopen the terminal if I want to use another command.

I will try the Dry Run option to see if PixelFlasher is able to reboot the Pixel in all the different modes. I'm keeping you in touch.

Edit : just did the same adb/fastboot commands on my Intel iMac with phone not plugged in and fastboot doesn't hang, it just doesn't show any output and then back to username@iMac platform-tools %

MSTRKKRFT commented 1 year ago

Here is the output of the Dry Run

==============================================================================
 2023-02-17 14:25:22 PixelFlasher 4.8.0.0              Flashing Phone    
==============================================================================
Android Platform Tools Version: 33.0.3-8952118
Rebooting device DEVICEIDREDACT to bootloader ...
Waiting 10 seconds ...

Selected Device on 2023-02-17 14:25:39:
    Device ID:                       DEVICEIDREDACT
    Device Model:                    cheetah
    Device Active Slot:              b
    Device Mode:                     f.b
    Device Unlocked:                 True

2023-02-17 14:25:39 Flashing device DEVICEIDREDACT ...
Switching active slot to the other ...
/Users/REDACT/Documents/platform-tools/fastboot -s DEVICEIDREDACT --set-active=other
/Users/REDACT/Documents/platform-tools/fastboot -s DEVICEIDREDACT flash bootloader bootloader-cheetah-cloudripper-1.0-9288096.img
Rebooting into bootloader                          OKAY [  0.000s]
Finished. Total time: 0.000s
/Users/REDACT/Documents/platform-tools/fastboot -s DEVICEIDREDACT flash radio radio-cheetah-g5300g-220923-221028-b-9229469.img
Rebooting into bootloader                          OKAY [  0.000s]
Finished. Total time: 0.001s
/Users/REDACT/Documents/platform-tools/fastboot -s DEVICEIDREDACT --skip-reboot update image-cheetah-tq1a.230205.002.zip
rebooting to bootloader ...
/Users/REDACT/Documents/platform-tools/fastboot -s DEVICEIDREDACT reboot bootloader
Sleeping 5-10 seconds ...
flashing pf_boot ...
/Users/REDACT/Documents/platform-tools/fastboot -s DEVICEIDREDACT flash init_boot pf_boot.img
rebooting to system ...
Rebooting                                          OKAY [  0.000s]
Finished. Total time: 0.000sREDACT
2023-02-17 14:26:00 Done!
Flashing elapsed time: 39 seconds
------------------------------------------------------------------------------

So according to the output, everything went fine, the phone rebooted like 3 times, but I didn't see any fastbootd mode showing up.

badabing2005 commented 1 year ago

And then it hangs, waiting for a device, I guess. I have to close/reopen the terminal if I want to use another command.

That is the problem why PF is hanging, fastboot never completes. Sadly there is nothing I can do with that, Google has to fix this. You won't be able to flash on M1 just using the factory firmware and flash_all script from it, it will hang and never complete.

So according to the output, everything went fine, the phone rebooted like 3 times, but I didn't see any fastbootd mode showing up.

PF does not attempt to switch to fastbootd mode, the command /Users/REDACT/Documents/platform-tools/fastboot -s DEVICEIDREDACT --skip-reboot update image-cheetah-tq1a.230205.002.zip is actually responsible for it. While it is flashing the individual images in the image-cheetah-tq1a.230205.002.zip it reboots to fastbootd, this is part of the fastboot's update function. Considering that dry run just echos that command instead of executing it (to avoid actually flashing) the device never gets into fastbootd mode.

Have we addressed all your concerns?

Thanks for your help.

MSTRKKRFT commented 1 year ago

Yes, we finally found the culprit! I will use my Intel iMac instead of the M1 MacBook for now, hoping that Google will release an ARM version of APT soon.

In the meantime, it's maybe a good idea to inform others on that situation in PixelFlasher Supported platforms section.

Have a great day, and thanks for your help & you great tool again !

ammmze commented 1 year ago

FYI ... I also ran into this on my M1 Macbook Air. I was running platform tools 33.something. I found there was an update, so I installed the latest version (brew reinstall android-platform-tools --cask), which is currently 34.0.4-10411341 and it looks to have resolved the issues with fastboot commands 1) hanging when the device is not connected AND 2) hanging when doing fastboot reboot fastboot.

badabing2005 commented 1 year ago

That's correct, although Android Platform Tools 34.x has many issues, one of the good things it does is it never reboots to userspace fastboot (fastbootd) and flashes everything in fastboot (bootloader mode).