Tell me what I'm doing wrong here. I'm trying to make a script that will remove some apps whenever I flash a new rom. Here's what I thought would work:
Code:
mount -o remount,rw /dev/block/mtdblock3 /system
cd /system/app
rm com.amazon*.apk
rm Mail.apk
rm Development.apk
rm LatinIME.apk
To use it I type:
Code:
$ su
# sh /sdcard/apps.sh
and it just fails at every line. Any help would be appreciated.
On the first line try
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
or your could shortcut it by using
mount /system
Stupid question, but do you have the permissions set to allow root access?
I've done that a few times to realize what my "mistake" was.
well you could just make a script for your PC something along the lines of
Code:
@echo off
adb remount
adb shell rm /system/app/com.amazon*.apk
adb shell rm /system/app/Mail.apk
adb shell rm /system/app/Development.apk
adb shell rm /system/app/LatinIME.apk
adb shell reboot
and rename it to a .bat or .cmd file
jackslim said:
On the first line try
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
or your could shortcut it by using
mount /system
Click to expand...
Click to collapse
Ok so I did that and the script appears to be working. I'll test it when Cyanogen release another update with amazon... Adding the -t yaffs2, what exactly did that do?
The -t is a trigger saying that your going to specify what type of filesystem your mounting, yaffs2 is the type of filesystem
heya guys.
is it possible to unload/unmount the external sd (mounted in /mnt/sdcard/external_sd) via command like unmounting it via settings?
i knew that the card is mounted as mmcblk1(p1).
how about to mount it to another place via command?
is it even possible?
trying via terminal emulator says always that the device is still busy and cannot unmounted. even with -f
cheers ~
current state is as following:
/etc/init.d/S01init
Code:
#!/system/bin/sh
# remount
busybox mount -o rw,remount /
#create paths
mkdir /sd
mkdir /mnt/sdcard_ext
chmod 0775 /mnt/sdcard_ext
#duplicate, delete and linking original files
cp /init.rc /init.rc_original
cp /etc/voId.fstab /etc/voId.fstab_original
rm /init.rc
rm /etc/voId.fstab
ln -s /etc/init.d/scripts/init.rc /init.rc
ln -s /etc/init.d/scripts/voId.fstab /etc/voId.fstab
#set init.rc vars
#export EXTERNAL_STORAGE2 /mnt/sdcard_ext
#symlink /mnt/sdcard /sd/sdcard
#symlink /mnt/sdcard_ext /sd/sdcard_ext
#linking new mounting paths
ln -s /mnt/sdcard /sd/sdcard
ln -s /mnt/sdcard_ext /sd/sdcard_ext
busybox mount -o ro,remount /
### end
custom init.rc
Code:
on early-init
start ueventd
on init
sysclktz 0
loglevel 3
# setup the global environment
export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
export LD_LIBRARY_PATH /vendor/lib:/system/lib
export ANDROID_BOOTLOGO 1
export ANDROID_ROOT /system
export ANDROID_ASSETS /system/app
export ANDROID_DATA /data
export EXTERNAL_STORAGE /mnt/sdcard
export EXTERNAL_STORAGE2 /mnt/sdcard_ext
export USBHOST_STORAGE /mnt/sdcard/usbStorage
export ASEC_MOUNTPOINT /mnt/asec
export LOOP_MOUNTPOINT /mnt/obb
export BOOTCLASSPATH /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar
# Backward compatibility
symlink /system/etc /etc
symlink /sys/kernel/debug /d
# Right now vendor lives on the same filesystem as system,
# but someday that may change.
symlink /system/vendor /vendor
# create mountpoints
mkdir /mnt 0775 root system
mkdir /mnt/sdcard 0000 system system
mkdir /mnt/sdcard_ext 0000 system system
# Create cgroup mount point for cpu accounting
mkdir /acct
mount cgroup none /acct cpuacct
mkdir /acct/uid
#add booting sound property
setprop audioflinger.bootsnd 1
# Backwards Compat - XXX: Going away in G*
symlink /mnt/sdcard /sd/sdcard
mkdir /system
mkdir /dbdata 0771 system system
mkdir /data 0771 system system
mkdir /cache 0770 system cache
mkdir /config 0500 root root
mkdir /efs 0771 system system
chown system system /efs
chmod 0771 /efs
.
.
.
custom voId.fstab
Code:
## Vold 2.0 Generic fstab
## - San Mehat ([email protected])
##
#######################
## Regular device mount
##
## Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
## label - Label for the volume
## mount_point - Where the volume will be mounted
## part - Partition # (1 based), or 'auto' for first usable partition.
## <sysfs_path> - List of sysfs paths to source devices
######################
# sdcard mount for the P1
# internal sdcard
{
ums_path = /sys/devices/platform/usb_mass_storage/lun0/file
discard = disable
asec = disable
}
dev_mount sdcard /mnt/sdcard 1 /devices/platform/s3c-sdhci.0/mmc_host/mmc0
# externel sdcard
{
ums_path = /sys/devices/platform/usb_mass_storage/lun1/file
asec = enable
}
dev_mount sdcard1 /mnt/sdcard_ext auto /devices/platform/s3c-sdhci.2/mmc_host/mmc2
#end line ## keep this line
after rebooting:
- the custom voId.fstab is completely ignored...
- init.rc is changed to custom init.rc
- folders and linkings are correct
but it also links to /sdcard and /sdcard/external_sd
i dont want my external sd-card on /sdcard/external_sd and the internal on /sdcard
is there no way to fix that?
Look at this thread. May be it will be helpful for you.
swapping won't help.
problem is to fix the /proc/mounts - paths for the external card.
it wont let me modify it
1. I think you have to put name vold.fstab (little L, not big I)
2. At my phone /sdcard is just symlink to /mnt/sdcard . May be you just should remove this symlink?
I can be wrong because I don't know about changes in the Darky's Extreme Edition v10.1 ROM. but my words are true for stock rom for i9003
falex007 said:
1. I think you have to put name vold.fstab (little L, not big I)
Click to expand...
Click to collapse
that would explain whats going wrong by replacing the old with the new file.
falex007 said:
2. At my phone /sdcard is just symlink to /mnt/sdcard . May be you just should remove this symlink?
Click to expand...
Click to collapse
/sdcard isnt the problem.
its the external sd-card, which i want to mount on an other path (e.g. /mnt/sdcard_ext) and symlink it to /sd/sdcard_ext
symlinking isnt the problem. seperating both cards is all i want.
my desired goal is as following:
internal sd: /mnt/sdcard & symlink to /sd/sdcard
external sd: /mnt/sdcard_ext & symlink /sd/sdcard_ext
I understood what you want by reading /etc/init.d/S01init And I think that if you replace old vold.fstab with new one, the problem with mounting external card will be solved too
if i replace the vold.fstab manually and reboot the phone, external sd wont be recognized. it won't load any or mount it on the right place. both folders, original and desired, stay still empty. if I try to mount it manually, it says that the desired path is not recognized by /proc/mounts. changing the mounts file wont change the mount-paths
UPDATE:
ok, i'm now on this:
Code:
#!/system/bin/sh
FSTAB=/system/etc/vold.fstab
FSTAB_O=/system/etc/vold.fstab_original
# remount rw
busybox mount -o rw,remount /
busybox mount -o rw,remount /system
#create paths
mkdir /sd
mkdir /mnt/sdcard_ext
#duplicate, delete and replace original files
if [ ! -e $FSTAB_O ]; then
cp $FSTAB $FSTAB_O
reboot
fi
rm /init.rc
rm $FSTAB
cp /etc/init.d/scripts/init.rc /init.rc
cp /etc/init.d/scripts/vold.fstab $FSTAB
#set init.rc vars
#export EXTERNAL_STORAGE2 /mnt/sdcard_ext
#symlink /mnt/sdcard /sd/sdcard
#symlink /mnt/sdcard_ext /sd/sdcard_ext
#linking new mounting paths
ln -s /mnt/sdcard /sd/sdcard
ln -s /mnt/sdcard_ext /sd/sdcard_ext
# remount ro
busybox mount -o ro,remount /
busybox mount -o ro,remount /system
### end
this script ended in fully ignoring the new vold.fstab after reboot.
now the external sd is mounted at the old mount-point /sdcard/external_sd...
any suggestions?
btw: does anyone knows where the real /proc/mounts is?
it links to self/mounts... what does that mean?
UPDATE:
after replacing vold.fstab i cant install apps at all.
installing ends in forced hotboot.
For reference, these are my thoughts on the matter.
We have 3 ways to do this:
1. Get hold of SBL, change it and flash it
Currently impossible afaik.
2. Get an init.d bash script to reboot into recovery if key is pressed
Most likely possible taking these 2 assumptions into account:
a) Bash allows to detect a pressed key, something like this:
Code:
_key()
{
local kp
ESC=$'\e'
_KEY=
read -d '' -sn1 _KEY
case $_KEY in
"$ESC")
while read -d '' -sn1 -t1 kp
do
_KEY=$_KEY$kp
case $kp in
[a-zA-NP-Z~]) break;;
esac
done
;;
esac
printf -v "${1:-_KEY}" "%s" "$_KEY"
}
_key x
case $x in
$'\e[15~') reboot recovery ;;
esac
Replacing this key code for one of OB's.
But for this, we need assumption number 2:
b) Key codes mapping is the same for recoveries.
Now, while this is the method of the greatest chance to work, it is also fairly useless. Developers will often break the boot before the init.d scripts are ran. So, this code should be ran before. Hence, the third method.
3. Start a custom service in init.rc (@ ramdisk) that will detect pressed key
This would be the perfect solution as it can't be broken from kernel (zImage) or system changes. However, init.rc has its own programming language (android init language) and there's no way to run this kind of listener.
However, it is possible to run an external script located for example in /system/bin/. These can be both an executable compiled from c (higher chances of working) or a bash scripting like the aforementioned one (lower chances of working since android probably doesn't start a console on boot).
Code for this would be something like:
Code:
service exampleservice /system/bin/exampleservice
user exampleservice
group exampleservice
oneshot
So uh, am I missing anything?
Anyone has other ideas?
a lot of times i heared about pressing "G" and "Power" would boot into some kind of save mode... if thats true i guess its easyer to reprogramm that keycombo to do something else... so does that keycombo anything? i couldnt figure out^^
Sent from my LG-P970 using XDA App
Are others devices has the key combination code in SBL?
I wish I have enough knowledge about android system so i can help...
i04055 said:
Are others devices has the key combination code in SBL?
I wish I have enough knowledge about android system so i can help...
Click to expand...
Click to collapse
Yes there are devices heaving the key-combo in SBL if that answers your question. The "Samsung Galaxy S GT-I9000" e.g. has them there afaik. With that device it was possible flashing the SBL to add a "booting directly into recovery" key-combo...
So I don´t know why there should not be a solution to do the same to the OB but Noejn surely has good reason for telling its impossible.
But hey what about booting into recovery on every system startup and only boot into the system through the recovery? It´s a "quick & dirty" solution even if its possible but better than developing the way we do isn´t it? I´m not sure if its easier to change the startup that way than to add or modify a key-combo but maybe someone here does?
I'm sure (or hope..) someone can, but perhaps we should move this Thread to another part of the Forum so someone with the knowledge how to do this will read it.
d0n22 said:
But hey what about booting into recovery on every system startup and only boot into the system through the recovery? It´s a "quick & dirty" solution even if its possible but better than developing the way we do isn´t it? I´m not sure if its easier to change the startup that way than to add or modify a key-combo but maybe someone here does?
Click to expand...
Click to collapse
Yeah, i prefer that way if poosibble rather than nothing.
But if put it that way, when the phone get bootloop is it still posibbe to boot into recovery?
Sent from my LG-P970 using XDA App
This is how it's done on Xperia X8 phone.
The /system/bin/chargemon is usb-charge daemon that is being hijacked on boot (it's binary is replaced with this script)
Original chargemon is copied into "charger" to keep it's functionality.
Than "sleep 3" waits for any keypress, and checks the dump, if keys were pressed, it launches the recovery binary.
quite simple.
Code:
#!/system/bin/busybox sh
/system/bin/charger
cat /dev/input/event1 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -f /data/local/tmp/xrecovery ]
then
rm -f /data/local/tmp/xrecovery
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
cd /
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
# chroot
chroot / /init
fi
# remount rootfs rw
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar
mkdir -p /minicm
cd /minicm
tar -xf /system/bin/ramdisk.tar
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt
racht said:
This is how it's done on Xperia X8 phone.
The /system/bin/chargemon is usb-charge daemon that is being hijacked on boot (it's binary is replaced with this script)
Original chargemon is copied into "charger" to keep it's functionality.
Than "sleep 3" waits for any keypress, and checks the dump, if keys were pressed, it launches the recovery binary.
quite simple.
Code:
#!/system/bin/busybox sh
/system/bin/charger
cat /dev/input/event1 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -f /data/local/tmp/xrecovery ]
then
rm -f /data/local/tmp/xrecovery
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
cd /
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
# chroot
chroot / /init
fi
# remount rootfs rw
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar
mkdir -p /minicm
cd /minicm
tar -xf /system/bin/ramdisk.tar
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt
Click to expand...
Click to collapse
yeah ,from this we can see what is running before logo screen and we can mod that file
so.. is that mean we can boot to recovery mode same as x8?
racht said:
This is how it's done on Xperia X8 phone.
The /system/bin/chargemon is usb-charge daemon that is being hijacked on boot (it's binary is replaced with this script)
Original chargemon is copied into "charger" to keep it's functionality.
Than "sleep 3" waits for any keypress, and checks the dump, if keys were pressed, it launches the recovery binary.
quite simple.
Code:
#!/system/bin/busybox sh
/system/bin/charger
cat /dev/input/event1 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -f /data/local/tmp/xrecovery ]
then
rm -f /data/local/tmp/xrecovery
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
cd /
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
# chroot
chroot / /init
fi
# remount rootfs rw
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar
mkdir -p /minicm
cd /minicm
tar -xf /system/bin/ramdisk.tar
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt
Click to expand...
Click to collapse
soundes quite promising... have you tried it?
Can this be usefull?
http://forum.xda-developers.com/showthread.php?t=991276
Noejn have you abandoned us ? Or are u planning to take a look at this ? Would be nice if u get OB up and running
recovery
Hi,
has there been any success with booting into recovery mode?
BR,
J
logitec said:
Hi,
has there been any success with booting into recovery mode?
BR,
J
Click to expand...
Click to collapse
No,I try to boot directly into recovery through boot.img,but I get a big "error" form the LG Security Team!
Hijacking a daemon would work if Optimus Black had those binaries. I took a quick glance at a backup and I didn't see chargemon in /system/bin.
Besides, a xRecovery is limited as it's dependent on system files so a /format can't be done which isn't really that "comfy", especially when changing fs.
But yeah, better than nothing. Still, the method you described is only possible in Xperia phones, as far as I know.
I still say injecting a service on the init.rc is the way to go.
However, I can't test this now.
racht said:
This is how it's done on Xperia X8 phone.
The /system/bin/chargemon is usb-charge daemon that is being hijacked on boot (it's binary is replaced with this script)
Original chargemon is copied into "charger" to keep it's functionality.
Than "sleep 3" waits for any keypress, and checks the dump, if keys were pressed, it launches the recovery binary.
quite simple.
Code:
#!/system/bin/busybox sh
/system/bin/charger
cat /dev/input/event1 > /dev/keycheck&
sleep 3
kill -9 $!
if [ -s /dev/keycheck -o -f /data/local/tmp/xrecovery ]
then
rm -f /data/local/tmp/xrecovery
# remount rootfs rw
mount -o remount,rw rootfs /
# Umount MTDs
umount -l /dev/block/mtdblock1
umount -l /dev/block/mtdblock2
umount -l /dev/block/mtdblock3
# Mount recovery partition
cd /
rm -r /sbin
rm -f etc
tar -xf /system/bin/xrecovery.tar
# Umount /system
umount -l /dev/block/mtdblock0
# chroot
chroot / /init
fi
# remount rootfs rw
mount -o remount,rw rootfs /
chmod 0777 /dev -R
chown 0.2000 /dev/oncrpc -R
cd /
rm init*
rm logo.rle
rm default.prop
tar -xf /system/bin/ramdisk.tar
mkdir -p /minicm
cd /minicm
tar -xf /system/bin/ramdisk.tar
# Umount /system, data and cache
umount -l /dev/block/mtdblock0
umount /dev/block/mtdblock3
umount /dev/block/mtdblock1
rmdir /system /data /cache /mnt
Click to expand...
Click to collapse
Good news, I'm getting close.
ok, thank you for everithing
Noejn said:
Good news, I'm getting close.
Click to expand...
Click to collapse
good news indeed^^ im working on it as well but im not feeling like getting close :-\ pls let me know what you did and how you did it as soon as its done... again thank you very much for your efforts!
Sent from my LG-P970 using XDA App
d0n22 said:
good news indeed^^ im working on it as well but im not feeling like getting close :-\ pls let me know what you did and how you did it as soon as its done... again thank you very much for your efforts!
Sent from my LG-P970 using XDA App
Click to expand...
Click to collapse
Well, I've succeed injecting the script on boot.
However, I'm getting some problems on the event0 > keycheck; I don't think at this time of boot /dev entries are up.
But I've already thought of a workaround and I'll test it tomorrow.
I´m thinking, if i compile kernel of ubuntu and install it in recovery partition, not possible then run ubuntu in native mode from sdcard with dualboot?
Got password protected ssh with dropbear working
Needed files: dropbearmulti
search for dropbear static binary. On landlay page it's in download binaries extras armv6 is working fine.
We need rw on /etc
cp -rp /system/etc /data/etc
mount -o bind /data/etc /system/etc
Now we need to create some files needed of dropbear and add root user
cd /etc
touch passwd group shells shadow
adduser root -g root
add default shells
echo "/bin/sh" > shells
echo "/bin/ash" >> shells
edit passwd and change home dir and shell path, both must exist in CC and shell
also change 1000 to 0
root:x:0:0::/data:/bin/ash
edit group file, change all 1000 to 0
cd /data
chmod +x dropbearmulti
ln dropbearmulti -s dropbear
chmod 755 dropbearmulti
dropbear -p 2222 (dropbear -E -F -p 2222 if you want a log)
Copy the old keys to /etc/dropbear or create new ones
I got a problems when I try to root my c6902 5.1.1,I rooted by kingroot4.1 and follow this web:
http://forum.xda-developers.com/xpe...xperia-z1-c6902-lollipop-5-1-1-t3212562/page2
and the steps1-3 is successful,but I got a problem when I run step 4,there is the error:
1|[email protected]:/ # mount -o remount,rw /system
mount -o remount,rw /system
[email protected]:/ # cat /data/local/tmp/su >/system/xbin/daemonsu && chmod 0755 /system/xbin/daemonsu
local/tmp/su >/system/xbin/daemonsu && chmod 0755 /system/xbin/daemonsu <
k_shell/2000:18282: can't create /system/xbin/daemonsu: Text file busy
I am a chinese and my english is bad,so I search form google,and cant find a solution.can you help me or give me a properly website?
THANKS
help,plz....
Have you searched the faq of superuser for the error you are getting?
Have you seen and tried this?
http://forum.xda-developers.com/showthread.php?t=3242572