Need Help with ADB - EVO 4G Q&A, Help & Troubleshooting

i'm new to adb. i finally got it working. the correct string is added to Path, it's in my root directory C:\. i'm able to list my device, list directories, and even push/pull (did test to sdcard). i cannot, however, mount the /system directory to r/w.
this is what's happening
C:\android\android-sdk_r06-windows\android-sdk-windows\tools> adb remount
remount failed: Invalid argument
i'm in recovery trying to do this. anyone know what's going on or can maybe lend some help? thank you

mrvirginia said:
i'm new to adb. i finally got it working. the correct string is added to Path, it's in my root directory C:\. i'm able to list my device, list directories, and even push/pull (did test to sdcard). i cannot, however, mount the /system directory to r/w.
this is what's happening
C:\android\android-sdk_r06-windows\android-sdk-windows\tools> adb remount
remount failed: Invalid argument
i'm in recovery trying to do this. anyone know what's going on or can maybe lend some help? thank you
Click to expand...
Click to collapse
if you do not have a rooted, NAND unlocked, phone, you will not be able to mount /system

timothydonohue said:
if you do not have a rooted, NAND unlocked, phone, you will not be able to mount /system
Click to expand...
Click to collapse
it is rooted and NAND unlocked lol
i was actually able to push but not where i wanted.
i did
adb push com.htc.resources.apk /system/framework
but that's not where it needs to go
so i then did
adb push com.htc.resources.apk /system/framework/
and it says /system/framework is a directory, which i know lol that's where i need the file to go.
oh yeah, and i got it mounted as r/w. so now i'm just having trouble getting the file where it needs to be with the whole "is a directory" error instead of it actually pushing the file. still unable to pull a file from that location, though.

try writing the filename. it 'should' append it automatically, but if not then try
adb push com.htc.resources.apk /system/framework/com.htc.resources.apk

timothydonohue said:
try writing the filename. it 'should' append it automatically, but if not then try
adb push com.htc.resources.apk /system/framework/com.htc.resources.apk
Click to expand...
Click to collapse
this will prob work but...
now i'm getting "error: more than one device and emulator"
edit: i'm going to reboot and start all over. not sure how to kill it off since this is a little new to me ha

timothydonohue said:
try writing the filename. it 'should' append it automatically, but if not then try
adb push com.htc.resources.apk /system/framework/com.htc.resources.apk
Click to expand...
Click to collapse
this was a successful push, but the file is still not updating so i'm lost now
also, trying to pull this file back out is not working using
C:\android\android-sdk_r06-windows\android-sdk-windows\tools>adb pull /system/fr
amework/com.htc.resources.apk com.htc.resources.apk
remote object '/system/framework/com.htc.resources.apk' does not exist
edit: this is what i'm looking at
C:\android\android-sdk_r06-windows\android-sdk-windows\tools>adb shell mount -o
rw, remount /dev/block/mtdblock3 /system
adb server is out of date. killing...
* daemon started successfully *
BusyBox v1.15.3 (2010-02-06 17:13:19 CET) multi-call binary
Usage: mount [flags] DEVICE NODE [-o OPT,OPT]
Mount a filesystem. Filesystem autodetection requires /proc be mounted.
Options:
-a Mount all filesystems in fstab
-r Read-only mount
-w Read-write mount (default)
-t FSTYPE Filesystem type
-O OPT Mount only filesystems with option OPT (-a only)
-o OPT:
loop Ignored (loop devices are autodetected)
[a]sync Writes are [a]synchronous
[no]atime Disable/enable updates to inode access times
[no]diratime Disable/enable atime updates to directories
[no]relatime Disable/enable atime updates relative to modification ti
me
[no]dev (Dis)allow use of special device files
[no]exec (Dis)allow use of executable files
[no]suid (Dis)allow set-user-id-root programs
[r]shared Convert [recursively] to a shared subtree
[r]slave Convert [recursively] to a slave subtree
[r]private Convert [recursively] to a private subtree
[un]bindable Make mount point [un]able to be bind mounted
bind Bind a directory to an additional location
move Relocate an existing mount point
remount Remount a mounted filesystem, changing its flags
ro/rw Read-only/read-write mount
There are EVEN MORE flags that are specific to each filesystem
You'll have to see the written documentation for those filesystems
C:\android\android-sdk_r06-windows\android-sdk-windows\tools>adb pull /system/fr
amework/com.htc.resources.apk com.htc.resources.apk
remote object '/system/framework/com.htc.resources.apk' does not exist

/system is under mtdblock4 on our device.
if you need to mount /system as read/writeable from adb, you should just be able to use
adb remount
if you are doing it in shell, use mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system

