[ROOT] G2x Easy Root for Mac and Linux

Search This thread

jnichols959

Senior Member
Mar 1, 2011
156
98
NOTE: does not work with gingerbread 2.3.x. The exploit used by this (and SuperOneClick) does not work on gingerbread. It won't hurt anything if you try to run it (at least not in my experience) but it does not root the phone.

I put together a couple shell scripts that are meant to make rooting and unrooting a G2x on Mac or Linux dead simple (folks claim it works on the Optimus 2X as well). I only tested the linux version on Ubuntu 10.10 (32 and 64-bit) so let me know if you run into any issues. Some folks have had success using the gingerbreak app to root the G2x so that may be an option too - though I haven't tried it myself.

I was motived to do so after reading mhaedo's excellent thread that uses SuperOneClick (http://xdaforums.com/showthread.php?t=1039985). Head over there if you want to root from Windows or want to use SuperOneClick via mono on Linux/Mac.

The scripts use the same files as SuperOneClick 1.8 so mad props to CLShortFuse. Note that they won't work on PowerPC macs.

If you like the scripts please click the Thanks button. To root, download the attached G2xRootMacLinux zip file, expand it and:

  1. enable USB debugging on your phone (Settings -> Applications -> Development)
  2. connect your phone via USB. no drivers or android sdk needed.
  3. double-click root.command (Mac) or run it as you would any shell script (Linux)
  4. wait for the script to finish and your phone to reboot

Unroot is similar but run unroot.command instead of root.command. It's only designed to unroot devices rooted with the root.command script.

I also created a thread for flashing clockworkmod (or stock) recovery from the mac though it's not as simple. If you want clockworkmod for a safety net when installing ROMs (highly recommended) check it out and click Thanks if it helps: http://xdaforums.com/showthread.php?t=1099281

Problems/Issues

If you get something like "No connected device found" when running the script make sure usb debugging is enabled, the phone is powered on and plugged in to the computer via USB.

On Mac OS X EasyTether is known to cause adb to break, which is what the scripts use to talk to the phone. I'll look into a fix in the scripts to disable/enable the kernel module automatically but if you have EasyTether installed you can try the steps at http://www.mobile-stream.com/easytether/android_faq.html#adbmacosx before running root/unroot.

If you're still getting "No connected device found" and you're on a mac, try the following and post the results:

  1. open Terminal (Applications -> Utilities)
  2. type the following: sudo tail -Fn 0 /var/log/kernel.log (that's a zero)
  3. plug the phone into the computer
  4. copy the lines that show up in Terminal and post them here

If you want to learn more about how the G2x is rooted I put a small Readme.txt file in the tar that explains what the scripts do. You could always read the shell scripts too :)

Edit: hypmatize helped me find a bug when the path to the script had a space in it. fixed in 0.4
Edit: Kdogg71 and artismyrevolt helped me find and fix some permissions problems on some stock linux distros. fixed in 0.5
 

Attachments

  • G2xRootMacLinux_v0.5.zip
    1.2 MB · Views: 10,354
  • G2xRootMacLinux_v0.5.md5.txt
    59 bytes · Views: 1,607
Last edited:

hypmatize

Senior Member
Jul 19, 2009
202
16
SoCal
I keep getting command not found... do I need to run this with su privileges? if so, how? This is what I see in the Terminal window:


Checking for connected device...
/Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 10: ensureDevice: command not found
/Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 12: isRooted: command not found
/Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 21: checkForExitEarly: command not found
/Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 23: pushAndRunPsneuter: command not found
Waiting for device...
/Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 28: ensureDevice: command not found
Remounting /system read/write...
/Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 35: remount: command not found
Pushing su to /system/bin/su...
/Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 38: push: command not found
/Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 39: shell: command not found
Pushing busybox to /system/bin/busybox...
/Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 42: push: command not found
/Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 43: shell: command not found
Installing Superuser.apk android application...
/Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 46: push: command not found
Removing psneuter from device...
/Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 49: removePsneuter: command not found

Rebooting device...
reboot: Operation not permitted


I'm running 10.6 (snow leopard) btw

followed everything in the instructions
 
Last edited:
  • Like
Reactions: jnichols959

jnichols959

Senior Member
Mar 1, 2011
156
98
I keep getting command not found... do I need to run this with su privileges? if so, how? This is what I see in the Terminal window:


Checking for connected device...
/Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 10: ensureDevice: command not found
...

Rebooting device...
reboot: Operation not permitted


I'm running 10.6 (snow leopard) btw

followed everything in the instructions

Are you running this by double clicking the root.command file or are you running it via terminal? I'll PM you with some more info not fit for public consumption ;)
 
  • Like
Reactions: hypmatize

bguzmanz2

Senior Member
Oct 22, 2008
85
1
you are awesome!! i prefer not to use adb so i hadn't rooted my g2x until now!! thank you so much.
 

baykakes

Senior Member
Apr 24, 2011
57
3
Thank you so much it worked like a charm... quick fast and easy... Much better experience than with my returned Atrix (Mac 10.4)
 
Last edited:
  • Like
Reactions: jchp598

Kdogg71

Member
Aug 27, 2008
15
0
The scripted functions cannot find my device...

Code:
Checking for connected device...
No connected device found.
Press Enter to quit:

I use ubuntu 10.10 32-bit and USB Debugging is enabled. I tried disconnecting and reconnecting the device.

Any thoughts? Thanks for the work.


EDIT: adb shows me this:
Code:
List of devices attached 
????????????	no permissions
 
Last edited:

artismyrevolt

Senior Member
Nov 11, 2009
70
5
The scripted functions cannot find my device...

Code:
Checking for connected device...
No connected device found.
Press Enter to quit:

