Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tingle script hangs after "Remounting /system..." #22

Open
ecanja opened this issue Jan 27, 2017 · 17 comments
Open

Tingle script hangs after "Remounting /system..." #22

ecanja opened this issue Jan 27, 2017 · 17 comments

Comments

@ecanja
Copy link

ecanja commented Jan 27, 2017

I want to patch my phone (Samsung Galaxy S3 Mini with unofficial CM12.1) with Tingle and it seemed to work, but it didn't finish the process. This is how far I got in the (Linux) Terminal:

$ python main.py 
MENU

    1 - Patch file from a device (adb)
    2 - Patch file from the input folder

> 1

 *** OS: Linux 4.4.0-59-generic (linux)
 *** Mode: 1
 *** Working dir: /tmp/Tingle-3sT0Ca
 *** Selected device: 479000eae2b811ba
 *** Pulling framework from device...
      DEBUG: 4004 KB/s (5535794 bytes in 1.349s)
 *** Decompressing framework...
      DEBUG: Decompressing framework.jar
 *** Disassembling classes...
      DEBUG: Disassembling framework/classes.dex
 *** Patching...
 *** Detected: Android 5.x / CyanogenMod 12
 *** Patching succeeded.
 *** Reassembling classes...
      DEBUG: Assembling out/classes.dex
 *** Recompressing framework...
      DEBUG: Compressing framework.jar
 *** Copying the patched file to the output folder...
 *** Rooting adbd...
      DEBUG: restarting adbd as root
 *** Unlocked ADB: True
 *** Remounting /system...


