[Q] Correct path in Terminal Emulator? - G2 and Desire Z Q&A, Help & Troubleshooting

I have spent hours trying to find an answer to what I thought was a simple question, but I just can't seem to find it...
I wanted to familiarize myself more with Terminal Emulator, so I used it to delete a system app that needed to go.
I used these commands:
$ su
# mount -o remount,rw -t yaffs2 /dev/block/mtdblk3 /system
# rm /system/app/xxx.apk
It appears to have worked perfectly after a reboot, but my question is: what is the correct code to mount your system partition in TE? I have seen several variations of the line I used. Often they vary at 'mtdblk3.' I have seen it 'mtdblock5,' for example. Is there a particular line I should use for my specific device? Is it dependent on what I am specifically trying to do?
Any information is greatly appreciated; even/especially a link toward my answer. Thank you very much.

I've always used 'mount -o remount,rw /dev/block/mmcblk0p25 /system'
as far as 'correct' code I don't think there is as such. But I think different devices would have different partitions and mount points for system.
-Nipqer

I think it will depend on where your system is mounted, although I don't know why that would vary for the G2. It might be different for the DZ and certainly for other devices.
You can type "mount" in the terminal to see where everything is mounted.

Ditamae said:
I have spent hours trying to find an answer to what I thought was a simple question, but I just can't seem to find it...
I wanted to familiarize myself more with Terminal Emulator, so I used it to delete a system app that needed to go.
I used the code:
$ su
# mount -o remount,rw -t yaffs2 /dev/block/mtdblk3 /system
# rm /system/app/xxx.apk
It appears to have worked perfectly after a reboot, but my question is: what is the correct code to mount your system partition in TE? I have seen several variations of the line I used. Often they vary at 'mtdblk3.' I have seen it 'mtdblock5,' for example. Is there a particular line I should use for my specific device? Is it dependent on what I am specifically trying to do?
Any information is greatly appreciated; even/especially a link toward my answer. Thank you very much.
Click to expand...
Click to collapse
i use this command:
# mount -w -o remount /dev/block/mmcblk0p25 /system

Thanks for the replies... I see now, that the path I should have used is: /dev/block/mmcblk0p25 /system. And that "code" was the wrong word. I was asking about commands & paths not code. Sorry - still learning.
edit: If anyone knows of a good and thorough resource of Terminal commands, I'd love it if you'd share... I've found bits and pieces of info, but something more comprehensive would be great. Thanks again.

Wow you guys are going about it using the long hand method. If you're just deleting a system app, to mount the /system as rw just enter:
Code:
$su
#mount -o remount,rw /system
#rm -f /system/app/xxxx.apk
The -f command isn't really needed but I use it to make sure the job gets done. Not sure if the pm uninstall command is used anymore. I'll have to look into that. I know some phones required you to mount yaffs and mmcblockXX but for just deleting an app I don't believe it's required. Never had an issue not typing that.

Here's the correct way to delete the app:
mount -o rw,remount /system
rm /path/to/app
reboot
Click to expand...
Click to collapse
Or you could use remount,rw. It's the same command. I threw reboot in there to reload the app list in your launcher correctly.

Related

How do you verify NAND is unlocked/How to verify you are fully rooted

I have searched the Evo 4g forums, and I am finding it difficult to verify NAND is unlocked/if I am fully rooted. I can confirm that I have partial root. I flashed the latest version of FRESH 1.0.1 with RADIO: 2.05.00.06.10 and WiMax Radio 25641. I also flashed netarchy-toastmod 'fix' for Epson AND Nova - Version 3.6.4 to increase my FPS. Everything seems to work ok.
I did find one post that stated I can run "adb remount rw" in a terminal emulator to check if I am unlocked. The emulator has su access, but I get an access denied and I can not create a folder in the system directory.
Is there an easy method for me to check if NAND is unlocked/if I am fully rooted? Thanks for the help.
Kurt
Unlocked NAND gives access to the system partition as far as I understand. From the shell, run.
Code:
mount
Find what device is your system partition. Should be something like /dev/block/mtdblock4. Then try this.
Code:
mount -o rw,remount -t yaffs2 /dev/blco/mtdblock4 /system
That will remount your system partition into read/write mode. If that works your NAND is unlocked. You can remount your system partition back into read only mode by changing the rw to ro and running the command again.
Thanks
It took me a few minutes to figure this out, but it looks like I am fully rooted.
I opened terminal emulator on my phone then typed the following:
su
<enter>
mount
<enter>
I big list of things appeared, and I saw what you were referencing. The line reads the following:
/dev/block/mtdblock4 /system yaffs2 ro 0 0
If I understand correctly the system partition is in "ro" or read only. I then typed what you wrote. I think you had a typo because it errored out. I typed the following:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock4 /system
<enter>
I then typed the following:
mount
<enter>
The line in the list now reads the following:
/dev/block/mtdblock4 /system yaffs2 rw 0 0
The "rw" means that I have read/write access to the system partition. I then typed the following to change it back to "read only".
mount -o ro,remount -t yaffs2 /dev/block/mtdblock4 /system
<enter>
mount
<enter>
The line now reads the following:
/dev/block/mtdblock4 /system yaffs2 ro 0 0
I am now back in read only mode, and this verified that I have full root access. If my reasoning is wrong, please let me know, and I will edit this post.
Hopefully, this will help others determine whether or not they are fully rooted.
Thanks for your help.
Kurt
Everything in you post looks correct. Using the 'adb remount' command acomplishes the same thing but your rom has to support it and most don't because they are based off the stock sprint rom.
So just to reiterate, just because 'adb remount' doesn't work on your rom doesn't necissarily mean you don't have nand unlocked. There are also some tools like 'spare parts' you can use to remount your system partition from within the gui.
The easiest way is to determine which HBOOT version you have installed. Full root means you hane NAND unlocked which allows you to do anything.
79.00 = locked
76.20 = unlocked
Reboot and upon startup hold down the volume down and power buttons at the same time until the white screen appears. HBOOT version will be listed at the top in green letters I believe

