why to umount /proc/self/exe? - Magisk

from source: https://github.com/topjohnwu/Magisk/issues/6747#issue-1622993788
When studying and researching magisk source code, I saw the following code. I can't figure out why umount /proc/self/exe? ?
Magisk/native/jni/init/twostage.cpp
Line 67 in 6066b5c
umount2("/proc/self/exe", MNT_DETACH);
Test machine: Google Pixel1 (sailfish)
Magisk Version: v25.2 - 6066b5c(25200) (D)
I tried to change umount2 to xumount2, and got the following error message: umount2 /proc/self/exe failed with 22: Invalid argument
I checked the context and found that this is the second stage of the magiskinit executable.
At this point, system_root/init is called to /data/magiskinit through the exec series of functions
So /proc/self/exe is a symbolic link to /data/magiskinit; but /data/magiskinit is not a mount point for mount.
So here umount will fail.
from source: https://github.com/topjohnwu/Magisk/issues/6747#issue-1622993788
在学习和研究magisk源码时,看到如下代码。我有些想不明白为什么要 umount /proc/self/exe??
Magisk/native/jni/init/twostage.cpp
Line 67 in 6066b5c
umount2("/proc/self/exe", MNT_DETACH);
测试机:Google Pixel1(sailfish)
Magisk版本:v25.2 - 6066b5c(25200) (D)
我尝试将 umount2 修改为 xumount2, 获取到如下错误信息:umount2 /proc/self/exe failed with 22: Invalid argument
我查看上下文后,发现这里是属于 magiskinit 可执行程序的二阶段。
此时由 system_root/init 通过 exec系列函数调用到 /data/magiskinit
因此 /proc/self/exe 是符号链接到 /data/magiskinit;但是 /data/magiskinit 不是一个mount的挂载点。
因此这里 umount 是会失败的。

Related

[SOLVED] install-recovery.sh - The undeletable script from the dark side...

