Hi all . I would be grateful for advice.
I installed Magisk and I want to create a script, but
adb root && adb remount command doesn’t work…
Hi all . I would be grateful for advice.
Hey, if i’m not mistaken adb root is not implemented with magisk.
adb shell su # A promt from magisk should open on your phone asking for permission # After that your shell should have root privilege (probably indicated by a # in the prompt mount -o rw,remount /system
Are you running a dev build of /e/OS and if so is ‘Rooted debugging’ enabled?
If in a script, for example, I write
Then I get the answer:
ADB Root access is disable by system setting - enable in Setting -> System -> Developer options error: closed
But there is no root setting in Developer options.
Firmware version stable non dev
The dev builds have Rooted Debugging, the stable builds do not.
Since you are on stable you cannot do
adb root stuff.
So do as @zehka mentioned.
Hello . Thanks for the reply and information regarding the ROM difference.
I did what @zehka wrote, it doesn’t work for me. I will write my steps, please tell me where I made a mistake:
- Installed Magisk -25.2
2.Created test.sh script
3.Content of the script:
#!/bin/bash adb shell su mount -o rw,remount /system
Make the script executable
$ chmod +x test.sh
I run the script
$ sudo ./test.sh
Does magisk require an adb module ? Is this relevant ? https://forum.xda-developers.com/t/terminal-emulator-and-magisk.4118293/
From where are you runnimg this script? I assume in a terminal like Termux? If so…
First, most ROMs do not include the adb command. Not since Marshmallow (Android 6) or even earlier. I always flashed adb (includes fastboot) or install via Magisk, along with Busybox, on every new ROM setup.
[ Reason for adb is that I can connect two devices and do adb/fastboot stuff in lieu of a PC ]
Second, since you are rooted now the script does not need the
adb shell line. You are already at a shell, so to speak (the terminal).
su will drop you into a root shell and then you can run your commands.
A quick test shows you cannot have
su in the script. I got the same results as you. Nothing.
su will drop you into a shell and that is all. When you exit the shell the rest of the script will continue but not as root.
For me that means the
mount command will fail because it is not available outside of a root shell.
So when running the script…
suline drops me into root shell. Rest of script is not run.
exitthe root shell.
- Script continues to run and mount command fails.
./testme.sh: 3: mount: not found
What you could probably do is open a root shell and then create a script with only the mount command.
So at any time it would be…
su (to get root shell)
./mntsys.sh (assuming it’s executable) or
Not really sure about all this but that’s how it works in my testing.
Not really sure of the environment you are working in though.
EDIT: But there is a but. If you have Termux and the sudo command you can probably get what you want. The script would be
sudo mount -o rw,remount /system
which would drop to root, execute the command, and exit the root shell without user interaction.
Test shows it worked as I got the following error indicating that the mount command was executed…
mount: '/system' not in /proc/mounts
Hello . Thank you very much for your reply. After reading your answer, I see that you understand why I succeeded, so I decided to write my question on the forum.
Sorry, I forgot to specify the environment. My environment is PC+ /e/ . This is not Recovery or termux on the phone. I connect the phone to the PC and run the script through the terminal.
Did I understand you correctly that now there is only one solution - to run the script manually in two stages? That is, I first enter:
adb shell su
And then in manual mode I execute the commands I need?
Or is there another solution?
Since I did not know your environment I was making assumptions. Sorry.
I have no solutions or ideas about scripting in an adb setup.
In any case, thank you very much for helping to solve this problem.
Hello . Thanks for the answer. No, I didn’t install any modules.