MoDaCo custom rom - weird display of "ls" - Hero, G2 Touch Android Development

I've installed modaco's custom rom (2.6) for a few times; when i use 'adb shell' and try to do a "ls" it gives me the following:
Code:
C:\>adb shell
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# cd /system
cd /system
# ls
ls
app customize framework medi
a xbin
bin etc lib sd[
0m
build.prop fonts lost+found usr[
0m
# ls
ls
app customize framework medi
a xbin
bin etc lib sd[
0m
build.prop fonts lost+found usr[
0m
but when I boot into recovery mode it works fine:
Code:
ls
app customize framework media xbin
bin etc lib sd
build.prop fonts lost+found usr
/system # cd
anyone got similar problems?

kazuni said:
I've installed modaco's custom rom (2.6) for a few times; when i use 'adb shell' and try to do a "ls" it gives me the following:
Code:
C:\>adb shell
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
# cd /system
cd /system
# ls
ls
app customize framework medi
a xbin
bin etc lib sd[
0m
build.prop fonts lost+found usr[
0m
# ls
ls
app customize framework medi
a xbin
bin etc lib sd[
0m
build.prop fonts lost+found usr[
0m
but when I boot into recovery mode it works fine:
Code:
ls
app customize framework media xbin
bin etc lib sd
build.prop fonts lost+found usr
/system # cd
anyone got similar problems?
Click to expand...
Click to collapse
Those are ANSI color codes and they appear because ls thinks you have a terminal that supports it. Paul will probably fix this in an upcoming version.
If you want to get ls to behave normally you can run the following command.
alias ls="ls --color=no"
After that ls should produce normal output.

packetlss said:
Those are ANSI color codes and they appear because ls thinks you have a terminal that supports it. Paul will probably fix this in an upcoming version.
If you want to get ls to behave normally you can run the following command.
alias ls="ls --color=no"
After that ls should produce normal output.
Click to expand...
Click to collapse
Ahh, thanks for the heads up. got it

same for me here, but under ftp (ftpserver) and usb file connection

Related

Shell commands

Here you will find a list of some shell commands you can use on your android phone, either with a terminal emulator or over adb shell from your PC. I would recommend using connectbot as your terminal emulator.
The commands listed are in no way limited to what is described below, I am just scraping the surface here. For more information on these commands type ' --help' after your command, e.g. 'mount --help' or use google, most of these commands are exactly the same as what you would find on any Linux system, so you will find EXTENSIVE information on the web if you want to know more.
These commands work on my HTC Desire running Cyanogenmod 6 (Android 2.2), most, if not all of them should work on other devices and/or roms.
If you have any suggestions post them below or pm me and I will edit this post to include them.
Notes
Most of these commands require root privileges, type su first.
Everything after a # is a not and not a part of the command.
busybox
What it does
Provides a selection of commands not built into android by default.
Example(s)
busybox cp a b
Notes
busybox is included in most custom roms and has aliases set up so you do not need to type busybox before the commands eg, 'cp' is the same as 'busybox cp' in most custom roms.
cat
What it does
Prints the contents of a (text)file onscreen.
Example(s)
cat file
cd
What it does
Changes the current directory. You may find it easier to change to the directory you will be working in before issuing other commands so you dont need to include the full path in your commands.
Example(s)
cd .. # Go up 1 directory level, eg go from '/sdcard/download/ to '/sdcard'.
cd /sd-ext # Change to '/sd-ext'.
chmod
What it does
Makes a file executable
Example(s)
chmod 755 /data/bin/yourbin
cp
What it does
Copies files/directories
Example(s)
cp filea fileb
cp -rf directorya directoryb # Copy entire directory recursively and forces copy.
df
What it does
Displays information on all mounted filesystems (free space).
Example(s)
df -hm # Show disk usage in human readable format in Megabytes.
du
What it does
Diplays the size of files/directories.
Example(s)
du -md 1 # Prints the size of all directories in Megebytes.
du -sh file # Prints the size of file in human readable format.
du -sh directory # Prints the size of directory in human readable format.
export
What it does
Sets environment variables.
Example(s)
export PATH=$PATH;/sd-ext/bin;
free
What it does
Display the amount of free and used system memory
losetup
What it does
Associates loop disk images with loop devices.
Example(s)
losetup /sdcard/disk.img /dev/block/loop7
Notes
Android 2.2's implementation of apps2sd uses one loop device for each app saved to SD. There are 8 loop devives by default (loop0-loop7) so if you have 8 or more apps saved to SD you will not be able to use this command. There is no issue when using 'oldschool a2sd'
ls
What it does
List Directory contents.
Example(s)
ls -a # List directory contents including hidden contents.
mount
What it does
Mounts a filesystem.
Example(s)
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 # Remounts /system as writable.
mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 # Remounts /system as read only.
mount -t ext2 /dev/block/loop6 /sdcard/disk # Mount loop6 on /sdcard/disk.
mount /sd-ext /sdcard/sd-ext # Mount /sd-ext on /sdcard/sd-ext.
Notes
On other devices it may be possible to mount disk images without going through losetup and using the option -loop in mount instead.
If you are having trouble with mount try using busybox mount instead, the busybox version seems more capable than the one shipped with Android.
mv
What it does
Move/rename files/directories
Example(s)
mv download/file stuff/file
mv picture4.jpg mydog.jpg
ping
What it does
Pings a server to check for conectivity.
Example(s)
ping -c 5 http://www.google.com # Ping google 5 times
Notes
if you do not include the -c option ping will work indefinatly.
pwd
What it does
Prints the current directory.
rm
What it does
Remove file/directory.
Example(s)
rm file
rm -rf directory # Delete a directory and its contents.
rmdir
What it does
Removes a directory
Example(s)
rmdir emptydir
Notes
If a directory has contents us 'rm -rf' instad.
su
What it does
Gives you root privelages.
touch
What it does
Makes an empty file
Example(s)
touch file.txt
wget
What it does
Download things from http or ftp.
Example(s)
wget http://www.google.com
Excellent, thank you.
Just what the doctor ordered for n00bs like me

Fix Permitions from Terminal ;) (Help apps not to force close))

To install from CMD - Terminal
1. Download the fxps script. http://www.mediafire.com/?o525y4b4dewdvor
2. adb shell mount -o rw,remount /dev/block/stl6 /system
3. adb push fxps /system/bin/fxps
4. adb shell busybox chmod 755 /system/bin/fxps
5. adb shell reboot
To Run it
1. adb shell fxps
2 adb shell reboot
To install from Terminal Emulator
"Download the fxps script and move it in your SD Card" http://www.mediafire.com/?o525y4b4dewdvor
$ su
# adb shell mount -o rw,remount /dev/block/stl6 /system (Puts the system in R/W mode)
# cp /sdcard/fxps /system/bin/fxps (Copys the script from SD Card to bin directory)
# chmod 755 /system/bin/fxps (Gives root access to the script)
# reboot
To Run it open the Terminal Emulator and enter
$ su
# fxps (It will start... When it finish reboot)
# reboot
This Script is not mine i just find it and gine it to you in simple way
Thanks the Dev of this Script i hope to see it in Power Menu some day...
Great tutorial but AFAIK all available recoveries have this built in as an option dont they?
nikkpap said:
...
$ su
# adb shell mount -o rw,remount /dev/block/stl6 /system (Puts the system in R/W mode)
...
Click to expand...
Click to collapse
should be
$ su
# mount -o rw,remount /dev/block/stl6 /system (Puts the system in R/W mode)
AcePolska said:
should be
$ su
# mount -o rw,remount /dev/block/stl6 /system (Puts the system in R/W mode)
Click to expand...
Click to collapse
Am I the only one who thought that the system-partition should be mounted from /dev/block/mtdblock3 ?
i believe it should be mtdblock3 or you can boot into recovery and just adb shell mount /system

[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

[Guide] How to disable Virtual CDrom on OOS

Just wanted to know if anyone knows how to disable the virtual cdrom in OOS when you plug in usb to pc. I have looked and there is no cdrom.iso like other phones i had.
Edit: Just overlooked the file.
If anyone is interested in disabling the virtual cdrom upon usb connection, navigate to /system/etc with a root filemanager and rename usb_drivers.iso to usb_drivers.iso.bak and reboot. or enter the following commands in adb shell and reboot. Phone MUST be rooted.
Code:
adb shell
su
mount -o remount,rw /system
mv /system/etc/usb_drivers.iso /system/etc/usb_drivers.iso.bak
mount -o remount,ro /system
Revert
Code:
adb shell
su
mount -o remount,rw /system
mv /system/etc/usb_drivers.iso.bak /system/etc/usb_drivers.iso
mount -o remount,ro /system
Edit: fixed a typo
for everyone getting this Error:
mount: '/dev/block/bootdevice/by-name/system_b'->'/system': Device or resource busy
Click to expand...
Click to collapse
You have to use this Command
mount -o rw,remount /system
Click to expand...
Click to collapse
instead of
mount -o remount,rw /system
Click to expand...
Click to collapse
Thanks!
That worked for my OnePlus 6.
Thanks!
That worked for my OnePlus 7 pro.

Startup Scripts

Stock ROM, oreo.
How do you execute scripts on startup? Either by init.d or some other means, doesn't matter as long as it works. The /system/etc/init.d folder isn't there. Remounting /system for me doesn't work:
mount -o remount,rw -t ext4 /dev/block/platform/hi_mci.0/by-name/system /system
I get: '/system': Device or resource busy
I reboot into TWRP, I get the same error as above. Any help please?
TouchOdeath said:
Stock ROM, oreo.
How do you execute scripts on startup? Either by init.d or some other means, doesn't matter as long as it works. The /system/etc/init.d folder isn't there. Remounting /system for me doesn't work:
mount -o remount,rw -t ext4 /dev/block/platform/hi_mci.0/by-name/system /system
I get: '/system': Device or resource busy
I reboot into TWRP, I get the same error as above. Any help please?
Click to expand...
Click to collapse
For mounting you use these command.
In local terminal
HWBND-H:/ $ su
HWBND-H:/ # mount -o rw,remount /system
In adb terminal
adb shell su -c mount -o rw,remount /system
And to see how is mounted
HWBND-H:/ # mount | grep system
It should return like this.
/dev/block/mmcblk0p51 on /system type ext4 (rw,seclabel,relatime,data=ordered)
And to go back to ro do this or reboot:
HWBND-H:/ # mount -o ro,remount /system
HWBND-H:/ # mount | grep system
/dev/block/mmcblk0p51 on /system type ext4 (ro,seclabel,relatime,data=ordered)
mrmazak said:
For mounting you use these command.
In local terminal
HWBND-H:/ $ su
HWBND-H:/ # mount -o rw,remount /system
In adb terminal
adb shell su -c mount -o rw,remount /system
And to see how is mounted
HWBND-H:/ # mount | grep system
It should return like this.
/dev/block/mmcblk0p51 on /system type ext4 (rw,seclabel,relatime,data=ordered)
And to go back to ro do this or reboot:
HWBND-H:/ # mount -o ro,remount /system
HWBND-H:/ # mount | grep system
/dev/block/mmcblk0p51 on /system type ext4 (ro,seclabel,relatime,data=ordered)
Click to expand...
Click to collapse
Thank you for your response I appreciate it. I ended up making my problem more complicated than it had to be. The solution was to open terminal and do:
adb shell
su
mkdir /system/etc/init.d
cp /storage/emulated/0/Downloads/script.sh /system/etc/init.d/script.sh
If I tried to create the folder through a rooted app (Total Commander), it didn't work. Copying the file through an app didn't work either.

Categories

Resources