[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

Extremely frustrating issue with Linux on Android

I have had the absolute worst time with getting Linux on Android to work on my Nexus 7. On 4.3 and 4.4, across many different Roms and kernels, the issue has persisted. Not a single other person on earth seems to have had this problem so i am going here as a last resort. For some infuriating reason, I am being denied permission to the mount -t command. The scripts always stop at mounting the image file to the loop device. I manually run the mount command, yes I am running as su, and I get this error: "Cannot execute -t: Permission denied" Why am I being denied permission when I am su? I even chmod 777 all the files associated with this command. There is absolutely no reason for this to happen, yet it does. I even do setenforce 0 to try and stop selinux from doing anything that could interfere.
Thanks if you can help.
What's the full command you;re trying to execute?
su mount -t ext4 /sdcard/kali/kali.img /dev/block/loop255
That's the line (minus su) that was in the bootscript that it was getting stuck on.
TheDoolster said:
su mount -t ext4 /sdcard/kali/kali.img /dev/block/loop255
That's the line (minus su) that was in the bootscript that it was getting stuck on.
Click to expand...
Click to collapse
Try adding -o rw,remount?
i.e. su mount -o rw,remount -t ext4 /sdcard/kali/kali.img /dev/block/loop255
If you're trying to get kali on android to use as a pwnpad, there is a thread here which walks one through it...it's a fully functional kali distro.

adb mount command for rw on Tab Pro

Just got a used Tab Pro 8.4. I've rooted it and now am interested in debloating it. I've always done this manually with adb on my previous devices using a command I always assumed was specific to that particular device (ie. mount -o remount,rw /dev/block/mmcblk0p20 /system for a Note 3) .
I haven't found any references in the Tab Pro forum to the mount command for writing to the system partition. When I list the mount points with the mount command inside the adb shell I see this:
/dev/block/platform/msm_sdcc.1/by-name/system /system ext4 ro,seclabel,relatime,data=ordered 0 0
So would the command really be mount -o remount,rw /dev/block/platform/msm_sdcc.1/by-name/system /system ? I have seen references elsewhere to a generic "mount -o rw,remount /system" command for Android devices in general.
I'm sure there are pre-built tools that would let me do some debloating without worrying my little head about what's going on under the hood. But please humor me. I enjoy learning the details of how these boxes operate by working with them manually. Any help here will be appreciated. Thanks.
So you are not going to flash the ROM, you could also try Gates Debloater tool. I used on my Note 4 all the time, may Tab I just flashed to a new ROM though.
Sent from my Nexus 6P using Tapatalk
ossito2012 said:
So you are not going to flash the ROM, you could also try Gates Debloater tool.
Click to expand...
Click to collapse
No thank you. I like to see the .apk disappear when I delete it from the command line. Just a thing I've got. I assume I'm looking for something like "mount -o remount,rw /dev/block/?????? /system".
rtfm1777 said:
No thank you. I like to see the .apk disappear when I delete it from the command line. Just a thing I've got. I assume I'm looking for something like "mount -o remount,rw /dev/block/?????? /system".
Click to expand...
Click to collapse
If it's rooted you can use titanium backup to delete.
Sent from my Nexus 6P using Tapatalk
rtfm1777 said:
No thank you. I like to see the .apk disappear when I delete it from the command line. Just a thing I've got. I assume I'm looking for something like "mount -o remount,rw /dev/block/?????? /system".
Click to expand...
Click to collapse
All you should need to do is
# mount -o remount,rw /system
It's in fstab, so you don't need the block device.
When done just issue a sync and reboot.
Sent from my LG-H901 using Tapatalk
toastido said:
All you should need to do is
# mount -o remount,rw /system
It's in fstab, so you don't need the block device.
When done just issue a sync and reboot.
Sent from my LG-H901 using Tapatalk
Click to expand...
Click to collapse
Done. And it does indeed work. Thank you sir.

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