Author Topic: Rooting the Astro Slide  (Read 14180 times)

cam1965

  • Sr. Member
  • ****
  • Posts: 410
    • View Profile
    • http://
Re: Rooting the Astro Slide
« Reply #30 on: January 06, 2023, 11:21:53 am »
I was unable to get mtkclient to work on Mac.  I don't know if it was a problem with my mtkclient install or with the Astro, but I gave up and installed it on a Linux machine and it worked perfectly there.
Same with me. My Mac has dual boot ( Big Sur and linux ).

gidds

  • Sr. Member
  • ****
  • Posts: 324
    • View Profile
Re: Rooting the Astro Slide
« Reply #31 on: January 06, 2023, 12:14:30 pm »
Quote
I was unable to get mtkclient to work on Mac.

That's… frustrating.

As it happens, I do have one little headless box running Linux Mint — but that fails part-way through the ‘pip3 install -r requirements.txt’ step:

Quote
Collecting shiboken6>=6.4.0.1 (from -r requirements.txt (line 7))
  Could not find a version that satisfies the requirement shiboken6>=6.4.0.1 (from -r requirements.txt (line 7)) (from versions: 6.0.0a1.dev1606911628, 6.0.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.1.0, 6.1.1, 6.1.2, 6.1.3, 6.2.0, 6.2.1, 6.2.2, 6.2.2.1, 6.2.3, 6.2.4)
No matching distribution found for shiboken6>=6.4.0.1 (from -r requirements.txt (line 7))

pip3 install shiboken6’ installs version 6.2.4, which is clearly too low.

I'm guessing that may be because that needs python 3.7+ while I have python 3.6.9 — but ‘apt upgrade python3’ reports that as ‘already the newest version’. Is my installation too old? (/proc/version says ‘Linux version 5.4.0-135-generic (buildd@lcy02-amd64-053) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #152~18.04.2-Ubuntu SMP Tue Nov 29 08:23:49 UTC 2022’, but I don't know what most of that means.) I keep it up-to-date in Update Manager and/or apt — is there anything that those will miss?

Sorry if this is dumb stuff, but I know almost as little about Linux admin as I do about python or Android…
   Andy/
Psion 3a → Psion 5 → Psion 5mx → Gemini → Astro

cam1965

  • Sr. Member
  • ****
  • Posts: 410
    • View Profile
    • http://
Re: Rooting the Astro Slide
« Reply #32 on: January 07, 2023, 04:59:01 am »
Quote
I was unable to get mtkclient to work on Mac.

That's… frustrating.

As it happens, I do have one little headless box running Linux Mint — but that fails part-way through the ‘pip3 install -r requirements.txt’ step:

Quote
Collecting shiboken6>=6.4.0.1 (from -r requirements.txt (line 7))
  Could not find a version that satisfies the requirement shiboken6>=6.4.0.1 (from -r requirements.txt (line 7)) (from versions: 6.0.0a1.dev1606911628, 6.0.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.1.0, 6.1.1, 6.1.2, 6.1.3, 6.2.0, 6.2.1, 6.2.2, 6.2.2.1, 6.2.3, 6.2.4)
No matching distribution found for shiboken6>=6.4.0.1 (from -r requirements.txt (line 7))

pip3 install shiboken6’ installs version 6.2.4, which is clearly too low.

I'm guessing that may be because that needs python 3.7+ while I have python 3.6.9 — but ‘apt upgrade python3’ reports that as ‘already the newest version’. Is my installation too old? (/proc/version says ‘Linux version 5.4.0-135-generic (buildd@lcy02-amd64-053) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)) #152~18.04.2-Ubuntu SMP Tue Nov 29 08:23:49 UTC 2022’, but I don't know what most of that means.) I keep it up-to-date in Update Manager and/or apt — is there anything that those will miss?

Sorry if this is dumb stuff, but I know almost as little about Linux admin as I do about python or Android…
Please edit requirements.txt and fill it with the versions less than your system. Even with these versions, it worked for me.
I am running debian 10.
After the install you can run in with the graphical interface ( ./mtk_gui ). Much better than command line.
Good luck.

gidds

  • Sr. Member
  • ****
  • Posts: 324
    • View Profile
