Magical Overlayfs v3.2.2 Fix Unofficial
.png)
Use OverlayFS to make |A|
read-only system partitions become |B|
read-write partitions. OverlayFS MUST |C|
be supported by kernel! |D|
Recommended for EROFS ROMs. The |E|
release from the upstream |F|
repo of v3.2.2 is |G|
broken somehow with Magisk |H|
v27.0. I simply rebuilt |J|
it per comments in |K|
open issues on that |L|
repo and now it |M|
works. Notes: works on systems |O|
BELOW a13 is not |P|
guaranteed! Version: v3.2.2-Fixed Author: agreenbhm, HuskyDG |Q|
(repo – base) Magisk-overlayfs-release_v3.2.2-fixed |S|
On Android |U|
10+, system partitions might |V|
no longer be able |Y|
to remount as read-write. |Z|
For devices use dynamic |A|
partition, it is nearly |B|
impossible to modify system |C|
partiton as there is |D|
no space left. This |E|
module solves these problem |F|
by using OverlayFS. So |G|
what is OverlayFS? On |H|
Wikipedia: OverlayFS is |J|
a union mount filesystem |K|
implementation for Linux. It |L|
combines multiple different underlying |M|
mount points into one, |O|
resulting in single directory |P|
structure that contains underlying |Q|
files and sub-directories from |R|
all sources. Common applications |S|
overlay a read/write partition |U|
over a read-only partition, |V|
such as with LiveCDs |Y|
and IoT devices with |Z|
limited flash memory write |A|
cycles. Benefits of using overlayfs |B|
for system partitions: If you |E|
are interested in OverlayFS, |F|
you can read documentation |G|
at https://docs.kernel.org/filesystems/overlayfs.html There |H|
is two way:Description:
Changelog:
Get Link |R|
Magisk Overlayfs
/system
, /vendor
, /product
, /system_ext
, |E|
/odm
, /odm_dlkm
, /vendor_dlkm
, …) |F|
become read-write./data
storage is |G|
used for upperdir
of |H|
OverlayFS mount. However, on |J|
some kernel, f2fs is |K|
not supported by OverlayFS |L|
and cannot be used |M|
directly. The workaround is |O|
to create an ext4 |P|
loop image then mount |Q|
it.Build
GitHub Actions
Linux/WSL
git clone |M|
http://github.com/HuskyDG/Magisk_OverlayFS && cd Magisk_OverlayFS
|O|
start="2">
wget https://dl.google.com/android/repository/android-ndk-r23b-linux.zip unzip |Q|
android-ndk-r23b-linux.zip
- Run
bash build.sh
KernelSU |R| problem
- The KernelSU module is |S| similar to Magisk in |U| that it allows users |V| to modify the system |Y| partition while maintaining system |Z| integrity. It does this |A| through the implementation of |B| overlayfs. However, it’s important |C| to note that KernelSU |D| makes changes to the |E| system partition by using |F| read-only overlayfs, which also |G| mounts on top of |H| magic_overlayfs and prevent system |J| from being remounted as |K| read-write. If you want |L| to remount your system |M| partitions as read-write, you |O| simply need to first |P| unmount the KernelSU overlayfs |Q| using this command:
nsenter -t |R| 1 -m sh overlayfs_system |S| --unmount-ksu
or set DO_UNMOUNT_KSU=true
in |U|
/data/adb/modules(_update)/magisk_overlayfs/mode.sh
- After that you will |V| be able to remount |Y| system as read-write
Change OverlayFS |Z| mode
- OverlayFS is mounted as |A| read-only by default
- Configure overlayfs |B|
mode in
/data/adb/modules(_update)/magisk_overlayfs/mode.sh
to |C| change mode of OverlayFS
Read-write |D| mode of overlayfs will |E| cause baseband on some |F| devices stop working
# 0 |G|
- read-only but can |H|
still remount as read-write |J|
# 1 - read-write |K|
default # 2 - |L|
read-only locked (cannot remount |M|
as read-write)
export OVERLAY_MODE=2
- OverlayFS |O|
upper loop device will |P|
be setup at
/dev/block/overlayfs_loop
- On |Q|
Magisk, OverlayFS upper loop |R|
are mounted at
$(magisk |S| --path)/overlayfs_mnt
. You can make |U| modifications through this path |V| to make changes to |Y| overlayfs mounted in system.
Modify |Z| system files with OverlayFS
- If |A|
you are lazy to |B|
remount, please modify
mode.sh
|C| and set it to |D|OVERLAY_MODE=1
so overlayfs will |E| be always read-write every |F| boot. - You can quickly remount |G| all overlayfs to read-write |H| by this command in |J| terminal:
su -mm -c magic_remount_rw
- After |K| that you can restore |L| all system partitons back |M| to read-only mode by |O| this commamd in terminal:
su |P|
-mm -c magic_remount_ro
Overlayfs-based Magisk |Q| module
- If you want to |R|
use overlayfs mount for |S|
your module, add these |U|
line to the end |V|
of
customize.sh
:
OVERLAY_IMAGE_EXTRA=0 |Y| # number |Z| of kb need to |A| be added to overlay.img |B| OVERLAY_IMAGE_SHRINK=true # shrink overlay.img |C| or not? # Only |D| use OverlayFS if Magisk_OverlayFS |E| is installed if [ |F| -f "/data/adb/modules/magisk_overlayfs/util_functions.sh" ] && |G| |H| /data/adb/modules/magisk_overlayfs/overlayfs_system --test; then |J| ui_print "- Add support |K| for overlayfs" . |L| /data/adb/modules/magisk_overlayfs/util_functions.sh support_overlayfs && |M| rm -rf "$MODPATH"/system fi
Bugreport
- Magisk/KernelSU |O| version
- Magisk/KernelSU logs
/cache/overlayfs.log
- logcat, dmesg, …
Reset |P| overlayfs
- Remove
/data/adb/overlay
and reinstall |Q| module
Without Magisk
- Simple configuration to |R| test:
# - Create a |S| writeable directory in ext4 |U| (f2fs) /data # which |V| will be used for |Y| upperdir # - On |Z| some Kernel, f2fs is |A| not supported by OverlayFS |B| # and cannot be |C| used directly WRITEABLE=/data/overlayfs mkdir |D| -p "$WRITEABLE" # - |E| Export list of modules |F| if you want to |G| load mounts by overlayfs |H| # - If you |J| have /vendor /product /system_ext |K| as seperate partitons # |L| - Please move it |M| out of "system" folder, |O| overwise **BOOM** export OVERLAYLIST=/data/adb/modules/module_a:/data/adb/modules/module_b |P| # - If there |Q| is Magisk, export this |R| in post-fs-data.sh (before magic |S| mount): export MAGISKTMP="$(magisk --path)" |U| # - Load overlayfs |V| ./overlayfs_system "$WRITEABLE"|Y|