timothydonohue said:
/system is under mtdblock4 on our device.
if you need to mount /system as read/writeable from adb, you should just be able to use
adb remount
if you are doing it in shell, use mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system
Click to expand...
Click to collapse
yeah adb remount won't work for me either.
C:\android\android-sdk_r06-windows\android-sdk-windows\tools>adb remount
adb server is out of date. killing...
* daemon started successfully *
remount failed: Invalid argument
i'm going to try mtdblock4

also, if you are having issues with the adb daemon, use
adb kill-server
adb start-server
that'll reboot the adb daemon

timothydonohue said:
also, if you are having issues with the adb daemon, use
adb kill-server
adb start-server
that'll reboot the adb daemon
Click to expand...
Click to collapse
thanks. yeah i started just killing it in task manager

after using "mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /system" and trying to pull, i'm still getting /system/framework/com.htc.resources.apk does not exist

yeah, not sure what to tell you then. i can't piddle around in my own, because i'm on cm6, and won't have that.
are you sure it exists?
adb shell
# cd /system/framework
# ls
that will tell you what's in there. if you can't see it, it's not there.
from a brand new shell, (or bounce back up to the root directory)
try
find -name "*resources*.*"
that should tell you every file that contains 'resources' as a part of the file name, and where it is located.

timothydonohue said:
yeah, not sure what to tell you then. i can't piddle around in my own, because i'm on cm6, and won't have that.
are you sure it exists?
adb shell
# cd /system/framework
# ls
that will tell you what's in there. if you can't see it, it's not there.
from a brand new shell, (or bounce back up to the root directory)
try
find -name "*resources*.*"
that should tell you every file that contains 'resources' as a part of the file name, and where it is located.
Click to expand...
Click to collapse
it exists. i navigated to it using root explorer. but according to this, it doesn't exist
C:\android\android-sdk_r06-windows\android-sdk-windows\tools>adb shell
adb server is out of date. killing...
* daemon started successfully *
/ # cd /system/framework
cd /system/framework
/sbin/sh: cd: can't cd to /system/framework
/ #

you can't navigate to the folder if /system isn't mounted. if you just restarted the adb server, then it won't be mounted.

timothydonohue said:
you can't navigate to the folder if /system isn't mounted. if you just restarted the adb server, then it won't be mounted.
Click to expand...
Click to collapse
that was prob the case, can't remember if i re-mounted or not when i was doing that. regardless, i was positively mounted when trying to push/pull and it wasn't working so i guess i'll just have to wait for someone to put it in a flashable zip.
i hate adb
thanks for your help dude

Related

Removing Apps - What mode to boot in?

I'm trying to remove some of the stock apps on my Hero, including Rosie (Sense UI) and such. What mode do I boot in before doing this?
I know all of the steps to remove apps using adb (at least I think I do), I'm fully rooted, etc. But I can't seem to get it to work.
This is the command I'm using in adb
Code:
# rm /system/app/something.apk
(replacing something.apk with the actual apk name of course)
When I boot in Recovery, it says "File not found". When I boot in Fastboot, I can't connect to adb it seems. And when I boot into Android, it says "rm failed for something.apk, Read-only file system"
So am I missing a step? What should I be doing differently?
Boot into recovery, then do a "mount -a" to mount the filesystems.
marinierb said:
Boot into recovery, then do a "mount -a" to mount the filesystems.
Click to expand...
Click to collapse
It doesn't seem to work, here's the output:
Code:
C:\asdk\tools>adb devices
List of devices attached
HT9ALNT00557 recovery
C:\asdk\tools>adb shell
/ # mount -a
mount -a
mount: mounting /dev/block/mmcblk0p2 on /system/sd failed: No such file or direc
tory
/ #
Thanks for the reply though.
Edit: Got it working, typing in "mount" alone without the -a switch worked Thanks marinierb
in normal mode you cold have just done
adb remount
adb rm /system/app/something.apk
garok89 said:
in normal mode you cold have just done
adb remount
adb rm /system/app/something.apk
Click to expand...
Click to collapse
That doesn't seem to work for me. This is what it outputs:
Code:
remount failed: Operation not permitted
If you can't remount it doesn't sound like you've rooted.
callummr said:
If you can't remount it doesn't sound like you've rooted.
Click to expand...
Click to collapse
I've performed other operations that would normally require it, so I should be rooted.
Is there a way I can confirm if it's properly rooted or not?
shell prompt:
$ .. no root
# .. root
..try typing "su" once in the shell (abd shell or adb-windows.exe shell) and see what it brings up
~David said:
It doesn't seem to work, here's the output:
Code:
C:\asdk\tools>adb devices
List of devices attached
HT9ALNT00557 recovery
C:\asdk\tools>adb shell
/ # mount -a
mount -a
mount: mounting /dev/block/mmcblk0p2 on /system/sd failed: No such file or direc
tory
/ #
Thanks for the reply though.
Edit: Got it working, typing in "mount" alone without the -a switch worked Thanks marinierb
Click to expand...
Click to collapse
typing only "mount" just list the mounted partitions, it will not mount anything. if your partition is ext4 you need to downgrade it to ext2 or ext3 or set the testflag, see "if you're having issues with ext4" in the first post of the recovery image thread.
Make sure you have run a Nandroid backup first so that if you accidentally remove something important.
Boot into normal mode. (full GUI)
Then:
Code:
C:\ADB MOUNT
C:\ADB SHELL
# rm /system/app/something.apk
reboot
You have to reboot at the end so that the apps are taken out of RAM, you may get FC (errors) if you try to do stuff after removing the apps before rebooting.
I removed (actually moved) *Twit*, Stock*, Launcher*, and a few other things.
HTH,
Unconn

