yashsingh1/xdaforums huggingface dataset:
[Galaxy Tab Q&A, Help & Troubleshooting] ebod:
I wish I knew whether I did have a magisk_patched.img or not. Understanding where to find it would be a good start.

Totally lost when you then say boot.emmc.win ... too next level already :-/
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
you just need a copy of your boot partition, the file name doesn't matter. call it boot.img, magisk_patched.img or boot.emmc.win it's the same file.
[Galaxy Tab Q&A, Help & Troubleshooting] ebod:
ok I'm in TWRP now looking in backup menu and can see tickbox for 64mb Boot. When I select storage I can pick the microSD card...but there is no further option to place in a specific folder. Should I just swipe??? concerned my SD card will get formatted or something like that..
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
the backup directory is automatically created. it won't erase MicroSD card, but if you're worried you can also use internal storage.
[Galaxy Tab Q&A, Help & Troubleshooting] ebod:
ok on my PC I've plugged in the device and have two windows open. One with AIK unpackim.bat & one with the device folder showing boot.emmc.win. So what do you mean here by drag & drop??
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
copy boot.emmc.win file to PC, best is inside AIK directory. then execute unpackimg.bat (it works also if you drag & drop the boot image onto the unpackimg.bat file)

after unpacking, find the overlay.d directory in ramdisk directory. in this directory create new file with Notepad++ (see 3. in post #207)

make sure you use the correct line endings (see here). save the file, name the file as you like but without whitespaces. file suffix is .rc
[Galaxy Tab Q&A, Help & Troubleshooting] ebod:
This occurs , note both files in same DIR :

Also tried to drag boot.emmc.win on to of the unpackimg.bat file and no difference, same result
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
hm.. okay sorry, then rename it boot.img and try again. seems AIK is nitpicky with file suffix.
[Galaxy Tab Q&A, Help & Troubleshooting] ebod:
OK I've installed this Notepad++ on my PC and copied in that script and clicked the button about line endings:

How do I save as an 'rc' file?
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
CRLF is the wrong line ending, you need to change into LF first. then save the file like in any other editor, from the "File" menu "Save as..."

Spoiler content hidden.
[Galaxy Tab Q&A, Help & Troubleshooting] ebod:
OK I've now got to a "custom.rc" file that looks like this with 'LF' line end :-

the steps beyond are still a bigger mystery though.., i.e. whatever step #4 is
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
copy the .rc file into overlay.d directory then execute repackimg.bat to repack the image.

flash image-new.img into phones boot partition, that's it.
[Galaxy Tab Q&A, Help & Troubleshooting] ebod:
OK now back into TWRP on the device after copying image-new.img into the TWRP backup folder.

When I opt to 'restore' and select storage, again I don't get the choice to select anything other than the predetermined backup file I created an hour ago.

Should'nt I have to rename it?

Eg do I rename it back to "boot.emmc.win" and replace the one in the backup folder?
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
yes rename it boot.emmc.win and create new directory in the same directory level of the other backup directory. name doesn't matter, need not be a date string. there you can place the file on phone and restore that fake backup from TWRP menu.
[Galaxy Tab Q&A, Help & Troubleshooting] ebod:
The genuine backup had a heap of other folders. Do I make a verbitim copy of that folder and just name it 'Fred' and then replace the boot.emmc.win with the 'what was image-new.img . now boot.emmc.win' modded file.
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
No, you don't need to copy other files. only one single file inside:

TWRP/BACKUPS/SM-T290/Fred/boot.emmc.win
[Galaxy Tab Q&A, Help & Troubleshooting] ebod:
Many thanks for the support @alecxs , It now works!!

.;;Don't supposed you can school me into a few more solutions on my SM-T295 that I'm using to repurpose into a piggyback head unit for Volvo C70.

I've now achieved auto-start on power, and ( via Tasker ) achieved auto-shutdown on removal of charge power.

i) I just wanted to find/create some Volvo animation/image logo to replace the Samsung stuff , which I believe is all about 'qmg' files.