Re: Rooting the Astro Slide
« Reply #33 on: January 07, 2023, 05:54:30 pm »
Some progress: I spent a few hours upgrading to the latest Linux Mint (since that was a good idea anyway). Then mtkclient installed OK (as per the instructions). And I've successfully used it to extract the images, with the command:
Code: [Select]
mtk r boot_a,vbmeta_a boot.img,vbmeta.img
(I had to start that command before connecting to the lower/right-hand port on the powered-off phone.)

From the first post in this topic, I'm guessing that the next step is:
Quote
…patch[ed] it via Magisk…

Can you give any more detail on that part please? Magisk seems to be an Android app; I can't see anything about installing or running it on Linux (or Mac), and it's not in apt… Do I need another Android phone for this?
   Andy/
Psion 3a → Psion 5 → Psion 5mx → Gemini → Astro

Dom (shymega)

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: Rooting the Astro Slide
« Reply #34 on: January 07, 2023, 06:46:00 pm »
You could use my tool I derived from Magisk's scripts: https://github.com/shymega/magisk-boot-patch-ci-tool

We use this on my community Planet CI server for rooted kernels for Planet devices.

gidds

  • Sr. Member
  • ****
  • Posts: 324
    • View Profile
Re: Rooting the Astro Slide
« Reply #35 on: January 08, 2023, 06:09:37 pm »
Thanks, Dom, that worked great! (Well, with one amendment: after patching, it tries to write the result into /out/, which doesn't exist on my machine…  I changed it to write to "$(dirname "$BOOTIMAGE")/root-boot.img", so it writes to the same directory as the original.)

And I think my Astro is now rooted! (It'll be a while before I've installed Termux and can be sure — but it now shows Magisk in the app drawer, which is a good sign.)

To save anyone else the hassle, I've formatted exactly what I did into a list of instructions, (just as I'd have liked to see them :) ):

Andy's Instructions For Rooting The Astro

You will need:
  • Astro Slide 5G (obviously).
  • A machine running Linux. (I did this with Linux Mint, but I expect this'll work on most flavours.) It'll need to be a fairly recent version, to satisfy the mtk requirements.
  • USB cable to connect the Astro (USB-C) to the Linux machine.
Procedure:
  • If you've used the Astro already, take a backup of anything you want to keep (apps, data, settings, etc.) as this will wipe it to factory settings.
  • Install mtkclient on the Linux box, following all the Linux instructions here.
  • Extract the boot image from the Astro:
    • Shut down the Astro.
    • mtk r boot_a boot.img
    • Connect the Linux box to the Astro's bottom/right USB port.
    • Wait for that to finish, then disconnect.
    That'll save the image to the file boot.img.
  • Patch the image using Dom's scripts here:
    That'll download and use Magisk to patch it, writing the result as root-boot.img.
  • Write the patched image back to the Astro:
    • mtk w boot_a root-boot.img
    • Connect the Linux box to the Astro's bottom/right USB port.
    • Wait for that to finish, then disconnect.
  • Finally, boot the Astro and check it's all done!

(Earlier posts suggest using adb or fastboot to write the patched image — but although those are both easily available in apt, I couldn't immediately see how to use them, and I didn't want to experiment. Since mtk has a write command corresponding to its read, that seemed the simplest option.)

Thanks all for your help with this! And please let me know any corrections to the above, or anything else I should know.



(Edited to spell out the initial requirements, add the need for an initial backup, bold the important bits, and tweak the wording slightly.)
« Last Edit: January 09, 2023, 09:18:56 am by gidds »
   Andy/
Psion 3a → Psion 5 → Psion 5mx → Gemini → Astro

Dom (shymega)

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: Rooting the Astro Slide
« Reply #36 on: January 08, 2023, 06:49:28 pm »
Glad it worked for you. It writes to `/out` by default as it was originally created for usage in CI, and further to that, Astro rooted kernel images are produced by my CI server, and that's how the container build image is configured.

Dom (shymega)

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: Rooting the Astro Slide
« Reply #37 on: January 08, 2023, 07:00:26 pm »
Andy,

Can I copy your instructions for the Planet community Wiki? I can provide attribution, but I've made a GitHub PR repo for wiki updates, which are then pushed to the wiki site when ready. I thought it'd be good to have a central knowledgebase.

gidds

  • Sr. Member
  • ****
  • Posts: 324
    • View Profile
Re: Rooting the Astro Slide
« Reply #38 on: January 08, 2023, 07:27:35 pm »
Dom, if other people might benefit from those instructions, then I'd be very happy for you to post them elsewhere! (I don't mind about attribution, either way. I'm happy to take credit, though of course much of that was based on earlier work by Noppe, you, and others in this topic.)

And if you do, please post a link back here, in case we can learn from them too! A central knowledgebase is a great idea, and much needed.

(BTW, what does ‘CI’ mean in this context? A Continuous Integration server of some kind? I'm assuming it's not the Channel Islands, nor a Confidential Informant…)
   Andy/
Psion 3a → Psion 5 → Psion 5mx → Gemini → Astro

LinuxGuy

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: Rooting the Astro Slide
« Reply #39 on: January 09, 2023, 12:36:01 am »
Dear Andy thanks a lot for putting all this together. If I got it right, as allways, this wipes all your data?

gidds

  • Sr. Member
  • ****
  • Posts: 324
    • View Profile
Re: Rooting the Astro Slide
« Reply #40 on: January 09, 2023, 07:24:19 am »
If I got it right, as allways, this wipes all your data?

I think so. Others here can probably say for sure, but I'd certainly assume that such a big change can erase all your apps/data/settings and anything else you have stored on the phone, so before doing anything else, make sure you have backups of anything you want to keep! (I'll add that as a first step.)
   Andy/