remount scripts

Remount script ready to go next post down.
Solved ...
The point of this: Save yourself the mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 command ..
The split kernel confused me... It's /sbin in clockwork and /system/bin otherwise...
-- Little buggy on the remount state command not working ... but the remount rw and remount ro do definietly change the state of /system.
Extract the file from the .rar archive.
Get yourself into your clockwork recovery then mount system from the partitions menu and then do as follows from command prompt on the computer...
adb push remount /system/bin
adb shell chmod 775 /system/bin/remount
adb reboot
Should be all set...
Would be awesome to see this in more roms... just handy... that's all...
going to work on a reboot recovery script so that from adb shell we can reboot recovery...
Credit to:
flactemnad - http://android.modaco.com/content/htc-hero-hero-modaco-com/295691/easy-system-remount-script/

[ROOT ICS] The hard way && Digging for roots

For anyone that doesn't want to root the hard way crossix has come up with a double click root for Windows forum.xda-developers.com/showpost.php?p=23052186&postcount=105
Update 2/26/12
/system can now be mounted writable see the bottom of this post.
So the old Honeycomb exploit has now been patched in ICS. But there was an exploit found in the newer ICS kernels. Written by saurik,: called mempodroid
There is an offset needed as an argument to the binary, for the a100 we'll use what has worked for the a200 as noted in sauriks github linked above.
The issue with this is mounting /system as writable. I'm not sure if it's something in ICS, but it appears to be write protected. As noted here and here we will loop mount the system partition.
The tools needed are:
1. mempodroid under Usage Instructions, download pre-compiled
2. busybox 1.20 snapshot 3-10-12
3. su the latest from androidsu.com, extract from system/bin
4. mount.txt script
After downloading and extracting place them all in a folder called tools.
This must be done with adb. Issue the following from cmd or a terminal:
Code:
$ adb shell mkdir /data/local/tools
$ adb push tools /data/local/tools ; adb shell
$ cd /data/local ; chmod 755 tools/*
$ cd tools ; ./mempodroid 0xd9f0 0xaf47 sh
If all went well you should be at a hash # prompt. This is temp root.
mount /system rw the new way:
Code:
# PATH=$PWD:$PATH
# sh mount.txt -o remount,rw /system
Copy su and busybox to /system
Code:
# ./busybox cp busybox /system/xbin; ./busybox cp su /system/xbin/
# chmod 6755 /system/xbin/su
Install busybox
Code:
# cd /system/xbin
# for i in $(busybox --list); do ln -s busybox $i; done; sync
Copy the mount script
If busybox is updated this step must be run again
Code:
# cp /data/local/tools/mount.txt /system/bin/mount
# cp /data/local/tools/mount.txt /system/xbin/mount
Done your a100 should be rooted
the old way:
Now lets loop mount /system
Code:
[b]This is no longer needed[/b]
# ./busybox losetup -o $((512 * 51200)) /dev/block/loop7 /dev/block/mmcblk0
Code:
# ./busybox losetup /dev/block/loop7 /dev/block/mmcblk0p3
# mkdir loop ; mount -t ext4 /dev/block/loop7 loop
Copy su and busybox to the new mount point.
Code:
# ./busybox cp su loop/xbin/ ; ./busybox cp busybox loop/xbin/
# chmod 6755 loop/xbin/su ; sync
If it worked your a100 is fully rooted. Make sure to install SuperUser from the Market.
Either get busybox installer from the market, and install it to /data/local/tools/loop/xbin
Or:
Code:
# cd loop/xbin
# for i in $(busybox --list); do ln -s busybox $i; done; sync
The mount point won't survive a reboot so in order to write to /system again run:
Code:
# busybox losetup /dev/block/loop7 /dev/block/mmcblk0p3
# mount -t ext4 /dev/block/loop7 /data/local/tools/loop
[update 2/26/12]
To mount /system as writable do the following from adb. We'll just make a directory called /data/loop for easy access.
Code:
$ adb shell
$ su
# stop
[b]your screen will go black[/b]
# mkdir /data/loop
[b]skip this if the loop is already set up
# busybox losetup /dev/block/loop7 /dev/block/mmcblk0p3[/b]
# mount -t ext4 /dev/block/loop7 /data/loop
# mount -o bind /data/loop /system
# start
You can write to /system with any app but /system can't be remounted ro then back to rw.
This can be added to /etc/install-recovery.sh to make it permanent
Code:
busybox losetup /dev/block/loop7 /dev/block/mmcblk0p3
mount /dev/block/loop7 /data/loop
mount -o bind /data/loop /system
Thanks to crossix as the first to get temp root, and Icewyng for pointing out the exploit and helping with the magic number.
Ill be testing this when I get home, if it works Ill attempt to write a 1 command script to do it.
Sent from my MB860 using XDA App
OK...
Testing this out and found there were a couple of bugs.
You didn't have a "loop" folder created so I made one in the "tools" folder.
and, when mounting, you need to specify -t ext4.
Here are the revised commands for # mount /dev/block/loop7 loop
mkdir loop;mount -t ext4 /dev/block/loop7 /data/local/tools/loop
I noticed that the files /data/local/tools/loop/xbin/su and /data/local/tools/loop/xbin/busybox don't exist on /system/xbin until after a restart.
Finally, the busybox we are using to install doesn't seem to make all of the links to all of the nice commands we are used to, so things like grep, cp, etc... they won't work. I'm trying to figure out how to re-run the GUI busybox installer and point it to the loop folder, but haven't had much success.
danifunker said:
OK...
Testing this out and found there were a couple of bugs.
You didn't have a "loop" folder created so I made one in the "tools" folder.
and, when mounting, you need to specify -t ext4.
Here are the revised commands for # mount /dev/block/loop7 loop
mkdir loop;mount -t ext4 /dev/block/loop7 /data/local/tools/loop
I noticed that the files /data/local/tools/loop/xbin/su and /data/local/tools/loop/xbin/busybox don't exist on /system/xbin until after a restart.
Finally, the busybox we are using to install doesn't seem to make all of the links to all of the nice commands we are used to, so things like grep, cp, etc... they won't work. I'm trying to figure out how to re-run the GUI busybox installer and point it to the loop folder, but haven't had much success.
Click to expand...
Click to collapse
You beat me to the punch... was about to point it out.
Not sure what version of busybox this is but I will try with 1.19.2 and see how it goes.
Edit: Got root! It works great... for Busybox, use Busybox Installer to be able to get the latest version (1.19.4) I confirm that system is R/O for now.
danifunker said:
OK...
Testing this out and found there were a couple of bugs.
You didn't have a "loop" folder created so I made one in the "tools" folder.
and, when mounting, you need to specify -t ext4.
Here are the revised commands for # mount /dev/block/loop7 loop
mkdir loop;mount -t ext4 /dev/block/loop7 /data/local/tools/loop
I noticed that the files /data/local/tools/loop/xbin/su and /data/local/tools/loop/xbin/busybox don't exist on /system/xbin until after a restart.
Finally, the busybox we are using to install doesn't seem to make all of the links to all of the nice commands we are used to, so things like grep, cp, etc... they won't work. I'm trying to figure out how to re-run the GUI busybox installer and point it to the loop folder, but haven't had much success.
Click to expand...
Click to collapse
I did have some typos, think it's right now. That is an old busybox, it was just a quick find and it includes losetup but it's not one to use full time. Maybe sync is needed at the end so files are written properly. I didn't have to use -t ext4 with HC, but Ill add it to the OP
[edit] you have to use "busybox cp or busybox grep" I didn't include a way to add all the symlinks. Wow I have typos everywhere it's the end of the day for me, working nights.
Ok ... Got root!
Titanium works, Busybox Installer works, Superuser works, Root Explorer works...
Only thing is that System is R/O but we will work on it.
Waiting for a R/W system...and then, no one will stop my update
I can't get it to root :-(
It say not found
Sent from my A100 using xda premium
jondi23 said:
I can't get it to root :-(
It say not found
Sent from my A100 using xda premium
Click to expand...
Click to collapse
At what point, need some more details.
The tools folder gets pushed (the 3 files are copied) but then it says there is no such folder.
edit: never mind - i created the folder manually and pushed the files into the folder
edit2: rooted - thakns guys
Brilliat work, will try this later (need to get the sdk all set up again, I've been distro swapping). Got a pool match tonight too, so will try as soon as I can, will give whatever feedback I can later.
myprecious27 said:
The tools folder gets pushed (the 3 files are copied) but then it says there is no such folder.
edit: never mind - i created the folder manually and pushed the files into the folder
Click to expand...
Click to collapse
I forgot adb can't push a whole directory, it instead only copies the files within the directory.
wait how is it rooted if it's r/o I thought point of root was to make the file system r/w... er is root just allowing you to view all directories? Sorry for a noobish question, but you gotta start somewhere right?
rando152 said:
wait how is it rooted if it's r/o I thought point of root was to make the file system r/w... er is root just allowing you to view all directories? Sorry for a noobish question, but you gotta start somewhere right?
Click to expand...
Click to collapse
Well I think if we have su working we will be able to mount /system rw in some way if not directly. I cant imagine not being able to.
In any case though being able to write to /data as root is very useful. Example: Hulu flash fix.
You can't view /data if you're not root. That's one thig. Also, other functions may require root, like advanced networking things, etc.
I agree, not being able to write to /system is a major inconvenience, but most of the root programs will still work, as long as you're not writing to /system.
Since this is a temp root, does it mean that I will have to reroot every time I reboot? Will apps like Adfree work on this?
better yet is there a way we can do this solely on the tab? im away for work for another 4 weeks and only have my cell and a100 with me :-(
Sent from my SGH-I897 using xda premium
I get
Code:
255|[email protected]:/data/local/tools # mount -t ext4 /dev/block/loop7 /data/local
/tools/loop
lock/loop7 /data/local/tools/loop <
mount: Invalid argument
simoneser said:
I get
Code:
255|[email protected]:/data/local/tools # mount -t ext4 /dev/block/loop7 /data/local
/tools/loop
lock/loop7 /data/local/tools/loop <
mount: Invalid argument
Click to expand...
Click to collapse
I noticed the same thing happen after you root it and restart... not sure what to do next. Are you at temp loop?
simoneser said:
I get
Code:
255|[email protected]:/data/local/tools # mount -t ext4 /dev/block/loop7 /data/local
/tools/loop
lock/loop7 /data/local/tools/loop <
mount: Invalid argument
Click to expand...
Click to collapse
danifunker said:
I noticed the same thing happen after you root it and restart... not sure what to do next. Are you at temp loop?
Click to expand...
Click to collapse
try:
Code:
# busybox losetup -d /dev/block/loop7
# busybox losetup -o $((512 * 51200)) /dev/block/loop7 /dev/block/mmcblk0
# mount -t ext4 /dev/block/loop7 /data/local/tools/loop
The first line may produce
losetup: /dev/block/loop7: No such device or address
If it's not looped
After you are rooted the above can be run without adb from a terminal as su.
The mount point can be anywhere ex. /sdcard/loop instead of /data/local/tools/loop

[Q] Run script on FireTV boot

I have a very simple script to mount my NAS to a specific path that I want executed every time my FireTV boots.
I have read about pointing to it in the install-recovery-2.sh, however that is not available on my FireTV. I have also read about placing the script in system/etc/init.d/ however that path doesn't exist on the fireTV either.
Would prefer to do this at the system level and not rely on a manager (Tasker, Script Manager, etc).
Anyone have any experience?
Update w/ solution:
I was able to get this working by placing a script called install-recovery.sh in /system/etc/ . Make sure that permissions are set appropriately (at least 755). If creating the script on a Windows machine, make sure there aren't any hidden whitespace characters (I personally verified the script using SManager on my Fire TV).
Code:
[B]sleep 15[/B]
mkdir /mnt/obb/nas
chmod 777 /mnt/obb/nas
[B]sleep 20[/B]
mount -o noperm,unc=\\\\192.168.1.147\\Public,username=xxxxxx,password=xxxxxx -t cifs none /mnt/obb/nas
The sleep command is necessary as the script may run before the network is initialized.
Thanks rbox and ECEXCURSION!
patrickorr said:
I have a very simple script to mount my NAS to a specific path that I want executed every time my FireTV boots.
I have read about pointing to it in the install-recovery-2.sh, however that is not available on my FireTV. I have also read about placing the script in system/etc/init.d/ however that path doesn't exist on the fireTV either.
Would prefer to do this at the system level and not rely on a manager (Tasker, Script Manager, etc).
Anyone have any experience?
Click to expand...
Click to collapse
/system/etc/install-recovery.sh
rbox said:
/system/etc/install-recovery.sh
Click to expand...
Click to collapse
That file does not exist in /system/etc/ on my FireTV
patrickorr said:
That file does not exist in /system/etc/ on my FireTV
Click to expand...
Click to collapse
Yes... you have to create it...
rbox said:
Yes... you have to create it...
Click to expand...
Click to collapse
Ahh, sorry a little dense
Will give that a shot and report back on the results
Ok, I have placed install-recovery.sh (which houses my mounting script) in /system/etc/
I reboot and it doesn't appear that the script has run. Is there anything else I would need to do in order to get it to run on boot?
If it matters here are the details on my FireTV
Custom Recovery 6.0.5.1.4a
Pre-rooted 51.1.4.1_514013920
patrickorr said:
Ok, I have placed install-recovery.sh (which houses my mounting script) in /system/etc/
I reboot and it doesn't appear that the script has run. Is there anything else I would need to do in order to get it to run on boot?
If it matters here are the details on my FireTV
Custom Recovery 6.0.5.1.4a
Pre-rooted 51.1.4.1_514013920
Click to expand...
Click to collapse
And you're sure the script works?
rbox said:
And you're sure the script works?
Click to expand...
Click to collapse
That is a very good question How can I test that my script is functioning?
From adb shell or Terminal emulator I type the following commands to mount my NAS:
Code:
su
cd /mnt/obb/
mkdir nas
chmod 777 nas
mount -o noperm,unc=\\\\192.168.1.147\\Public,username=xxxxxx,password=xxxxxx -t cifs none /mnt/obb/nas
To turn this into a script I just dumped it into notepad and added #!/system/bin/sh to the top and saved it as install-recovery.sh.
patrickorr said:
That is a very good question How can I test that my script is functioning?
From adb shell or Terminal emulator I type the following commands to mount my NAS:
Code:
su
cd /mnt/obb/
mkdir nas
chmod 777 nas
mount -o noperm,unc=\\\\192.168.1.147\\Public,username=xxxxxx,password=xxxxxx -t cifs none /mnt/obb/nas
To turn this into a script I just dumped it into notepad and added #!/system/bin/sh to the top and saved it as install-recovery.sh.
Click to expand...
Click to collapse
Run it from adb, but right off the bat, I can tell you you need to chmod 755 it atleast before that will work.
rbox said:
Run it from adb, but right off the bat, I can tell you you need to chmod 755 it atleast before that will work.
Click to expand...
Click to collapse
Ok, was able to run the script, but got the following error(s):
Code:
127|[email protected]:/system/etc # sh ./install-recovery.sh
sh ./install-recovery.sh
: not foundecovery.sh[2]:
: not foundecovery.sh[3]: su
: No such file or directoryd: /mnt/obb/
, Read-only file system
: No such file or directory
mount: No such file or directory
patrickorr said:
Ok, was able to run the script, but got the following error(s):
Code:
127|[email protected]:/system/etc # sh ./install-recovery.sh
sh ./install-recovery.sh
: not foundecovery.sh[2]:
: not foundecovery.sh[3]: su
: No such file or directoryd: /mnt/obb/
, Read-only file system
: No such file or directory
mount: No such file or directory
Click to expand...
Click to collapse
Well first of all, don't run it with sh... it needs to have #!/system/bin/sh at the top, and you need to run it directly. Second, don't put su in it because it's already running in the root context.
rbox said:
Well first of all, don't run it with sh... it needs to have #!/system/bin/sh at the top, and you need to run it directly. Second, don't put su in it because it's already running in the root context.
Click to expand...
Click to collapse
How would I run it directly?
Here is my current script (with su removed):
Code:
#!/system/bin/sh
cd /mnt/obb/
mkdir nas
chmod 777 nas
mount -o noperm,unc=\\\\192.168.1.147\\Public,username=xxxxxx,password=xxxxxx -t cifs none /mnt/obb/nas
patrickorr said:
How would I run it directly?
Here is my current script (with su removed):
Code:
#!/system/bin/sh
cd /mnt/obb/
mkdir nas
chmod 777 nas
mount -o noperm,unc=\\\\192.168.1.147\\Public,username=xxxxxx,password=xxxxxx -t cifs none /mnt/obb/nas
Click to expand...
Click to collapse
Just type:
/system/etc/install-recovery.sh
rbox said:
Just type:
/system/etc/install-recovery.sh
Click to expand...
Click to collapse
I am attempting to run that in adb shell, but am getting the following errors:
Code:
[email protected]:/ $ cd /system/etc/
cd /system/etc/
[email protected]:/system/etc $ stat -c "%a %n" install-recovery.sh
stat -c "%a %n" install-recovery.sh
777 install-recovery.sh
[email protected]:/system/etc $ /system/etc/install-recovery.sh
/system/etc/install-recovery.sh
/system/bin/sh: /system/etc/install-recovery.sh: No such file or directory
1|[email protected]:/system/etc $ ./system/etc/install-recovery.sh
./system/etc/install-recovery.sh
/system/bin/sh: ./system/etc/install-recovery.sh: not found
127|[email protected]:/system/etc $
It seems like the permissions are correct on the file, and I also tried adding ./ before the path to see if that made any differences.
I made a slight "upgrade" to my script to see if it would help (but as you can probably already see, I am not exactly sure what I am doing!):
Code:
#!/system/bin/sh
mkdir /mnt/obb/nas
chmod 777 /mnt/obb/nas
busybox mount -o noperm,unc=\\\\192.168.1.147\\Public,username=xxxxxx,password=xxxxxx -t cifs none /mnt/obb/nas
patrickorr said:
I am attempting to run that in adb shell, but am getting the following errors:
Code:
[email protected]:/ $ cd /system/etc/
cd /system/etc/
[email protected]:/system/etc $ stat -c "%a %n" install-recovery.sh
stat -c "%a %n" install-recovery.sh
777 install-recovery.sh
[email protected]:/system/etc $ /system/etc/install-recovery.sh
/system/etc/install-recovery.sh
/system/bin/sh: /system/etc/install-recovery.sh: No such file or directory
1|[email protected]:/system/etc $ ./system/etc/install-recovery.sh
./system/etc/install-recovery.sh
/system/bin/sh: ./system/etc/install-recovery.sh: not found
127|[email protected]:/system/etc $
It seems like the permissions are correct on the file, and I also tried adding ./ before the path to see if that made any differences.
I made a slight "upgrade" to my script to see if it would help (but as you can probably already see, I am not exactly sure what I am doing!):
Code:
#!/system/bin/sh
mkdir /mnt/obb/nas
chmod 777 /mnt/obb/nas
busybox mount -o noperm,unc=\\\\192.168.1.147\\Public,username=xxxxxx,password=xxxxxx -t cifs none /mnt/obb/nas
Click to expand...
Click to collapse
That sounds strange... but you'll need to run su before running it, because it needs root. It could be that its not in UNIX file format. If you edited it on Windows you need to use an advanced editor that has the ability to save as UNIX format.
rbox said:
That sounds strange... but you'll need to run su before running it, because it needs root. It could be that its not in UNIX file format. If you edited it on Windows you need to use an advanced editor that has the ability to save as UNIX format.
Click to expand...
Click to collapse
Unix file format appears to have been the issue. When I opened it with SManager I saw some nasty whitespace characters. Removed those and the script works as expected:
Code:
[email protected]:/data/media/0 # ./install-recovery.sh
./install-recovery.sh
[email protected]:/data/media/0 # cd /mnt/obb/nas
cd /mnt/obb/nas
[email protected]:/mnt/obb/nas # ls
ls
Games
Photos
Shared Music
Shared Videos
eBooks
key.txt
[email protected]:/mnt/obb/nas #
After confirming the script worked as expected, I moved it to /system/etc/ and verified permissions were acceptable (777). Upon reboot I see that the /mnt/obb/nas is created, however the NAS is not mapped.
Can you comment, when is the install-recovery.sh called in the boot up process? Is it possible that the CIFS module isn't fully loaded when this is called? Alternatively, is there a log that I could reference to see if any error occurred while running the script at startup?
patrickorr said:
Unix file format appears to have been the issue. When I opened it with SManager I saw some nasty whitespace characters. Removed those and the script works as expected:
Code:
[email protected]:/data/media/0 # ./install-recovery.sh
./install-recovery.sh
[email protected]:/data/media/0 # cd /mnt/obb/nas
cd /mnt/obb/nas
[email protected]:/mnt/obb/nas # ls
ls
Games
Photos
Shared Music
Shared Videos
eBooks
key.txt
[email protected]:/mnt/obb/nas #
After confirming the script worked as expected, I moved it to /system/etc/ and verified permissions were acceptable (777). Upon reboot I see that the /mnt/obb/nas is created, however the NAS is not mapped.
Can you comment, when is the install-recovery.sh called in the boot up process? Is it possible that the CIFS module isn't fully loaded when this is called? Alternatively, is there a log that I could reference to see if any error occurred while running the script at startup?
Click to expand...
Click to collapse
It's probably running before the network comes up. There might be maybe some kind of regular android apk that will run a script when the network comes up. There might be a way to just stick a loop in your current script waiting for something, not sure.
You could probably just add "sleep 30" to the beginning of the script.
rbox said:
It's probably running before the network comes up. There might be maybe some kind of regular android apk that will run a script when the network comes up. There might be a way to just stick a loop in your current script waiting for something, not sure.
Click to expand...
Click to collapse
ECEXCURSION said:
You could probably just add "sleep 30" to the beginning of the script.
Click to expand...
Click to collapse
Thanks, will give that a try when I get back home.
Edit: It worked! Thanks to the both you for your input.
Just wondering since I'm a newbie when it comes to this one. Does mounted folder have to be in /mnt/obb or can I choose any directory I want?

help me please I cannot modify system files despite having root

i'm on (pixel 2xl) lineageos 16.0 rooted with magisk, i want to add a script in init.d folder but i can't do it, i tried with root explorer but it doesn't work, afwall also can't mount folder for startup script, any solution?
lg_g3_d855 said:
i'm on (pixel 2xl) lineageos 16.0 rooted with magisk, i want to add a script in init.d folder but i can't do it, i tried with root explorer but it doesn't work, afwall also can't mount folder for startup script, any solution?
Click to expand...
Click to collapse
Why? What error do you get?
Try to move/copy something into /tmp folder. It should work if you're rooted (your shell shows # instead of $).
If it doesn't work, maybe you have to remount your system as rw (read and write):
Code:
mount -o rw,remount /
after you made your modifications, mount it as ro (read only) again:
Code:
mount -o ro,remount /
If it still doesn't work, we need to see the error you get (copy and paste into this forum) while moving/coping something into /tmp.
User699 said:
Why? What error do you get?
Try to move/copy something into /tmp folder. It should work if you're rooted (your shell shows # instead of $).
If it doesn't work, maybe you have to remount your system as rw (read and write):
Code:
mount -o rw,remount /
after you made your modifications, mount it as ro (read only) again:
Code:
mount -o ro,remount /
If it still doesn't work, we need to see the error you get (copy and paste into this forum) while moving/coping something into /tmp.
Click to expand...
Click to collapse
i tried with mount -o rw, remount, but it keeps showing me the file system is read only
.
lg_g3_d855 said:
i tried with mount -o rw, remount, but it keeps showing me the file system is read only
.
Click to expand...
Click to collapse
Can you verify you entered that command as root?
Please do the following:
Do this on your computer to enter your devices shell
Code:
prompt_PC:~$ adb shell
Code:
prompt:~$ whoami
This should give you either "shell" or "root"
If it says "shell" do:
Code:
prompt:~$ su
prompt:~#
It will show a # instead of $ if you're root.
If you're already root (or you are now root due to su command), do:
Code:
prompt:~# mount -o rw,remount /
Now it should be writeable and you can do your modifications.
After you finished you need to change it to ro (read only) again:
Code:
prompt:~# mount -o ro,remount /
After that you can exit the shell:
Code:
prompt:~# exit
prompt:~$ exit
(first exits su, second exits shell)
I'm sorry if you already did that but I wan't to be sure you did it correctly.
If this procedere doesn't work, please copy and past your input and output into this forum as this might help to understand what's going on/failing etc.
User699 said:
Can you verify you entered that command as root?
Please do the following:
Do this on your computer to enter your devices shell
Code:
prompt_PC:~$ adb shell
Code:
prompt:~$ whoami
This should give you either "shell" or "root"
If it says "shell" do:
Code:
prompt:~$ su
prompt:~#
It will show a # instead of $ if you're root.
If you're already root (or you are now root due to su command), do:
Code:
prompt:~# mount -o rw,remount /
Now it should be writeable and you can do your modifications.
After you finished you need to change it to ro (read only) again:
Code:
prompt:~# mount -o ro,remount /
After that you can exit the shell:
Code:
prompt:~# exit
prompt:~$ exit
(first exits su, second exits shell)
I'm sorry if you already did that but I wan't to be sure you did it correctly.
If this procedere doesn't work, please copy and past your input and output into this forum as this might help to understand what's going on/failing etc.
Click to expand...
Click to collapse
yes I'm root, output is file system is read only despite adb commands
lg_g3_d855 said:
yes I'm root, output is file system is read only despite adb commands
Click to expand...
Click to collapse
Well, I'm sorry then... I can't help.
Good luck!

Categories

Resources