At this point, it stops going further, but it didn't crash. I'm not able to get a logcat (adb logcat in a different Terminal seems to hang as well and doesn't produce any output).

Any idea what could cause this? And what to do to get around?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@ale5000-git
Copy link
Owner

It is possibly a bug in the ROM.

Can you please try what happen if you run these commands from terminal?
adb root
adb remount

@ecanja
Copy link
Author

ecanja commented Jan 27, 2017

It is possibly a bug in the ROM.

Definitely possible.

I'm still in the state of the hanging script and any adb commands don't do anything but hanging as well.

EDIT: Strg + C in the Terminal gives:

Traceback (most recent call last):
  File "main.py", line 531, in <module>
    enable_device_writing(chosen_one)
  File "main.py", line 219, in enable_device_writing
    remount_check = subprocess.check_output([DEPS_PATH["adb"], "-s", chosen_device, "remount", "/system"]).decode("utf-8")
  File "/usr/lib/python2.7/subprocess.py", line 567, in check_output
    output, unused_err = process.communicate()
  File "/usr/lib/python2.7/subprocess.py", line 791, in communicate
    stdout = _eintr_retry_call(self.stdout.read)
  File "/usr/lib/python2.7/subprocess.py", line 476, in _eintr_retry_call
    return func(*args)

And now, adb root (already ran as root) and adb remount (successful) go through without failure.

Don't know if that is of any help...

@ale5000-git
Copy link
Owner

ale5000-git commented Jan 27, 2017

@ecanja: Please try to reboot the phone, run the 2 commands (without running Tingle) to see what happens and post the ouput.

@ecanja
Copy link
Author

ecanja commented Jan 27, 2017

Ok, did that:

$ adb logcat
# lot of output, worked as usual
$ adb shell
shell@golden:/ $ exit
~$ adb root
restarting adbd as root
~$ adb remount
^C
~$ adb logcat
^C
~$ adb shell
^C
~$

The first command adb root was ok, but adb remount hang up. Moreover, the usual adb commands adb logcat and adb shell were fine before this, but got stuck afterwards.

Does this mean that adb remount is not working on my phone and somehow crashes adb?

@ale5000-git
Copy link
Owner

ale5000-git commented Jan 27, 2017

@ecanja: It is possible.

adb remount remount the system partition as read-write.

Try this:

  • Restart the phone.
  • Run mount -o remount,rw /system in Terminal (with root access) inside the phone.
  • After this, retry to use adb remount (in this case it shouldn't do anything since it is already read-write).

And see if it stuck.

@ecanja
Copy link
Author

ecanja commented Jan 27, 2017

I have no terminal installed, but I did this and it stuck:

$ adb shell
shell@golden:/ $ su
root@golden:/ # mount -o rw,remount,rw /system
root@golden:/ # exit
shell@golden:/ $ exit
$ adb root
restarting adbd as root
~$ adb remount
^C
~$

@ale5000-git
Copy link
Owner

@ecanja: Try to update adb on your pc, just in case there is a problem in it, there should be version 1.0.36 if I'm not wrong.

@ecanja
Copy link
Author

ecanja commented Jan 27, 2017

I updated adb, but the problem remains. I guess, it's an issue with the ROM. Seems as if I need to go with XPosed for signature spoofing.

Nevertheless, thanks a lot for your help!

@ale5000-git
Copy link
Owner

ale5000-git commented Jan 28, 2017

@ecanja: Probably I cannot fix it in the script if it is a ROM issue, but just for patching you can also do it from recovery.
You just need to enter in recovery, mount the system partition, and then run Tingle on the pc.

@georgedorn
Copy link

georgedorn commented Mar 13, 2017

Some ROMs / devices just don't let you remount /system in read-write mode via adb. I'm on a OnePlus X and no ROM I've put on it has allowed this to work.

Here is a workaround. Start in the tingle repo. You'll also need an su binary on your phone.

adb pull /system/framework/framework.jar ./input
python main.py  # (then select item 2 to work with a local file)
adb push ./output/framework.jar /data

Then, either via adb shell or in a terminal on the device:

su
mount -o remount,rw /system
cp /data/framework.jar /system/framework/framework.jar
reboot

@ale5000-git
Copy link
Owner

ale5000-git commented Mar 13, 2017

@georgedorn: The main problem isn't remounting, but it is the fact that the adb remount command freeze adb indefinitely and never return.

So, the only thing would be probably kill adb and re-try with a workaround.
I will see what I can do.

@ale5000-git
Copy link
Owner

ale5000-git commented Mar 13, 2017

@ecanja: Could you please post a bug report about adb remount to the ROM author and post a link of the bug report here?

@ecanja
Copy link
Author

ecanja commented Mar 26, 2017

Did so: NovaFusion/android_device_samsung_golden#83.

Unfortunately, the issue tracker doesn't look like being very actively maintained.

ale5000-git added a commit that referenced this issue Sep 1, 2017
…stuck (only for new Python versions, on old versions it will behave as before), ref #22
@ale5000-git
Copy link
Owner

@ecanja @georgedorn

Could you please try the latest version of Tingle, tell me if there is any improvement and post the log?
When the command hang it should go on after 6 seconds, I would like to know if it works.

@ghost
Copy link

ghost commented Dec 31, 2017

I don't know if my issue is the same.. But for me it crashes after "Remounting /system..."

MENU

    1 - Patch file from a device (adb)
    2 - Patch file from the input folder

> 1

 *** OS: Linux 4.14.9-1-ARCH (linux)
 *** Python: 3.6.4 (64 bit)
 *** Mode: 1
 *** Working dir: /tmp/Tingle-x2vr8_to
 *** Selected device: 43f8c4790903
 *** Automounting /system...
      DEBUG: Already mounted
 *** Pulling framework from device...
 *** Device SDK: 25
 *** Decompressing framework...
      DEBUG: Decompressing framework.jar
 *** Disassembling classes...
      DEBUG: Disassembling framework/classes.dex
 *** Patching...
 *** Detected: Android 8.x / 7.x / 6.x (or LOS/CM 13-15)
 *** Patching succeeded.
 *** Reassembling classes...
      DEBUG: Assembling out/classes.dex
      WARNING: The reassembling has failed (probably we have exceeded the 64K methods limit)
               but do NOT worry, we will retry.
 *** Moving methods...
      WARNING: Experimental code.
      DEBUG: Disassembling framework/classes2.dex
 *** Reassembling classes...
      DEBUG: Assembling out/classes.dex
      DEBUG: Assembling out/classes2.dex
 *** Recompressing framework...
      DEBUG: Compressing framework.jar
 *** Copying the patched file to the output folder...
 *** Rooting adbd...
      DEBUG: adbd cannot run as root in production builds
 *** Unlocked ADB: False
 *** Remounting /system...

ERROR INFO
==========
Type: <class 'subprocess.CalledProcessError'>
Cmd: ['/usr/bin/adb', '-s', '43f8c4790903', 'shell', "su -c 'mount -o remount,rw /system /system && mount' | grep ' /system '"]
Return code: 1
Output: mount: '/system' not in /proc/mounts

Traceback (most recent call last):
  File "./main.py", line 720, in <module>
    enable_device_writing(SELECTED_DEVICE)
  File "./main.py", line 365, in enable_device_writing
    remount_check = safe_output_decode(safe_subprocess_run([DEPS_PATH["adb"], "-s", chosen_device, "shell", "su -c 'mount -o remount,rw /system /system && mount' | grep ' /system '"]))  # Untested
  File "./main.py", line 203, in safe_subprocess_run
    return subprocess.check_output(command, stderr=subprocess.STDOUT)
  File "/usr/lib/python3.6/subprocess.py", line 336, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/bin/adb', '-s', '43f8c4790903', 'shell', "su -c 'mount -o remount,rw /system /system && mount' | grep ' /system '"]' returned non-zero exit status 1.
                                        

Any advice?

@ale5000-git
Copy link
Owner

@ociramma: It isn't the same problem, could you please open a separate issue (to avoid confusion)?

@ghost
Copy link

ghost commented Dec 31, 2017

Ok, no problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants