i want to edit this file in /proc - General Questions and Answers

i wanted to edit this file in /proc/sys/fs/inotify/max_user_instances
& make the file written as 0 . so, something like this, echo 0 > /proc/sys/fs/inotify/max_user_watches
but i cant edit this file at all... i tried to change permission to 777, -> 'modification failed'
i thought to use magisk module, then i heard - module cant edit /proc folder
now, is there any way to esit this file in any ways??? plz help me!!!
any knowledge appreciated

You must be root in order to edit the file.
Code:
adb devices
adb shell "su -c 'echo 0 > /proc/sys/fs/inotify/max_user_watches'"

jwoegerbauer said:
You must be root in order to edit the file.
Code:
adb devices
adb shell "su -c 'echo 0 > /proc/sys/fs/inotify/max_user_watches'"
Click to expand...
Click to collapse
i hav root
do i run this in android terminal? (termux) or from pc?
i ran the su -c line with & without quote... files is not changing
permission 664

jwoegerbauer said:
You must be root in order to edit the file.
Code:
adb devices
adb shell "su -c 'echo 0 > /proc/sys/fs/inotify/max_user_watches'"
Click to expand...
Click to collapse
holy cow!!
it worked!!! i xonmo why it didnt worked at first time
i will really appreciate, sir. if u tell me what does "su -c" do???
u really helped me!!! thanks a lot

Related

[Q] adb shell in batch

Hi,
I'm making a batch file (*.bat) for myself to try make some things easier file where I enter commands with adb.exe.
The problem is, any code after 'adb shell' is not executed in the batch.
So if I had a batch with the following:
Code:
adb shell
su
'su' will not be executed and stays at '$'.
It seems like it's too deep for a batch file to enter codes.
I also tried pushing a sh with the same script and run it from adb but then all I get it permission denied.
I have also tried 'adb shell su' without any luck.
Anyone with a solution?
Anyone? Or how about a .rc file that gets su and runs commands...
Sent from my HTC
To execute a script, you can always push your script and then execute it:
Code:
adb push script /sdcard/script
adb shell sh /sdcard/script
As for the commands you have shown, keep in mind that su doesn't simply change the running shell's permissions or the like but creates a new child environment within its own shell. You leave your script and after the new shell has finished, you're back in your old environment and the script continues.
mizch said:
To execute a script, you can always push your script and then execute it:
Code:
adb push script /sdcard/script
adb shell sh /sdcard/script
As for the commands you have shown, keep in mind that su doesn't simply change the running shell's permissions or the like but creates a new child environment within its own shell. You leave your script and after the new shell has finished, you're back in your old environment and the script continues.
Click to expand...
Click to collapse
yes, is there any way to automate the script inside the shell and use exit to finally go back to the batch script.
Can you provide me with an example of what you want to achieve?
To execute shell commands from a batch, it doesn't matter if I have to push a script and execute it. It's so that I get su and automate commands after that. Like flash_image, remount, chmod etc..
you will need to use the 'adb shell command' ad 'sh' files
I am trying to create a unix script file that copies files from /dbdata/databases to another folder as a backup.
When I try running the script in adb shell as SU, I get
cd: can't cd to /dbdata/databases
This is on a rooted Captivate. Any help would be greatly appreciated!
Hi,
su -c "command" should do the job for you. You will need to enclose the whole of the command in quotes however, otherwise su will be expecting the command to execute, doing nothing.
Example: adb shell "su -c 'sqlite3 /data/data/my.db/databases/mydb.db < /sdcard/dump.sql'" (run from a Unix or Windows(?) shell). Notice the use of "" and ''.
(in this case dump.sql contains .dump, for instance)
Of course the sqlite3 command could be placed within another script on the android device.
Hope that helps.
I looked around a bit and found the answer.
The simple answer is, wrap the command
Code:
cp "source" "destination"
in double quotes!
Thank you grindingbob for the adb shell "su -c 'sh /mnt/sdcard/tmp/2.sh'" command.
No probs I was more referring to executing commands as a su without interacting with adb shell.
As a side-note, cp might not be a good idea, unless you're sure no db accessing is taking place at the same time.
I am pretty sure well as sure as a novice can be! The files I am backing up are log files, call history and text message history.
The results from running a unix script which contains
Code:
cp "/dbdata/databases/com.android.providers.contacts/contacts2.db" "/mnt/sdcard/tmp4/contacts2.db"
cp "/dbdata/databases/com.android.providers.telephony/mmssms.db" "/mnt/sdcard/tmp4/mmssms.db"
cp "/dbdata/databases/com.sec.android.provider.logsprovider/logs.db" "/mnt/sdcard/tmp4/logs.db"
are only the logs.db file is copied, the other two are not.
grindingbob said:
No probs I was more referring to executing commands as a su without interacting with adb shell.
As a side-note, cp might not be a good idea, unless you're sure no db accessing is taking place at the same time.
Click to expand...
Click to collapse
Permission issues for *.sh files from ADB
Dear All,
I have a 3.2 device with Root permissions & Busybox.
I created a sample *.sh file, Pushed to SDcard, and gave '777' Permissions. When i Try to run it from ADB shell its not working Any help...
CMD prompt Traces:
Step -1: Created a sh file
cat TAB.sh
#!/bin/sh
cd /data/data/com.android.gallery/shared_prefs
Step -2 Pushed the file to SDcard
# ls -l *.sh
ls -l *.sh
-rw-rw-r-- root sdcard_rw 56 2012-03-13 15:06 SP.sh
-rw-rw-r-- root sdcard_rw 62 2012-03-13 15:05 TAB.sh
Step -3 Gave 777 permission for *.sh files
# chmod 777 *.sh
chmod 777 *.sh
# ls -l
ls -l
-rw-rw-r-- root sdcard_rw 56 2012-03-13 15:06 SP.sh
-rw-rw-r-- root sdcard_rw 62 2012-03-13 15:05 TAB.sh
Execute permission not applied
Tried other operations, dint workout
Step 4 other options:
# chmod +X *.sh
chmod +X *.sh
Bad mode
# chmod +x *.sh
chmod +x *.sh
Bad mode
# chmod u+x *.sh
chmod u+x *.sh
Bad mode
Any Help?