ii) And finally to speed up boot...I want to drop the super annoying Samsung bootloader unlocked warning, I think relates to accessing some kind of param.bin file ?

If you can steer me on these I'd be a happy bunny :-)
[Galaxy Tab Q&A, Help & Troubleshooting] Loc_Nguyen:
Hi @alecxs ,

I tried above your instruction for my samsung J250F. but it did not work. Could you help me? I just did following step. not sure what I missed or did something wrong?

1. Back up in TWRP and copied boot.emmc.win to Android Image Kitchen directory

2. unpack and create custom.rc

I

3. repacked, copied new file then change file name and copy to SD card as below

4. then I restored from that file in TWRP.

But it did not work.

I observed and saw init.rc looks like below. I did not modify it yet.

and I cannot mount System folder in TWRP

And this is my Magisk version

I have been researching for a month. But cannot do it for far. Much appreciated if you can help? thank you.
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
overlay.d maybe not working in this phone and/or Magisk version? can you find custom.rc in init?

if device is not (SAR) system-as-root, you can modify init.rc in boot directly.
[Galaxy Tab Q&A, Help & Troubleshooting] Loc_Nguyen:
Hi @alecxs

in ramdisk folder, I did not see any folder named "init", just found init file. But did not see any where mention custom.rc in init file's content. or I found wrong directory/files?

In case of modifying directly in init.rc, do you think I can remove codes from line 1411 to 1426 as below image?

I asked because I adjusted the init.rc as below. but it still not work.

on charger
mount ext4 /dev/block/bootdevice/by-name/system /system wait ro
wait /dev/block/bootdevice/by-name/efs
mount ext4 /dev/block/bootdevice/by-name/efs /efs nosuid nodev noatime noauto_da_alloc,discard,journal_async_commit,errors=panic
mkdir /efs/Battery 0775 radio system
chmod 0664 /sys/class/power_supply/battery/battery_cycle
chown system radio /sys/class/power_supply/battery/battery_cycle
chmod 0664 /sys/class/power_supply/battery/batt_after_manufactured
chown system radio /sys/class/power_supply/battery/batt_after_manufactured
chown system radio /sys/class/power_supply/battery/cisd_fullcaprep_max
chmod 0660 /sys/class/power_supply/battery/cisd_fullcaprep_max
chown system radio /sys/class/power_supply/battery/cisd_data
chmod 0660 /sys/class/power_supply/battery/cisd_data
chown system system /efs/FactoryApp/cisd_data
chmod 0640 /efs/FactoryApp/cisd_data
chown system radio /sys/class/power_supply/battery/cisd_data_json
chmod 0660 /sys/class/power_supply/battery/cisd_data_json
....exec u:r:magisk:s0 -- /system/bin/reboot

#class_start charger
....trigger late-init
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
try this in custom.rc

on charger
mount ext4 /dev/block/bootdevice/by-name/system /system wait ro
exec u:r:magisk:s0 -- /system/bin/reboot
[Galaxy Tab Q&A, Help & Troubleshooting] Loc_Nguyen:
Hi @alecxs it did not work. After we restore the boot.emmc.win, do you know where the custom.rc file is? where can I check it on my device?
[Galaxy Tab Q&A, Help & Troubleshooting] Loc_Nguyen:
Hi @alecxs

I found the answer for myself. As I read spec of magisk, basically, content of custom.rc will be injected in init.rc after flash. and I checked in init.rc from my device, content was injected, line 5. but it cannot work. do you have any further advices for me?
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
check the line endings in custom.rc must be changed to LF it doesn't look right on your last picture (refer to post #229)
[Galaxy Tab Q&A, Help & Troubleshooting] Loc_Nguyen:
Hi @alecxs Thank you for your support. I'll check. I'm trying with other ways. Much appreciated! you guys here are the best.
[Galaxy Tab Q&A, Help & Troubleshooting] jonas.ska:
I've tried the solutions posted there on mediatek Hotwav H1 device, but none worked. I unlocked the bootloader, rooted the phone, got original stock firmware to play with, but flashing boot.img with fastboot does not make any changes, I still see the same unchanged "on charger" part in init.rc when I look at flashed device's system. No lpm, playpm, custom.rc or any other file can be found on unpacked image except init.rc and init.recovery.mt6580.rc, and these files do not even have "on charger" section.

