[Q] Execute line on boot (as su) - Samsung Galaxy Player 4.0, 5.0

Hi,
I need to execute a script (better said a command line with su permission) on boot.
It's a bind -o command to relink google music cache dictionary, I used to use SManager, but I don't like it, since SManager sometimes starts working after Music is caching the files and is inconsistent. Is there a way to make this part of boot.
I'm on the new Pac-Rom 4.3.

Related

[Q] Removed T-Mobile Boot and Shutdown Animations - Now ADB cannot run as root

Hello everyone,
I have a T-Mobile L9 Optimus and I have rooted it according to this guide, it was very helpful
http://forum.xda-developers.com/showthread.php?t=2173465
After removing a bunch of bloatware, I also wanted to remove T-Mobile's Boot and Shutdown animations, which on this phone are located in system/media -> bootanimation.zip and shutdownanimation.zip
I used ADB to pull both files into Windows as a backup
Then, I used ADB to open a shell as su:
adb shell
su
Then I realized I couldn't use the rm command for those zip files because the /system folder is mounted as read-only by default. To change that I used the following commands:
mount -o rw,remount /system
then I used the rm command to remove the two zip files
then I used
mount -o ro,remount /system
to have the folder back in its default read-only state
Then I restarted my phone and voila - no shut-down animation and only a default LG and Android animation on startup
Then I re-started Command prompt to get back to ADB (I still don't know how to exit shell and get back to ADB, help on that?) and here's the problem - I can no longer access root permission in ADB.
When I type in adb root, I get "adbd cannot run as root in production builds"
When I type in adb remount, I get remount failed: Operation not permitted
If I open a shell, I can still enter su, but after the procedures above, ADB thinks that my phone is a production build and I would like to know why, and how I can fix it without returning the original bootanimation.zip and shutdownanimation.zip files.
Is there a background process on T-Mobile phones that goes through a default checklist of system files, then determines that a phone must be a production build if some of those files aren't there? Is there a way to modify that process if it exists? I would rather do that than have to put in a "dummy" bootanimation.zip and shutdownanimation.zip
Lastly, if I were to return those original files through shell, would everything return to normal regarding ADB?
So adb shell and su doesn't work for you now ?
Edit:
I missed a part of your post,
That is a normal behaviour. I don't thing you could adb root before removing animations.
Edit:
If you want to run something from command prompt you have to:
adb shell su -c command_goes_here

start script at boot

hi,
i'm using stock-rom 4.1.2 (root) on my xtz wifi 16gb. i can mount samba shares running 2 script in terminal emulator
Code:
su
sh cifs.sh
sh mount.sh
cifs.sh starts cifs.ko and mount.sh mounts the samba share. su sh cifs.sh or ./cifs.sh don't work.
now i want to mount the share after boot the xtz. on linux i can use init.d, but on android init.d is read-only. there is no autostart.sh. in play store there are some app who starts autostart.sh (i.e. this https://play.google.com/store/apps/details?id=nk.bla.android.autostart&hl=de; i had to create the folder opt in /data and then create autostart.sh in /opt). bit it seems the scripts isn't loaded after bot the device.
is there an other solution for autostart the scripts on xtz?
piere
Download ROM Toolbox (Pro or Lite), go to Scripts, choose Import Script, look for your script. After added, press and hold over your script, and choose Set At Boot, or smth like that.
That Should do
thx, works.

Debugging boot process

Hi, I'd like to ask a general question (I suppose) about device boot process. I've made some changes in init.rc and I packed again boot.img. Then I flashed it. So, phone shows logo screen. I've changed boot.img again to enable adb by making changes to default.prop.
So, I've packed boot.img and flashed it again. So, phone shows logo screen and I can use adb during boot process, but I don't know how to use adb to get info about android failed boot (adb has not root permissions, though).
What methods could I follow in these cases? Any ideas?
P.S.
My changes at boot.img: I've moved /system, /usrdata and /cache mount commands into an .sh script in ramdisk root directory.
P.P.S.
I've tried also adb pull last_kmsg and I don't see error messages in the little log (~87 kb). When I look at last_kmsg, I see some lines about phone charging (connected to pc), so I think these messages could be related at the moment which phone is connected to pc but turned off (I'm not sure, though) because last_kmsg is related to previous boot process (charging mode with phone turned off?) and the current one (I think). I'd like to read kmsg and not last_kmsg, however, but kmsg can be read only by root (and my current adb has not root permissions, as I said before).
P.P.P.S.
During the boot process, I can pull directories and files from ramdisk root directory (related to boot partition) into my pc by using adb pull command. I've found that 'dev', 'proc' and 'sys' are very well populated of files and sub-directories. Instead, 'data' and 'system' directories are sadly empty. So, I suppose /usrdata and /system related partitions are not mounted at that moment and such thing prevents to load android system.
Solved
I've found a way to get dmesg without using adb shell. It's possible to use busybox dmesg command inside a shell script (placing busybox binary and shell script into ramdisk root directory of boot.img) and run the script by busybox ash command from init.rc, redirecting the output to a logfile. The command inside shell script should look like as the following:
Code:
/busybox dmesg >> /path/to/my/logfile.txt 2>&1
(That way, stderr and stdout will be redirected to a log file, that can be pulled down by adb pull command)

How remove the Blotwares in terminal STEP by STEP

With the intention of helping all those who have difficulties in removing blotwares even with programs like TITANIUM and others..
Here is a small step by step that I did to remove the blotwares..
STEP - 1
You install the app available in the playstore, called System app remover Https://play.google.com/store/apps/d...emapp&hl=en_US
1.1)
You need to install the app available in the playstore, called Termux Https://play.google.com/store/apps/d...ermux&hl=en_US
1.2)
grants root access to the 2 apps.
STEP - 2
Perform apk removal With the Termux application open,
you enter as root
-> su (enter as root)
You should now allow to modify the directory system
-> mount -o remount, rw -t rfs /dev/stl5 /system
Now you need to get into the "System app remover" application and pick up the APP directory you want to remove.
-> rm -r [DIRECTORY]
Now you need to return the directory system to read only, 'ro', to prevent malicious activities
-> mount -o remount, ro -t rfs /dev/stl5 /system
Restart your phone and you can see that the app is no longer on your device.
NOTE: If you can not go back to read only, after the system reboot you will be able to.
My mobile got much faster and with no crashes after deleting these apps ...
I had difficulty removing blotwares from a rom I downloaded that is available on this link for ZUK Z2 PRO
https://forum.xda-developers.com/zuk-z2-pro/development/miui-8-version-zuk-z2-pro-t3563578
ALERT: As all androis have the same command system, should work for any device, but be careful not to remove applications essential for system operation. It can cause an infinite loop in system reboot.

Su/su.d/script.

Hi guys. Does any of you know how to push su.d directory into su folder? I mean I need radio.sh script in su/su.d to get root call sms manager working. Every time I try it disappears after reboot.
Rooted rom 34.3.A.0.217 with TWRP.
Anyone?
It's late though, but for the guidance of other noobs like me. /su/su.d/ can't be flashed in recovery because this isn't available. For system-less roots, binaries/libraries required to start supersu daemon and to manage root permissions, don't reside in /system/bin but in /data/su.img while (at least) two files reside in boot.img i.e. boot.img/ramdisk/init.supersu.rc and boot.img/ramdisk/sbin/.*daemonsu*.sh. When ROM boots, init.supersu.rc mounts /data/su.img on /su directory and calls /sbin/*daemonsu*.sh for initial setup which starts /su/bin/daemonsu and other se-linux related stuff and then executes any scripts found in /su/su.d/ and /system/su.d.
You can find this:
Code:
mido:/ # mount | grep loop
/dev/block/loop0 on /su type ext4 (rw,seclabel,noatime,data=ordered)
So, the init.d scripts placed in /su/su.d actually reside in /data/su.img which isn't mounted in recovery mode and anything flashed to /su/su.d goes to volatile rootfs which is gone on reboot. Either mount su.img in recovery, or place this script while ROM is running or instead flash to /system/su.d which is permanent filesystem unlike rootfs (which lives in RAM). And finally don't forget to set permissions to 0700 as advised here. Another thing, mostly init.d scripts don't work with .sh extension. Avoid this too.

Categories

Resources