I use ubuntu 10.10 32-bit and USB Debugging is enabled. I tried disconnecting and reconnecting the device.

Any thoughts? Thanks for the work.


EDIT: adb shows me this:
Code:
List of devices attached 
????????????	no permissions

Start your adb server with sudo first. Then try it.

Like this:

adb kill-server
sudo adb devices

Then see if your script works.
 

jnichols959

Senior Member
Mar 1, 2011
156
98
The scripted functions cannot find my device...

Code:
Checking for connected device...
No connected device found.
Press Enter to quit:

I use ubuntu 10.10 32-bit and USB Debugging is enabled. I tried disconnecting and reconnecting the device.

Any thoughts? Thanks for the work.


EDIT: adb shows me this:
Code:
List of devices attached 
????????????	no permissions

Yes, sorry, I forgot about the udev permissions on Linux. I'd like it to work without messing with sudo or permissions (manually). Let me see what I can do.
 

Kdogg71

Member
Aug 27, 2008
15
0
Start your adb server with sudo first. Then try it.

Like this:

adb kill-server
sudo adb devices

Then see if your script works.

Thanks, that did it. I tried a number of things as root...looks like I overlooked starting adb as root.

I am rooted now, tested with "su" from terminal emulator; it is persistent through reboots, in case anyone was doubtful.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 34
    NOTE: does not work with gingerbread 2.3.x. The exploit used by this (and SuperOneClick) does not work on gingerbread. It won't hurt anything if you try to run it (at least not in my experience) but it does not root the phone.

    I put together a couple shell scripts that are meant to make rooting and unrooting a G2x on Mac or Linux dead simple (folks claim it works on the Optimus 2X as well). I only tested the linux version on Ubuntu 10.10 (32 and 64-bit) so let me know if you run into any issues. Some folks have had success using the gingerbreak app to root the G2x so that may be an option too - though I haven't tried it myself.

    I was motived to do so after reading mhaedo's excellent thread that uses SuperOneClick (http://xdaforums.com/showthread.php?t=1039985). Head over there if you want to root from Windows or want to use SuperOneClick via mono on Linux/Mac.

    The scripts use the same files as SuperOneClick 1.8 so mad props to CLShortFuse. Note that they won't work on PowerPC macs.

    If you like the scripts please click the Thanks button. To root, download the attached G2xRootMacLinux zip file, expand it and:

    1. enable USB debugging on your phone (Settings -> Applications -> Development)
    2. connect your phone via USB. no drivers or android sdk needed.
    3. double-click root.command (Mac) or run it as you would any shell script (Linux)
    4. wait for the script to finish and your phone to reboot

    Unroot is similar but run unroot.command instead of root.command. It's only designed to unroot devices rooted with the root.command script.

    I also created a thread for flashing clockworkmod (or stock) recovery from the mac though it's not as simple. If you want clockworkmod for a safety net when installing ROMs (highly recommended) check it out and click Thanks if it helps: http://xdaforums.com/showthread.php?t=1099281

    Problems/Issues

    If you get something like "No connected device found" when running the script make sure usb debugging is enabled, the phone is powered on and plugged in to the computer via USB.

    On Mac OS X EasyTether is known to cause adb to break, which is what the scripts use to talk to the phone. I'll look into a fix in the scripts to disable/enable the kernel module automatically but if you have EasyTether installed you can try the steps at http://www.mobile-stream.com/easytether/android_faq.html#adbmacosx before running root/unroot.

    If you're still getting "No connected device found" and you're on a mac, try the following and post the results:

    1. open Terminal (Applications -> Utilities)
    2. type the following: sudo tail -Fn 0 /var/log/kernel.log (that's a zero)
    3. plug the phone into the computer
    4. copy the lines that show up in Terminal and post them here

    If you want to learn more about how the G2x is rooted I put a small Readme.txt file in the tar that explains what the scripts do. You could always read the shell scripts too :)

    Edit: hypmatize helped me find a bug when the path to the script had a space in it. fixed in 0.4
    Edit: Kdogg71 and artismyrevolt helped me find and fix some permissions problems on some stock linux distros. fixed in 0.5
    1
    Very nice, thanks!
    1
    I keep getting command not found... do I need to run this with su privileges? if so, how? This is what I see in the Terminal window:


    Checking for connected device...
    /Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 10: ensureDevice: command not found
    /Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 12: isRooted: command not found
    /Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 21: checkForExitEarly: command not found
    /Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 23: pushAndRunPsneuter: command not found
    Waiting for device...
    /Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 28: ensureDevice: command not found
    Remounting /system read/write...
    /Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 35: remount: command not found
    Pushing su to /system/bin/su...
    /Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 38: push: command not found
    /Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 39: shell: command not found
    Pushing busybox to /system/bin/busybox...
    /Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 42: push: command not found
    /Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 43: shell: command not found
    Installing Superuser.apk android application...
    /Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 46: push: command not found
    Removing psneuter from device...
    /Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 49: removePsneuter: command not found

    Rebooting device...
    reboot: Operation not permitted


    I'm running 10.6 (snow leopard) btw

    followed everything in the instructions
    1
    I keep getting command not found... do I need to run this with su privileges? if so, how? This is what I see in the Terminal window:


    Checking for connected device...
    /Users/Ahmed/Documents/android stuff/G2X /rooting stuff/G2xRootMacLinux_v0.3/root.command: line 10: ensureDevice: command not found
    ...

    Rebooting device...
    reboot: Operation not permitted


    I'm running 10.6 (snow leopard) btw

    followed everything in the instructions

    Are you running this by double clicking the root.command file or are you running it via terminal? I'll PM you with some more info not fit for public consumption ;)
    1
    Thank you so much it worked like a charm... quick fast and easy... Much better experience than with my returned Atrix (Mac 10.4)