Greeting all,
First of, I would like to thanks all of you for the amount of info I have found in this forum.
This is trully amazing and, so far, allowed me to sucessfully:
- Unlock my phone
- Root my phone
- Install a custom recovery image
I know that I am creating a new post on a very known and discussed subject BUT after 2 days of google seach nothing I have tried has permitted me to sucessfuly delete this £$%^&*() of script.
As you all know, it needs to be deleted to launch the custome recovery image (at the moment, I am stucked with the exclamation mark with the little Droid when I try).
IMPORTANT: I currently run the Froyo android 2.2 official ROM.
To delete this scipt, I have tried 2 approaches:
- Console mode from windows using ADB
- directly form the phone using a File explorer
#1: From the console:
As mentionned in many previous posts, I have tried the following commands once connected to the nexus
adb shell
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
I beleive this command is either incorrect OR no longer working with Froyo 2.2 as I get the following message which looks fishy (I am not a Linux specialist...):
Usage: mount [-r] [-w] [-o options] [-t type] device directory
When I try to delete the scripe with the commande below, I am kindly informed that it failed as it is still a read only file system
rm /system/etc/install-recovery.sh
#2: From the phone
I read that SUFBS, a very nice file explorer was available on the market allowing to mount both system AND data in RW would allow me to do it.
I have had several try at it enabling RW at different moment (System then etc then directly when I am in the folder and see the script I want to delete) and whatever I do, each time I select the command delete, it looks like it works (little pacman eating) but the script from the dark side is sill there like nothing happened...
As I am close to give it the microwave treatment to see if it works better ;-) I thought I give it a try on the forum to see if any Android/Linux god would spend 5 minutes to explain to me what I am doing wrong...
Thanks a lot in advance!
BooToo
Try this:
mount -o rw,remount /system
I can't guarantee that works with Froyo but it's all I've ever used and I don't remember it giving me any problem when I used Froyo.
Umm I think it should be mount -o remount,rw then type the rest
You can also try this mount -o remount,rw /dev/block/mtdblock3 /system
Sent from my Nexus One using XDA App
adb is supposed to have it's own remount command for doing this, but I've only used adb once when I rooted so I'm no help there.
Other than that, try doing: ls -l /system/xbin/mount to see if mount is a link to busybox. If it is, the last part of the output will look like this: /system/xbin/mount -> busybox
If it is, type busybox | head -n1 to see what version of busybox you have.
ilostchild said:
Umm I think it should be mount -o remount,rw then type the rest
Click to expand...
Click to collapse
Heh, I never realized I had those backwards compared to how people usually do it, but the order doesn't actually matter. It's not necessary to specify the device as the remount option doesn't change the mount point or device.
# mount | grep system
/dev/block/mtdblock3 on /system type yaffs2 (ro,relatime)
# mount -o rw,remount /system
# mount | grep system
/dev/block/mtdblock3 on /system type yaffs2 (rw,relatime)
Well...
I am an ass...
I did not have enabled the "USB debugging" on the phone...
Problem soved with the exact command lines I put at the beginning...
After rooting, flashing clockworkmod through ROM manager it was still going into stock recovery mode. Then I deleted /system/etc/install-recovery.sh and got my phone(HTC magic - 32A) bricked. Now it starts, shows rogers logo for 5-6 seconds and restarts and repeats untill i take out battery. I tried all combinations(power+back , power+home, Power+volume, Menu+home+power, menu+call+power) for quickboot and recovery mode but no success. Anyone has any idea about this issue?
If you have an HTC Magic, you're in the wrong forum...
Sent from my Nexus One using XDA App
just rename the script and you're done!
1) Bump 6 month old thread
2) Post in the completely wrong forum
3) Posts: 1 Join Date: Feb 2011
UGH.
error while loading new compiled Linux kernel image into the android emulator(1.5)
I am sorry, that i am asking my question in "reply" but i am not able to make a new post.
I have successfully compiled Linux kernel for android:
[email protected]:~/common# ARCH=arm CROSS_COMPILE=~/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- make
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
.
.
.
SYMLINK include/asm -> include/asm-arm
CALL scripts/checksyscalls.sh
<stdin>:1097:2: warning: #warning syscall fadvise64 not implemented
<stdin>:1265:2: warning: #warning syscall migrate_pages not implemented
<stdin>:1321:2: warning: #warning syscall pselect6 not implemented
<stdin>:1325:2: warning: #warning syscall ppoll not implemented
<stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented
CHK include/linux/compile.h
Kernel: arch/arm/boot/Image is ready
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 157 modules
[email protected]:~/common#
but i get the following error while loading this images in the emulator:
[email protected]:~/android-sdk-linux_x86/tools# ./emulator -avd avd1.5 -kernel ~/common/arch/arm/boot/zImage -show-kernel -verbose
emulator: found SDK root at /home/preetam/android-sdk-linux_x86
emulator: root virtual device file at /home/preetam/.android/avd/avd1.5.ini
.
.
.
yaffs_read_super: isCheckpointed 0
sh: can't access tty; job control turned off
# init: cannot find '/system/bin/playmp3', disabling 'bootsound'
init: cannot find '/system/bin/dbus-daemon', disabling 'dbus'
eth0: link up
init: untracked pid 578 exited
init: untracked pid 579 exited
warning: `rild' uses 32-bit capabilities (legacy support in use)
init: untracked pid 601 exited
init: untracked pid 592 exited
init: untracked pid 605 exited
init: untracked pid 602 exited
init: untracked pid 609 exited
init: untracked pid 606 exited
init: critical process 'servicemanager' exited 4 times in 4 minutes; rebooting into recovery mode
save exit: isCheckpointed 1
save exit: isCheckpointed 1
Restarting system with command 'recovery'.
Reboot failed -- System halted
and the emulator didn't start with the new kernel image(emulator didn't reboot). what is the problem here..?? and how can i replace my emulator's image with newly compiled Linux permanently??
please help. thank you!
I did everything as the guy who initiated this post under windows vista, and I have the same problem. However, I don't know how to go about deleting or renaming that scrip. Can you, give me a step by step procedure? Thank you
Flash this through recovery to delete the script...
http://db.tt/ooDaCnU
Hi,
I am sort of new to this. how do I flash using the above script?

Cant install Debain HELP~!!!!!HELP~!!!!!HELP~!!!!!HELP~!!!!!

Sorry about Hekp Caps. I am stuck and cant install Debian =\ Heres what happens:
Code:
# cd /sdcard/debian
cd /sdcard/debian
# sh ./installer.sh
sh ./installer.sh
# exit
exit
←[H←[Jmkdir failed for /data/local/mnt, File exists
←[H←[Jchmod: bootdeb: Operation not permitted
chmod: debian.img: Operation not permitted
chmod: fsrw: Operation not permitted
chmod: installer.sh: Operation not permitted
chmod: mountonly: Operation not permitted
chmod: unionfs: Operation not permitted
←[H←[J
Custom Debian Bootloader is now installed! Quick huh?
This process does NO damage to your Android underlying OS!
Courtesy of http://www.androidfanatic.com
Installer by Mark Walker (ghostwalker)
To enter the Debian Linux console just type 'bootdeb'
PS: Be sure to run /scripts/onetime.sh as root from the shell after your FIRST '
boot'.
# sh bootdeb
sh bootdeb
←[H←[JAndroid Filesytem remounted as read/write
insmod: can't read 'ext2': No such file or directory
mknod: /dev/loop2: File exists
←[H←[J
a888a
d888888b
8P YP Y88
8|o||o|88
8. .88
8 ._. Y8.
d/ 8b.
.dP . Y8b.
d8: ::88b.
d8 Y88b
:8P :888
8a. : _a88P
._/ Yaa_ : .| 88P|
\ YP | 8P \.
/ \._____.d| .|
--..__)888888P ._.|
mount: can't setup loop device: No such file or directory
mount: mounting devpts on /data/local/mnt/dev/pts failed: No such file or direct
ory
mount: mounting proc on /data/local/mnt/proc failed: No such file or directory
mount: mounting sysfs on /data/local/mnt/sys failed: No such file or directory
Custom Linux Pseudo Bootstrapper V1.0 - by Mark Walker
WEB: http://www.androidfanatic.com
EML: [email protected]
Starting init process
INIT: Debian booting.....
Running Linux Kernel
net.ipv4.ip_forward = 1
AutoMounter started
Type EXIT to end session
Make sure you do a proper EXIT for a clean kill of Debian!
chroot: can't execute '/bin/bash': No such file or directory
umount: can't forcibly umount /data/local/mnt/dev/pts: No such file or directory
umount: can't forcibly umount /data/local/mnt/proc: No such file or directory
umount: can't forcibly umount /data/local/mnt/sys: No such file or directory
umount: can't forcibly umount /data/local/mnt: Invalid argument
Filesystems have unmounted
losetup: /dev/block/loop2: No such device or address
Loopback device shutdown - success
Debian down
Coded by Mark Walker
http://www.androidfanatic.com
admin.androidfanatic.com
Reverted back to Android console
# sleep 1
sleep 1
# sleep 1
sleep 1
# bootdeb
bootdeb
←[H←[JAndroid Filesytem remounted as read/write
insmod: can't read 'ext2': No such file or directory
mknod: /dev/loop2: File exists
←[H←[J
a888a
d888888b
8P YP Y88
8|o||o|88
8. .88
8 ._. Y8.
d/ 8b.
.dP . Y8b.
d8: ::88b.
d8 Y88b
:8P :888
8a. : _a88P
._/ Yaa_ : .| 88P|
\ YP | 8P \.
/ \._____.d| .|
--..__)888888P ._.|
mount: can't setup loop device: No such file or directory
mount: mounting devpts on /data/local/mnt/dev/pts failed: No such file or direct
ory
mount: mounting proc on /data/local/mnt/proc failed: No such file or directory
mount: mounting sysfs on /data/local/mnt/sys failed: No such file or directory
Custom Linux Pseudo Bootstrapper V1.0 - by Mark Walker
WEB: http://www.androidfanatic.com
EML: [email protected]
Starting init process
INIT: Debian booting.....
Running Linux Kernel
net.ipv4.ip_forward = 1
AutoMounter started
Type EXIT to end session
Make sure you do a proper EXIT for a clean kill of Debian!
chroot: can't execute '/bin/bash': No such file or directory
umount: can't forcibly umount /data/local/mnt/dev/pts: No such file or directory
umount: can't forcibly umount /data/local/mnt/proc: No such file or directory
umount: can't forcibly umount /data/local/mnt/sys: No such file or directory
umount: can't forcibly umount /data/local/mnt: Invalid argument
Filesystems have unmounted
losetup: /dev/block/loop2: No such device or address
Loopback device shutdown - success
Debian down
Coded by Mark Walker
http://www.androidfanatic.com
admin.androidfanatic.com
Reverted back to Android console
Im on SuperBad Eclair...
SilentRazor said:
Sorry about Hekp Caps. I am stuck and cant install Debian =\ Heres what happens:
Code:
# cd /sdcard/debian
cd /sdcard/debian
# sh ./installer.sh
sh ./installer.sh
# exit
exit
←[H←[Jmkdir failed for /data/local/mnt, File exists
←[H←[Jchmod: bootdeb: Operation not permitted
chmod: debian.img: Operation not permitted
chmod: fsrw: Operation not permitted
chmod: installer.sh: Operation not permitted
chmod: mountonly: Operation not permitted
chmod: unionfs: Operation not permitted
←[H←[J
Custom Debian Bootloader is now installed! Quick huh?
This process does NO damage to your Android underlying OS!
Courtesy of http://www.androidfanatic.com
Installer by Mark Walker (ghostwalker)
To enter the Debian Linux console just type 'bootdeb'
PS: Be sure to run /scripts/onetime.sh as root from the shell after your FIRST '
boot'.
# sh bootdeb
sh bootdeb
←[H←[JAndroid Filesytem remounted as read/write
insmod: can't read 'ext2': No such file or directory
mknod: /dev/loop2: File exists
←[H←[J
a888a
d888888b
8P YP Y88
8|o||o|88
8. .88
8 ._. Y8.
d/ 8b.
.dP . Y8b.
d8: ::88b.
d8 Y88b
:8P :888
8a. : _a88P
._/ Yaa_ : .| 88P|
\ YP | 8P \.
/ \._____.d| .|
--..__)888888P ._.|
mount: can't setup loop device: No such file or directory
mount: mounting devpts on /data/local/mnt/dev/pts failed: No such file or direct
ory
mount: mounting proc on /data/local/mnt/proc failed: No such file or directory
mount: mounting sysfs on /data/local/mnt/sys failed: No such file or directory
Custom Linux Pseudo Bootstrapper V1.0 - by Mark Walker
WEB: http://www.androidfanatic.com
EML: [email protected]
Starting init process
INIT: Debian booting.....
Running Linux Kernel
net.ipv4.ip_forward = 1
AutoMounter started
Type EXIT to end session
Make sure you do a proper EXIT for a clean kill of Debian!
chroot: can't execute '/bin/bash': No such file or directory
umount: can't forcibly umount /data/local/mnt/dev/pts: No such file or directory
umount: can't forcibly umount /data/local/mnt/proc: No such file or directory
umount: can't forcibly umount /data/local/mnt/sys: No such file or directory
umount: can't forcibly umount /data/local/mnt: Invalid argument
Filesystems have unmounted
losetup: /dev/block/loop2: No such device or address
Loopback device shutdown - success
Debian down
Coded by Mark Walker
http://www.androidfanatic.com
admin.androidfanatic.com
Reverted back to Android console
# sleep 1
sleep 1
# sleep 1
sleep 1
# bootdeb
bootdeb
←[H←[JAndroid Filesytem remounted as read/write
insmod: can't read 'ext2': No such file or directory
mknod: /dev/loop2: File exists
←[H←[J
a888a
d888888b
8P YP Y88
8|o||o|88
8. .88
8 ._. Y8.
d/ 8b.
.dP . Y8b.
d8: ::88b.
d8 Y88b
:8P :888
8a. : _a88P
._/ Yaa_ : .| 88P|
\ YP | 8P \.
/ \._____.d| .|
--..__)888888P ._.|
mount: can't setup loop device: No such file or directory
mount: mounting devpts on /data/local/mnt/dev/pts failed: No such file or direct
ory
mount: mounting proc on /data/local/mnt/proc failed: No such file or directory
mount: mounting sysfs on /data/local/mnt/sys failed: No such file or directory
Custom Linux Pseudo Bootstrapper V1.0 - by Mark Walker
WEB: http://www.androidfanatic.com
EML: [email protected]
Starting init process
INIT: Debian booting.....
Running Linux Kernel
net.ipv4.ip_forward = 1
AutoMounter started
Type EXIT to end session
Make sure you do a proper EXIT for a clean kill of Debian!
chroot: can't execute '/bin/bash': No such file or directory
umount: can't forcibly umount /data/local/mnt/dev/pts: No such file or directory
umount: can't forcibly umount /data/local/mnt/proc: No such file or directory
umount: can't forcibly umount /data/local/mnt/sys: No such file or directory
umount: can't forcibly umount /data/local/mnt: Invalid argument
Filesystems have unmounted
losetup: /dev/block/loop2: No such device or address
Loopback device shutdown - success
Debian down
Coded by Mark Walker
http://www.androidfanatic.com
admin.androidfanatic.com
Reverted back to Android console
Im on SuperBad Eclair...
Click to expand...
Click to collapse
I get the same error sadly but what are the benefits of installing debian
Umm you can install a GUI like Gnome and have apps like Firefox etc run... VNC etc

[Q] Missing files to run Debian?

I had it working on my I897 Captivate, then I Odin flashed back to stock, installed Cognition (previously SRE [Super Rooter Extreme]). I reinstalled debian, but now it errs. I checked my filesystem, and bash doesn't exist anywhere (nor any file with the word bash in it), and this is a list of all the EXT files:
/sbin/mkfs.ext2
/system/framework/ext.jar
/system/framework/ext.odex
/system/xbin/mkfs.ext2
The specific error message I receive when trying to run Debian is as follows:
When I enter:
$su
# bootdeb
I get:
Android Filesystem remounted as read/write
insmod: can't read 'ext2': No such file or directory
mknod: /dev/loop: File exists
[Penguin Logo]
Usage: mount [-r] [-w] [-o options] [-t type] device directory
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
Custom Linux Pseudo Bootstrapper V1.0 - by Mark Walker
WEB: <url>
EML: <url>
Starting init process
INIT: Debian booting.....
Running Linux Kernel
net.ipv4.ip_forward = 1
AutoMounter started
Type EXIT to end session
Make sure you do a proper EXIT for a clean kill of Debian!
chroot: can't execute '/bin/bash': No such file or directory
umount: can't forcibly umount /data/local/mnt/dev/pts: No such file or directory
umount: can't forcibly umount /data/local/mnt/proc: No such file or directory
umount: can't forcibly umount /data/local/mnt/sys: No such file or directory
umount: can't forcibly umount /data/local/mnt: Invalid argument
Filesystems have unmounted
losetup: /dev/block/loop2: No such device or address
Loopback device shutdown - success
Debian down
Coded by Mark Walker
<url>
<url>
Reverted back to Android console
#
OP here. Digging into the problem, so far it seems I'm only missing the ext2 kernel module. The bash it's trying to run is on debian.img. I haven't found an ext2 that will run on my Captivate though.
Upgrading Busybox may have helped, but I'm not sure yet because I broke the Super User app by installing UnleashTheBeast over SuperRooter. I'll try to find out later.
I won't be testing it at all. I bought an N900, as anyone who wants hardware and software they can put to use should.

complete linux errors ???

Hello I'm trying to get complete Linux to work with our Razer but when I try and boot one of the images I get checking loop device... FOUND
mount: mounting /storage on /data/local/mnt/external_sd failed: Invalid argument
No user defined mount points
net.ipv4.ip_forward = 1
chroot: can't execute '/root/init.sh': No such file or directory
Shutting down Linux ARM
umount: can't umount /data/local/mnt/external_sd: Invalid argument
I need help getting this to work tryed editing the bootscript.sh can't get it to work

Boot script does not have priviledge

I want to mount the second partition of my SD card at boot time for Link2SD's benefit, but I have been having a hard time.
I copied Link2SD's script in /data/adb/service.d/ and made some small changes:
Code:
#!/system/bin/sh
LOG=/data/link2sd-11link2sd.log
echo >> $LOG
date >> $LOG
sleep 10
mount -t ext4 -o rw,noatime /dev/block/mmcblk1p2 /data/sdext2 1>>$LOG 2>>$LOG
My log shows: "/data/adb/service.d/link2sd.sh: line 6: mount: Permission denied".
I have therefore tried to use su -c, and my log then shows: "/data/adb/service.d/link2sd.sh: line 7: su: Permission denied".
What am I doing wrong?
If it's useful, the log is also not showing the date.
noticed similar strange behavior guess Magisk is kinda broken

Categories

Resources