Psion 3a → Psion 5 → Psion 5mx → Gemini → Astro

cam1965

  • Sr. Member
  • ****
  • Posts: 410
    • View Profile
    • http://
Re: Rooting the Astro Slide
« Reply #41 on: January 09, 2023, 08:02:43 am »
If I got it right, as allways, this wipes all your data?

I think so. Others here can probably say for sure, but I'd certainly assume that such a big change can erase all your apps/data/settings and anything else you have stored on the phone, so before doing anything else, make sure you have backups of anything you want to keep! (I'll add that as a first step.)
Yes , unlocking and rooting the phone will wipe your data.

Dom (shymega)

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: Rooting the Astro Slide
« Reply #42 on: January 09, 2023, 12:42:54 pm »
Dom, if other people might benefit from those instructions, then I'd be very happy for you to post them elsewhere! (I don't mind about attribution, either way. I'm happy to take credit, though of course much of that was based on earlier work by Noppe, you, and others in this topic.)

And if you do, please post a link back here, in case we can learn from them too! A central knowledgebase is a great idea, and much needed.

(BTW, what does ‘CI’ mean in this context? A Continuous Integration server of some kind? I'm assuming it's not the Channel Islands, nor a Confidential Informant…)

OK, I'll just keep it without attribution for now. It should be licensed under CC when I get round to that.

I'll post a link once I merge the PR.

CI is the first term, it's a server I setup, using Planet community members' build VMs for building ROMs and kernels. I can't do that for much longer though, as Planet is giving me access to their BSP and CoDi sources, and I have to use servers approved for that.

Dom (shymega)

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
Re: Rooting the Astro Slide
« Reply #43 on: January 09, 2023, 12:54:15 pm »
Andy,

I've made a PR to the wiki PR repo, which has now been merged and pushed to the wiki.

I modified your tutorial, as you neglected to mention that the bootloader MUST be unlocked, otherwise the Astro will be soft-bricked until repaired.

PR repo: https://github.com/shymega/planet-devices-wiki.prs

Meta repo: https://github.com/shymega/planet-devices

Meta repo wiki: https://github.com/shymega/planet-devices/wiki

gidds

  • Sr. Member
  • ****
  • Posts: 324
    • View Profile
Re: Rooting the Astro Slide
« Reply #44 on: January 09, 2023, 01:29:19 pm »
you neglected to mention that the bootloader MUST be unlocked, otherwise the Astro will be soft-bricked until repaired.

s/neglected to mention/didn't know/  :)

In fact, I still don't fully understand… Do all Astros arrive unlocked, or was I just very lucky that mine wasn't?

And while it's great to include that on the wiki too, could you expand it into idiot-proof instructions like the rest — possibly including a line on what locking is, and how to tell whether an Astro is locked? (“You can do this by using Fastboot” is only helpful if you already know what Fastboot is, how to install it, and how to use it to unlock something — and if you already knew what, you probably wouldn't need to be reading the instructions in the first place!)

The wiki looks great otherwise — except that it doesn't seem to have any of the hyperlinks, which are pretty vital. I'd also suggest copying the bold highlighting too, though that's more subjective.
   Andy/
Psion 3a → Psion 5 → Psion 5mx → Gemini → Astro