Tyring "fastboot oem off-mode-charge 0" gives some kind of unsupported error.

I'm quite lost at this point and I owuld even pay someone to explain how to make correct changes to boot.img that would work.
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
with root permissions you could edit the para partition directly.

sed -i '0,/off-mode-charge=1/s/off-mode-charge=1/off-mode-charge=0/' $(find /dev/block -name by-name)/para
[Galaxy Tab Q&A, Help & Troubleshooting] jonas.ska:
Thank you, but partitions are read-only, I cannot mount them in r/w mode.
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
para partition is not mountable, you must not mount it
[Galaxy Tab Q&A, Help & Troubleshooting] jonas.ska:
I tried but, but got the error

find: /dev/block/vold: Permission denied

sed: no temp file
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
then you don't have para partition. you can double check

ls -d $(find /dev/block -name by-name)/*
[Galaxy Tab Q&A, Help & Troubleshooting] jonas.ska:
The output is:

/dev/block/by-name /dev/block/platform/bootdevice/by-name/preloader_a
/dev/block/platform/bootdevice/by-name/boot_a /dev/block/platform/bootdevice/by-name/preloader_b
/dev/block/platform/bootdevice/by-name/boot_b /dev/block/platform/bootdevice/by-name/proinfo
/dev/block/platform/bootdevice/by-name/dtbo_a /dev/block/platform/bootdevice/by-name/protect1
/dev/block/platform/bootdevice/by-name/dtbo_b /dev/block/platform/bootdevice/by-name/protect2
/dev/block/platform/bootdevice/by-name/expdb /dev/block/platform/bootdevice/by-name/seccfg
/dev/block/platform/bootdevice/by-name/flashinfo /dev/block/platform/bootdevice/by-name/secro
/dev/block/platform/bootdevice/by-name/frp /dev/block/platform/bootdevice/by-name/super
/dev/block/platform/bootdevice/by-name/keystore /dev/block/platform/bootdevice/by-name/tee_a
/dev/block/platform/bootdevice/by-name/lk_a /dev/block/platform/bootdevice/by-name/tee_b
/dev/block/platform/bootdevice/by-name/lk_b /dev/block/platform/bootdevice/by-name/userdata
/dev/block/platform/bootdevice/by-name/logo /dev/block/platform/bootdevice/by-name/vbmeta_a
/dev/block/platform/bootdevice/by-name/md_udc /dev/block/platform/bootdevice/by-name/vbmeta_b
/dev/block/platform/bootdevice/by-name/metadata /dev/block/platform/bootdevice/by-name/vbmeta_system_a
/dev/block/platform/bootdevice/by-name/nvdata /dev/block/platform/bootdevice/by-name/vbmeta_system_b
/dev/block/platform/bootdevice/by-name/nvram /dev/block/platform/bootdevice/by-name/vbmeta_vendor_a
/dev/block/platform/bootdevice/by-name/oemkeystore /dev/block/platform/bootdevice/by-name/vbmeta_vendor_b
/dev/block/platform/bootdevice/by-name/otp /dev/block/platform/bootdevice/by-name/vendor_boot_a
/dev/block/platform/bootdevice/by-name/para /dev/block/platform/bootdevice/by-name/vendor_boot_b
/dev/block/platform/bootdevice/by-name/persist
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
then it went probably successful. however you can run it again

sed -i '0,/off-mode-charge=1/s/off-mode-charge=1/off-mode-charge=0/' /dev/block/platform/bootdevice/by-name/para
[Galaxy Tab Q&A, Help & Troubleshooting] jonas.ska:
This time I got

sed: /dev/block/platform/bootdevice/by-name/para: Permission denied
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
you need to execute it in root shell (type su)
[Galaxy Tab Q&A, Help & Troubleshooting] jonas.ska:
Oh yes, that's another problem. It returns "Permission denied"

EDIT: ah, I managed to grant the permissions to adb shell. THe command completed without an error. However, it had no effect to phone's plugged in behaviour.
[Galaxy Tab Q&A, Help & Troubleshooting] spagy1:
Hi All

Just new to this just like to know what programs where use to see and edit the lpm file on my SM-T350 really not sure what program to edit the flie and read write and permission to auto boot in usb plug in and if anyone has the file already made

Thanks Mario
[Galaxy Tab Q&A, Help & Troubleshooting] Jabjunior:
thanks a lot. i dd that on my SGH-I747 and GT-8552. works fine :)
[Galaxy Tab Q&A, Help & Troubleshooting] Easytiger24:
is this still possible with the Samsung tab 8 SM-x200 i have tried searching on this thread but nothing comes up :-(
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
Is your device rooted?
[Galaxy Tab Q&A, Help & Troubleshooting] Easytiger24:
yes mate
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
then choose any of the methods, all should work
[Galaxy Tab Q&A, Help & Troubleshooting] Easytiger24:
which one would you recommend?
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
I recommend the method of @chemicstry
[Galaxy Tab Q&A, Help & Troubleshooting] Easytiger24:
just been reading through the whole post, you really was helpful about post 207 do you know if this method will work on the SM-X200, I would like to get the correct method to work with this tablet

Kind Regards,

ET
[Galaxy Tab Q&A, Help & Troubleshooting] Easytiger24:
oh this is post 207 lol, i just have one issue my notepad ++ add CRLF ?
[Galaxy Tab Q&A, Help & Troubleshooting] Easytiger24:
managed to sort it cheers, The only thing I couldn't work out is why it wouldn't restore with TWRP it kept saying failed under restored :-( I did however manage to restore it with fastboot and it is working great cheers, i will have 10 to do is there a way i can take a back up of my stock rom with all the apps installed and restore this or is it best to just do each separately, sorry if its not in the right post
[Galaxy Tab Q&A, Help & Troubleshooting] evitado2:
for anyone with tab acitve 2, this was the steps i used.
[Galaxy Tab Q&A, Help & Troubleshooting] ahhl:
hi,

i am reporting here again

successful power-on boot using the same method on REDMI 8A MIUI 12.5.2 Global Rom.
[Galaxy Tab Q&A, Help & Troubleshooting] itchydroid:
Here is what worked for me:

Device: Samsung Galaxy S5 (klte)

ROM: MicroG Lineage OS 18.1 (Android 11) - main firmware was updated to the absolute latest stock prior to this.

Root: Magisk 26.3

Since its a Samsung device, modifying using fastboot is not possible (no fastboot).

I noticed a lot of threads mentioning modifying /system/bin/lpm or /system/bin/playlpm for Samsung devices. My system had neither of those files. I then checked on my Samsung Galaxy Tab S2 and saw those files are not present there either. Did a linux 'find /' search for playlpm and lpm and didnt find either. I tried manually creating those files and assign the right priviledges and credentials but no luck - non of them got executed by the bootloader when plugged in. So maybe they have been deprecated?

Then I tried adding a new rc file in the /system/init/off_charger_mode.rc route and set the right credentials and priviledges and that still did not work for me.

Finally I got around to updating the 'on charger' section of the init.rc file directly as mentioned in post #207 and that did the trick for me. Although this init.rc file was located under /system/etc/init/hw/init.rc. I guess the file will need to be manually update anytime I do a rom update.
[Galaxy Tab Q&A, Help & Troubleshooting] tparaizo:
The simple task I've been trying for weeks is for the device to turn on when the charger is connected. I found a few ways to do this, but all without success:

1 - change via fastboot (fastboot oem-off-mode charge 0) but I can't execute the command, maybe because Samsung removed this.

2 - change system files, such as init.rc, however, the initialization files are read-only, and it seems to me that this is due to Magisk.

3 - changing the files inside boot.img, and then repackaging and making the path through Odin. I was able to unpack boot.img with "magiskboot unpack boot.img", which generates some files. But when extracting the contents of "ramdisk.cpio" ("cpio -igm > ramdisk.cpio" or "cpio -i -F ramdisk.cpio"), the generated files are blank, and so are the directories.

This way I don't have the files needed to change. I tried this with Windows and Linux, but all with the same result.

4 - I tried with some applications, such as Tasker, but no settings or events can turn on the device.

I have my G780G/DS with TWRP (orange fox), rooted with Magisk, I've already tested another TWRP, but none of them let me change the files.

I've read almost all the posts, but I can't find the solution.

Does anyone have any tips for me? Can anyone give me a solution or alternative? "Power on the device when connecting the charger" :(

Tanks
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
try 3 - with AIK by osm0sis (scroll down to bottom and extract the zip file)
[Galaxy Tab Q&A, Help & Troubleshooting] josef.priskin:
Samsung Galaxy A40

ROOTED (TWRP/Magisk)

Android 11, One UI 3.1

lpm, playlpm doesn´t exist.

Simply works with changing init.container.rc in phone root folder. Added on file start:

Of course need mount root folder readwrite.

and after fixing root folder back to readonly
[Galaxy Tab Q&A, Help & Troubleshooting] zpunout:
I'm attempting to set boot when charge cable is connected on a

Galaxy Tab S6 Lite

official LineageOS 20 (231230 update)

No Lygisk/Magisk installed

I'm attempting via root debugging as LineageOS supports this.

After reading through this forum thread, particularly post 269, and post 207 I saw how boot-when-charger-connected could be achieved with Magisk installed. But I'm attempting to achieve this with just root debugging.

I've been experimenting with /system/etc/init/hw/init.rc

on line number 1191 (which is about 90% down the page) I tried to modify

on charger
class_start charger

to

on charger
exec system/bin/reboot

which doesn't work and the device hangs on a blank screen.

The provided code in post 207 for Magisk installed devices is:

on charger
exec u:r:magisk:s0 -- /system/bin/reboot

What I'm interested in is the part "u:r:magisk:s0". I can see this is showing that it is to do with Magisk.

I did some reading about the exec command for Linux in several places such as here to try and understand the command arguments.

I experimented with the exec command a bit more without success but I won't document that here.

Another angle I tried was:

on charger
trigger late-init

I came up with this when reading through init.rc and found at line 506: (about 33% down the page)

# Healthd can trigger a full boot from charger mode by signaling this
# property when the power button is held.
on property:sys.boot_from_charger_mode=1
class_stop charger
trigger late-init

After seeing this, I tried to apply the code to on charger.

It will boot and get stuck on the LineageOS boot animation.

Of note is the Samsung up_param splash screen doesn't display when booting this way and adb devices returns no devices attached while the boot animation is forever animating.

Despite not succeeding yet, this has already been a learning experience for me.

In summary, the questions I have are:

1. How to boot when a charger is connected to a Samsung LineageOS device by using root-debugging?

2. The exec command: What does the argument u:r:magisk:s0 mean when doing this the Magisk way?
[Galaxy Tab Q&A, Help & Troubleshooting] winson2769:
exec u:r:magisk:s0 how do you do that can make a tutorial ?
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
the issue is with selinux. only init can execute init processes. that's how magisk comes in game, it injects it's own sepolicy so we can run anything under the u:r:magisk:s0 secontext.
[Galaxy Tab Q&A, Help & Troubleshooting] zpunout:
Thanks. So not using Magisk/Lygisk would be a clumsy exercise as I'd have to manually create selinux policies, right? I'm curious to learn how to create selinux policies that way, but will use Lygisk for now.
[Galaxy Tab Q&A, Help & Troubleshooting] alecxs:
Maybe this will give you an idea (untested)

How to manually root a phone?

I want to learn how to root a android phone manually, I mean without any apps like KingRoot, dr.fone etc. I did not found any guides or information about it. (Background Information: I want to roo...

android.stackexchange.com
[Galaxy Tab Q&A, Help & Troubleshooting] winson2769:
anyone know how to do this ? exec u:r:magisk:s0 ? any tutorial ?
[Galaxy Tab Q&A, Help & Troubleshooting] chrispereira:
Samsung Galaxy S9 (SM-G9650F)

ROOTED (TWRP/Magisk)

Android 10, One UI 2.5

What's the recommended way to have this device boot up on power connected?

Background

I use this device permanently connected to a car head unit that only supports wired Android Auto, with the device itself locked in the glovebox.

With Tasker set up to put the device into an extreme power saving mode, the (aging) battery lasts up to 48 hours, without receiving power.

If the car is not started for longer than that, the device shuts down, and the next time I start the car, I would need to unlock the glovebox, and manually restart the device.

I would like to set up the device such that it will boot up reliably once it receives power.

For this I gather that it would be best to delay the boot for a few seconds (is 15 seconds enough?) so that the device receives some minimum amount of charge so that the power hungry boot process does not force a shut down.

I gather that I will have to insert the following script snippet into an init.rc related script somewhere.

on charger
sleep 15
exec u:r:magisk:s0 -- /system/bin/reboot

And I understand that there are a few options to consider for this:

1. Modify /system/etc/init/bootchecker.rc , add the snippet the end of the file. (WIll need to remount /system rw to make the change, then remount /system ro again.)

2. Add a new .rc file under /system/etc/init containing the snippet of code. Match the permissions and ownership of the new file with the others in the directory

3. Modify the boot.img as per #207

4. Other options? Is there a (root required) app out there that can enable boot on power without all the fuss?

I considered the option of backing up /system/bin/lpm and replacing it with a shell script with the above snippet, but I noticed that /system/bin/lpm is a binary file on my device, and I'm not sure what else it does besides displaying the "charging" animation, so I'm not comfortable replacing it with a custom script that just triggers a reboot.

All advice appreciated! Thanks in advance!
[Galaxy Tab Q&A, Help & Troubleshooting] annlee:
This app "auto boot" do all the job: play.google.com/store/apps/details?id=auto.boot&hl=en :cool:

tested in Galaxy young but should work on every rooted Samsung devices
[Galaxy Tab Q&A, Help & Troubleshooting] JackalOne85:
Still not working

I've a Samsung I9195 (S4 Mini)

Changing playlpm simply does not work for me

I've tried all the ways:

-

#!/system/bin/sh/system/bin/reboot

-

#!/system/bin/sh
/system/bin/reboot

-

#!/system/bin/sh
sleep 20
/system/bin/reboot

-

#!/system/bin/sh
su
/system/bin/reboot

I've also chek all permissions

Now I'm stuck in a loop. I see the charger icon and then reboot, always. also if i remove the USB cable.

Until now i didn't find any way to get it work.

Any help?:crying:
[Galaxy Tab Q&A, Help & Troubleshooting] psp_andy:
For people that are having trouble, try this:
[Galaxy Tab Q&A, Help & Troubleshooting] ajparag:
Should I delete everything in the existing playplm file and keep only these lines or do I need to insert these lines somewhere in between??? Please revert.
[Galaxy Tab Q&A, Help & Troubleshooting] ajparag:
Plz help guys!

Also, i tried searching the contents of playlpm in other phones but no file in system/bin folder has similar content. There is one file called onandroid that has similar content but it is not a system file.

Has anybody cracked this feature on phones other than samsung?