Feature #1806

Feature #1779: Implement setting that allows to permanently disable the modem

Find and document a way to reliably disable the modem via shell commands.

Added by Fil Bergamo 4 months ago. Updated 22 days ago.

Telephony and mobile data
Target version:
Start date:
Due date:
% Done:




In order to implement what's required in #1779, some docs are needed about how to achieve modem disabling under the hood.

0001-Added-scripts-for-disabling-and-enabling-the-i9300-m.patch View (39.6 KB) Jeremy Rand, 07/22/2017 04:09 PM

6.0-modem-v2.patch View (146 KB) Jeremy Rand, 08/20/2017 04:51 PM

Related issues

Related to Feature #1820: Do some testing on femtocells New 07/04/2017


#1 Updated by Jeremy Rand 4 months ago

Wolfgang posted some relevant info for the S3 i9300 here:

Quoting his instructions:

adb root
adb remount
adb shell mv /system/lib/ /system/lib/

I haven't tried the instructions myself, but NS von H says they worked.

#2 Updated by Fil Bergamo 4 months ago

That instruction

adb remount

makes me suspect that this isn't doable from inside the phone, and needs a host computer.
But, from my understanding, what it actually does is remount the /system partition in RW mode.
So, maybe just issuing a shell command from inside the phone would do the same:
mount -o rw,remount /system

gotta give it a try...

#3 Updated by Wolfgang Wiedmeyer 4 months ago

Thanks for looking into this!

Indeed, it's possible to remount the system partition like this. Apps like AdAway do this. But this is a hack and shouldn't be done during regular operation of the device. The system partition should stay untouched if possible. It's also problematic because all changes are reverted after installing an update zip.

Moving libsamsung-ril leads to the RIL daemon not finding the vendor RIL and thus not initializing the radio. This only works on Samsung devices where libsamsung-ril is used. To have a more future-proof solution, it would be better to implement this in a way that is device-independent.

Settings should be stored in the data partition if they should be permanent. I don't know if it's possible to use the settings storage that the settings app uses and make this accessible by system daemons. I guess that all of this could be implemented like this:
  • Add a new setting to the settings app that says something like "Disable modem initialization"
  • If the setting is selected, a file like /data/.disable_modem_boot is generated
  • When the RIL daemon is started, before loading a vendor RIL like libsamsung-ril, it checks if this file exists and exits immediately if it does.

If you choose to implement it this way, then there are more things to watch out for, but it's not important to do this right away. It's probably not possible to disable the RIL daemon and make sure that it is not started by any other process. So making changes directly to the RIL daemon like I suggested above is necessary. However, it needs to be checked if the daemon is then started over and over again and if this can be prevented somehow.
The file that stores the setting in the data partition needs to be protected. At least it needs to have a proper SELinux context and in general, it should be ensured that it can only be removed by the settings app (and root of course).

#4 Updated by Jeremy Rand 2 months ago

I have a working PoC:

It's not as clean a solution as what Wolfgang suggested, but maybe it'll suffice until someone more competent than I am has time to implement Wolfgang's suggested method.


#5 Updated by Jeremy Rand about 2 months ago

Patch attached for the user-scripts repo.

#6 Updated by Fil Bergamo about 1 month ago

#7 Updated by Wolfgang Wiedmeyer about 1 month ago

Jeremy, thanks for the patch!
Could you change the commit title to something more general to reflect that this works not only on the i9300 but all devices that use Samsung-RIL?

I'm not sure if it's necessary to include the license in a separate file. The other scripts don't have it and it could be confusing then. But this is no blocker to me.

It would be good to document the scripts in the wiki. I gave you wiki access.

#8 Updated by Wolfgang Wiedmeyer about 1 month ago

I just noticed that for the wifi scripts, the license is also included. It looks like everything on the replicant-6.0 branch is then GPLv3+, so the license could be moved to the root folder.

#9 Updated by Jeremy Rand about 1 month ago

#10 Updated by Jeremy Rand about 1 month ago

Thanks for the review Wolfgang! I've added a new patch that I think addresses your feedback.

#11 Updated by Wolfgang Wiedmeyer 22 days ago

Thanks Jeremy, pushed :)

Also available in: Atom PDF