[Q] Disable proximity sensor via terminal emulator

Hi @ all,
I have that following problem: My phones display turns off automatically while im receiving or doing a call. My proximity sensor is broken and i would like disable it and i found a good solution here in this formus:
http://forum.xda-developers.com/showthread.php?t=925814&page=5
# cd /data/local
# touch userinit.sh
# echo "#!/system/bin/sh" > userinit.sh
# echo "#" >> userinit.sh
# echo "chmod 0000 /dev/cm3602" >> userinit.sh
# echo "chmod 000 /dev/cm3602" >> userinit.sh
# chmod 777 userinit.sh
But there's a little problem. I'm not well in programming - now my question is: can someone cange the code that it fit's to my phone. It's a Desire S with CyanogenMod 10 Beta.
Would be very thankful!
our phone has a /dev/cm3602 as well, so it probably uses the same chip.
note: the following is untested
Code:
cat>/etc/init.d/98-disable-sensor<<EOF
#`which sh`
chmod 000 /dev/cm3602
EOF
run that through adb shell and if your kernel has init.d support it will automatically disable your proximity sensor every boot. disable the sensor for your current session by running a simple 'chmod 000 /dev/cm3602' through adb shell.
THX! I will try it out soon.
Sent from my Desire S using xda app-developers app
I've just figured out that those commands won't work as is -- I stupidly forgot you need to remount system r/w and make the file executable for it to run. This should work (still didn't test it) -- run it all in an adb shell:
Code:
mount -o remount,rw /system
cat>/etc/init.d/98-disable-sensor<<EOF
#!`which sh`
chmod 000 /dev/cm3602
EOF
chmod 755 /etc/init.d/98-disable-sensor
mount -o remount,ro /system
i just tried it out and it says
[email protected]:/ # mount -o remount,rw /system
mount -o remount,rw /system
[email protected]:/ # cat>/etc/init.d/98-disable-sensor<<EOF
cat>/etc/init.d/98-disable-sensor<<EOF
> #!'which sh'
#!'which sh'
> chmod 000 /dev/cm3602
chmod 000 /dev/cm3602
> EOF
EOF
sh: can't create temporary file /sqlite_stmt_journals/mksh.vXIer13043: No such file or directory
but simply 'chmod 000 /dev/cm3602' works fine for one session! thanks!
Ooh, joy, it's that bug in the android shell that I'd forgotten about.
Try this instead:
In an adb shell, run 'which sh'. Note the path it returns.
On your computer, copy the following to a text file named '98-disable-sensor'. Be sure to use an editor (e.g. Notepad++) that can save with LF newline bytes and make sure you tell it to do that! (Under Windows, a newline is marked by the bytes \r\n, which is wrong for Linux - it should be just \n. Save the file as 'Unix text file' or something like that when asked.)
Code:
#!/path/to/sh/you/wrote/down/earlier
chmod 000 /dev/cm3602
Push it to your device: 'adb remount' + 'adb push 98-disable-sensor /etc/init.d/'
Make it executable: 'adb shell chmod 755 /etc/init.d/98-disable-sensor'
Remount system r/o again: 'adb shell mount -o remount,ro /system'
Aquous said:
Ooh, joy, it's that bug in the android shell that I'd forgotten about.
Try this instead:
In an adb shell, run 'which sh'. Note the path it returns.
On your computer, copy the following to a text file named '98-disable-sensor'. Be sure to use an editor (e.g. Notepad++) that can save with LF newline bytes and make sure you tell it to do that! (Under Windows, a newline is marked by the bytes \r\n, which is wrong for Linux - it should be just \n. Save the file as 'Unix text file' or something like that when asked.)
Code:
#!/path/to/sh/you/wrote/down/earlier
chmod 000 /dev/cm3602
Push it to your device: 'adb remount' + 'adb push 98-disable-sensor /etc/init.d/'
Make it executable: 'adb shell chmod 755 /etc/init.d/98-disable-sensor'
Remount system r/o again: 'adb shell mount -o remount,ro /system'
Click to expand...
Click to collapse
Hi
Do you know what is the command to turn off all sensors ?
i want to execute the command when screen is off (by xposed edge)
and turn on again when screen is on
loopypalm said:
Hi
Do you know what is the command to turn off all sensors ?
i want to execute the command when screen is off (by xposed edge)
and turn on again when screen is on
Click to expand...
Click to collapse
I use the below command on low battery trigger via Tasker
Code:
cmd statusbar click-tile com.android.settings/.development.qstile.DevelopmentTiles\$SensorsOff
varunpilankar said:
I use the below command on low battery trigger via Tasker
Code:
cmd statusbar click-tile com.android.settings/.development.qstile.DevelopmentTiles\$SensorsOff
Click to expand...
Click to collapse
Thx but i don't want to use tasker or any extra app
loopypalm said:
Thx but i don't want to use tasker or any extra app
Click to expand...
Click to collapse
Us can use the via adb or shell script event trigger.
varunpilankar said:
Us can use the via adb or shell script event trigger.
Click to expand...
Click to collapse
what is the adb comand ?
loopypalm said:
what is the adb comand ?
Click to expand...
Click to collapse
Code:
adb shell cmd statusbar click-tile com.android.settings/.development.qstile.DevelopmentTiles\$SensorsOff
varunpilankar said:
Code:
adb shell cmd statusbar click-tile com.android.settings/.development.qstile.DevelopmentTiles\$SensorsOff
Click to expand...
Click to collapse
it work on PC but no luck in terminal/xposed edge
Edit : i found a way !
replace "adb shell" with "#!/bin/sh" work
If you have root then you can use Su directly
varunpilankar said:
If you have root then you can use Su directly
Click to expand...
Click to collapse
and the comand is ?
terminal - type
su
cmd statusbar click-tile com.android.settings/.development.qstile.DevelopmentTiles\$SensorsOff

[Q] Help! Problem with Tablet Olidata WB7-l

Hi! I'm a noob user, with a weird tablet.
The brand is Olidata (Chile), and the model is Wb7-l. The first problem was that the tipycal: many worng pattern attempts. I though about the usual: hard reset, but this weird tablet doesn't have one!So I tried all button combinations to enter th the hard reset menu, but was unuseful.
Then, I found a post, it said that with a program I could put anoter ROM (PhoenixSuite), and with the ADB Drivers. I could put another ROM, but the touch system doesn't work. Then I searched a second and a Third ROM, but was the same. Then, I remembered that the chip was a A13, and I found another post, where a user said that with a script you could fix that problem. I use the script and... it died :crying: . After that, i tried to connect it to the computer again, but I couldn't.
THEN, i read the script. Now, i'm really really afraid, because maybe the Tablet is dead.
Here's the script:
(I open it with notepad)
@ECHO off
echo Remount
adb remount
adb shell cd /
echo Mount root
adb shell mount -o remount,rw -t ext4 /dev/root /
echo Make dir bootfs
adb shell mkdir bootfs
echo Mount bootfs
adb shell mount -t vfat /dev/block/nanda /bootfs
echo Copy script.bin
adb push "script.bin" /bootfs/script.bin
echo Copy script0.bin
adb push "script.bin" /bootfs/script0.bin
echo Copy zet6221.ko to /system/vendor
adb push "zet6221.ko" /system/vendor/zet6221.ko
adb shell chmod 644 /system/vendor/zet6221.ko
echo Copy zet6221_ts.idc to /system/usr/idc
adb push "zet6221_ts.idc" /system/usr/idc/zet6221_ts.idc
adb shell chmod 644 /system/usr/idc/zet6221_ts.idc
echo Copy preinstall.sh
adb push "preinstall.sh" /system/bin/preinstall.sh
adb shell chmod 755 /system/bin/preinstall.sh
echo Copy setupsensors.sh
adb push "setupsensors.sh" /system/bin/setupsensors.sh
adb shell chmod 755 /system/bin/setupsensors.sh
pause
adb shell reboot
How can I undo what I did? What's the right ROM? (The other one was one called F1(A13)-20121129.1.1.1- )
Please, please help
(Sorry for my weird english, I know just a bit )

[Q&A] [TUT] Fix Mount System in Kitkat After Root

Q&A for [TUT] Fix Mount System in Kitkat After Root
Some developers prefer that questions remain separate from their main development thread to help keep things organized. Placing your question within this thread will increase its chances of being answered by a member of the community or by the developer.
Before posting, please use the forum search and read through the discussion thread for [TUT] Fix Mount System in Kitkat After Root. If you can't find an answer, post it here, being sure to give as much information as possible (firmware version, steps to reproduce, logcat if available) so that you can get help.
Thanks for understanding and for helping to keep XDA neat and tidy!
boot.img
Please give me M2 ,D2303, 4.4.2 , 18.3.C.0.37 boot.img
aunggyi2014 said:
Please give me M2 ,D2303, 4.4.2 , 18.3.C.0.37 boot.img
Click to expand...
Click to collapse
heres a .40 one if it helps https://drive.google.com/file/d/0B8tBozpqUuU1R0RnV3VoVXJEUWs/view
d2306 unable to update from OTA
Hi,
I've tried this method and I couldn't update my d2306 with D2306_18.0.C.1.17_PT-BR.ftf (JB) using the Update Center app (I'm really sorry for my ignorance, but this is how we update from OTA, right?). It only said that the update failed and didn't gave any log or reason why.
So I've tried to flash everything, but the kernel, again using the flashtool, as seen in androidclub. But then I got stuck in bootloop.
I've already tried to flash CWM and root from within it, and then, as my phone had come with KK already, I've flashed only the kernel. But then I can't go into custom recovery anymore, and I got the system not writable problem.
For OTA errors check this file :
/cache/recovery/fota/report
Sony ric service for KK 4.4.2 is located at /sys/kernel/security/sony_ric
Assume you have root access on your KitKat, and busybox installed.
Get ready (or compile for yourself) copymodulecrc and ric_disabler_mod.ko written by @cubeundcube from here.
Look at install_tool.sh script, there is everything you need...)
e.g., connect your device via usb......and execute from shell :
Code:
adb push files/copymodulecrc /data/local/tmp/
adb push files/ric_disabler_mod.ko /data/local/tmp/
adb shell "su -c 'chmod 0755 /data/local/tmp/copymodulecrc'"
adb shell "su -c 'chmod 0644 /data/local/tmp/ric_disabler_mod.ko'"
adb shell "/data/local/tmp/copymodulecrc /system/lib/modules/scsi_wait_scan.ko /data/local/tmp/ric_disabler_mod.ko"
adb shell "su -c 'insmod /data/local/tmp/ric_disabler_mod.ko'"
adb shell "su -c 'dd if=/data/local/tmp/ric_disabler_mod.ko of=/system/xbin/ric_disabler_mod.ko'"
adb shell "su -c 'chown root.root /system/xbin/ric_disabler_mod.ko'"
adb shell "su -c 'chmod 0644 /system/xbin/ric_disabler_mod.ko'"
Create a file 00stop_ric, with the following content:
Code:
#!/system/bin/sh
insmod /system/xbin/ric_disabler_mod.ko
Save it, copy to the /system/etc/init.d/ and set access permissions :
Code:
adb push 00stop_ric /system/etc/init.d/00stop_ric
adb shell "su -c 'chown root.root /system/etc/init.d/00stop_ric'"
adb shell "su -c 'chmod 0755 /system/etc/init.d/00stop_ric'"
Put this line at the end of the file init.qcom.post_boot.sh (located in the /system/etc/)
Code:
/system/xbin/busybox run-parts /system/etc/init.d
Test mount:
Code:
adb shell "su -c 'mount -o remount,rw /system'"
p.s
For all written above I used koush/Superuser for root access.
Please help
After rooting, my phone is showing internal storage fill. How can i fix it.

Disable system packages [ADB - Android 13]

Hi...
I made the very bad mistake of updating my Oppo Reno 6 5G to ColorOS 13...
There is no possibility to downgrade and moreover some packages can no longer be uninstalled or disabled via ADB.
For example, if I wanted to uninstall/disable com.oplus.ota to avoid further updates, the ADB commands that worked until yesterday would no longer work...
Es:
shell pm uninstall --user 0 com.oplus.ota
Failure [DELETE_FAILED_INTERNAL_ERROR]
shell pm disable-user --user 0 com.oplus.ota
Package com.oplus.ota new state: default
shell pm disable com.oplus.ota
[Error]:failed to disable com.oplus.ota
Anyone has a solution? Thanks....
Is the mentioned file listed as package?
Code:
adb devices
adb shell "pm list packages -s"
If not then you can't use pm cmd to operate on this file.
jwoegerbauer said:
Is the mentioned file listed as package?
Code:
adb devices
adb shell "pm list packages -s"
If not then you can't use pm cmd to operate on this file.
Click to expand...
Click to collapse
Yes the package is in the list! However both the disable and the uninstall give the error...
If one wants to get completely rid off of a system-package he/she
1. must make /sstem partition RW - what requires Android is got rooted
Code:
su -c "mount -o rw,remount /system"
2. simply runs
Code:
su -c "rm -f /system/<package-name>"
jwoegerbauer said:
If one wants to get completely rid off of a system-package he/she
1. must make /sstem partition RW - what requires Android is got rooted
Code:
su -c "mount -o rw,remount /system"
2. simply runs
Code:
su -c "rm -f /system/<package-name>"
Click to expand...
Click to collapse
Thank you for the info... My phone is not routed unfortunately...
I want to downgrade it but i can't... :-(
jwoegerbauer said:
If one wants to get completely rid off of a system-package he/she
1. must make /sstem partition RW - what requires Android is got rooted
Code:
su -c "mount -o rw,remount /system"
2. simply runs
Code:
su -c "rm -f /system/<package-name>"
Click to expand...
Click to collapse
hallo, i've been using this method from a2.3 to a11 to uninstall system apps, but this method is not useable with a11 in a TWRP shell, so i'm curious, are these steps still works correctly in a13? in a system shell or TWRP shell?
The code excerpt printed above is meant to be run via ADB as
Code:
adb shell 'su -c "mount -o rw,remount -t auto /system"'

Categories

Resources