[HELP] TWRP on MT6771V/CT Android 9 (Pie) - Android Q&A, Help & Troubleshooting

Hello, I have Blackview BV9800Pro with MT6771V/CT and Stock Android Pie and Magisk roots + Riru ckre and edXposed. I need TWRP so I could easily backup and restore system at any time. I test EdXposed and Magisk modules and it is PAIN to do factory reset if something fails cause this is my only smartphone. I tried different twrp already, but it didn't worked. Unofficial twrp contact form on website does not work (gives error). Can You help me guys, please? PLEASE!!

this one works for me (at mega)
#!GWwXDKjC!vPERdlfIiP-hylz3R7SEcU105PGAP4oi0QC3FtNWsyU
from the hovatek forum (32580)
the only problem is that, like said on that forum, it won't decrypt the user partition. Someone on there says to use the Disable_Dm-Verity_ForceEncrypt_03.04.2020.zip
to disable encryption, but another poster says that it disables the phone, no touch, no mouse, etc. I have the same issue. I'd like to be able to decrypt with TWRP or turn off encryption. Then ill be able to make backups of the user partition. Anyone have any ideas?

tecs.ottawa said:
this one works for me (at mega)
#!GWwXDKjC!vPERdlfIiP-hylz3R7SEcU105PGAP4oi0QC3FtNWsyU
from the hovatek forum (32580)
the only problem is that, like said on that forum, it won't decrypt the user partition. Someone on there says to use the Disable_Dm-Verity_ForceEncrypt_03.04.2020.zip
to disable encryption, but another poster says that it disables the phone, no touch, no mouse, etc. I have the same issue. I'd like to be able to decrypt with TWRP or turn off encryption. Then ill be able to make backups of the user partition. Anyone have any ideas?
Click to expand...
Click to collapse
that TWRP looks fine to me, the one who did this was expert. the display driver is hex patched against getbootmode in order to get touch screen working. some user reported that TWRP is asking for password, that indicates to me encryption is supported (/etc/recovery.fstab has entry for full-disk encryption with metadata partition). furthermore this TWRP build is signed with AVBv1 signature that mean it passes Verified Boot and is flashable even on locked bootloader
have you seen Method 3 for disabling dm-verity by disabling AVB with dummy vbmeta?
Code:
fastboot --disable-verity -disable-verification flash vbmeta vbmeta.img
also it seems like you can do it with Method 2 patching boot.img with Magisk Manager, the only discrepancy i recommend on step 4. to keep the checkbox for preserve force encryption enabled, then patch it manually in fstab against force encryption by changing the flag from forceencrypt= into encryptable=
if this device has fstab in boot.img then you can use Android.Image.Kitchen.v3.7-Win32.zip for unpack/repack boot.img and do the change in ramdisk/fstab.mt6771 with Notepad++
otherwise fstab is located /system_root/system/vendor/etc/fstab.mt6771 you can use adb pull in TWRP recovery, modify the file, and adb push it back
Code:
adb pull /vendor/etc/fstab.mt6771
adb push fstab.mt6771 /tmp
adb shell
cat /tmp/fstab.mt6771 > /vendor/etc/fstab.mt6771
or do it directly with sed
Code:
adb shell
sed -r ',s,(^/[^[:space:]]+[[:space:]]+/data[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]*)force[def]+[cno]+r[befpty]{3}=([^[:space:]]+),\1encryptable=\2,' /vendor/etc/fstab.mt6771 > /tmp/fstab.mt6771
cat /tmp/fstab.mt6771 > /vendor/etc/fstab.mt6771
of course vendor must be mounted. cat is recommended to preserve file permissions
But, before modifying vendor, make sure AVB is disabled (flash empty vbmeta.img)

I tried method 1:
it just stalled on the first splash screen when turned on.
for method 3:
i looked in the root and there's no vmbeta folder (vendor is the last one)
for method 2:
i tried it and it has the same issue as when i use the disabler, no touch. i made the boot img in magisk with the force encryption unchecked and the verity checked. i unpacked the boot img but there was no fstab in it. i found the one on the phone but it already had "encryptable=", here is the main section:
/dev/block/platform/bootdevice/by-name/system / ext4 ro wait,recoveryonly
/dev/block/platform/bootdevice/by-name/vendor /vendor ext4 ro wait,recoveryonly
/dev/block/platform/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc,errors=panic wait,check,formattable,quota,resize,reservedsize=128m,=/dev/block/platform/bootdevice/by-name/metadata
/dev/block/platform/bootdevice/by-name/cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,formattable
/dev/block/platform/bootdevice/by-name/protect1 /mnt/vendor/protect_f ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/dev/block/platform/bootdevice/by-name/protect2 /mnt/vendor/protect_s ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/dev/block/platform/bootdevice/by-name/nvdata /mnt/vendor/nvdata ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,formattable
/dev/block/platform/bootdevice/by-name/nvcfg /mnt/vendor/nvcfg ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/dev/block/platform/bootdevice/by-name/apd /mnt/vendor/apd ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/devices/platform/externdevice* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata
when i flashed back the magisk boot img that doesnt have the custom settings, it booted OK, but then twrp cant access the userdata again.

please read more careful
method 2
force encryption checked and the verity unchecked
i can see your fstab is broken already, there is no forceencrypt= forcefdeorfbe= or encryptable= flag (it's gone) furthermore this is not the only file otherwise it wouldn't encrypt again
method 3
flashing vbmeta is required. please download dummy vbmeta and flash it from fastboot
in TWRP you can list partitions with
Code:
ls -d $(find /dev/block -name by-name)/*
don't flash magisk zip this will affect encryption. patch fstab manually in the respective line for /data in the flags in 5th column
Code:
/dev/block/platform/bootdevice/by-name/userdata /data ext4
noatime,nosuid,nodev,noauto_da_alloc,errors=panic
wait,check,formattable,quota,resize,reservedsize=128m,encryptable=/dev/block/platform/bootdevice/by-name/metadata
which fstab is it? maybe there is another one in nvdata? at least, it is the only explanation i have why device encryptes anyway..
i am not sure why TWRP does not work for you, please provide recovery.log
edit: btw i wonder why magisk only boot with dm-verity enabled.. are you sure you have unlocked bootloader?

sorry about that, i was really tired. that is what i had. under advanced settings in magisk manager: preserve force encryption (checked), preserve AVB 2.0/dm-verity (unchecked), recovery mode (unchecked)
I just typed it wrong in my message
I didn't modify that fstab actually. So unless the disabler did it, that is the original one. I tried to unpack the vendor.img from the stock rom to see if that fstab is the same, but that image kitchen .bat threw an error.
i've added "encryptable" after "reservedsize=128m,". i then flashed the magisk boot.img and replaced the fstab using cat with the new one by copying it to /tmp/ and then running cat /tmp/fstab.mt6771 > /vendor/etc/fstab.mt6771
there is also an fstab in nvdata, that one says:
/dev/block/platform/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc,errors=panic wait,check,formattable,quota,resize,reservedsize=128m,forcefdeorfbe=/dev/block/platform/bootdevice/by-name/metadata
i edited that one : replaced forcefdeorfbe with encryptable and replaced the file in the same way as the other.
after rebooting with the 2 fstab files with "encryptable" and the custom magisk boot.img (that had no touch before), it works!
i guess that second nvdata fstab was the one we needed to edit or the regular one had been broken somehow and fixing it was the thing. im guessing it was the nvdata one.
now the phone says its unencrypted and twrp can backup the userpartition.
thank you so much

Related

[Q] Can one mount an Android file system image?

So after a failed attempt to upgrade from CyanogenMod 10.1.3 to 10.2, I was unable to access /data or /sdcard because both systems were encrypted. I ended up having to factory reset my phone because it refused to co-operate or let me access my files. However, before I did that, I was able to run
Code:
adb shell "dd if=/dev/block/mmcblk0p2" > data.img
and
Code:
adb shell "dd if=/dev/block/mmcblk0p3" > sdcard.img
, which appears to have copied the raw partition images from the phone (at least, they're the right sizes).
According to my reading, Android (and, I'm inferring, CyanogenMod) encrypts filesystems using dm-crypt, with a AES-CBC ESSIV:SHA256 cipher, with the key being derived from the password using PBKDF2. Knowing the precious little I do about encrypted file systems, my guess is that if I configure the image in cryptsetup to create a drive mapping, I can mount the mapped drive and recover the data from the images.
According to /fstab.herring on my ahem, fresh, install of Android, the /data partition is in ext4 format whereas the /sdcard partition is vFAT. So, once I've gotten through the encryption on the partition images, they should mount normally, right?
I know that dm-crypt accepts plain, LUKS, LoopAES and TrueCrypt device formats. I'm inferring from the PBKDF2 extension that Android goes the LUKS route for encrypting. Is this conclusion correct?
Could someone explain whether it's possible to decrypt a dumped android image? I'm really hoping that the cypher information is stored on the file system and not on some key file that I nuked in the factory reset. If it can, in theory, be decrypted, am I using the right tools to approach the matter? If so, I'll continue fiddling with cryptsetup and mount, but no sense in wasting time if it's an impossible task.
Never did get a response to this question, so I'll try it again, but start with a simpler question:
If someone dds an Android (specifically Cyanogenmod 10.x) partition to an img file, is there any way to read that image from, say a Linux laptop? I dumped the contents of the /system partition using
Code:
adb shell "dd if=/dev/block/mmcblk0p1" > system.img
I expected system.img to be a normal ext4 partition. However, attempting to loopback mount it with
Code:
sudo mount -t ext4 -o loop,ro system.img ~/android/system
Gave me errors about corrupt group descriptors, bad magic numbers and other maladies indicative of a thoroughly corrupted file system. I'm assuming that:
/data has the same ext4 partition structure as /system; and
The process to mount /storage would be no different to mounting /system with the exception that the former uses vFAT as its file system
However, as my Android is currently working normally (well, as well as one can hope for Android to work), I know I don't have a corrupted file system.
So what's going on? Does Android use a special version of ext4 that other Linuxes don't recognise? Am I not dd-ing correctly? Is there a block-size issue I ignored to my peril?
Borden Rhodes said:
So after a failed attempt to upgrade from CyanogenMod 10.1.3 to 10.2, I was unable to access /data or /sdcard because both systems were encrypted. I ended up having to factory reset my phone because it refused to co-operate or let me access my files. However, before I did that, I was able to run
Code:
adb shell "dd if=/dev/block/mmcblk0p2" > data.img
and
Code:
adb shell "dd if=/dev/block/mmcblk0p3" > sdcard.img
, which appears to have copied the raw partition images from the phone (at least, they're the right sizes).
According to my reading, Android (and, I'm inferring, CyanogenMod) encrypts filesystems using dm-crypt, with a AES-CBC ESSIV:SHA256 cipher, with the key being derived from the password using PBKDF2. Knowing the precious little I do about encrypted file systems, my guess is that if I configure the image in cryptsetup to create a drive mapping, I can mount the mapped drive and recover the data from the images.
According to /fstab.herring on my ahem, fresh, install of Android, the /data partition is in ext4 format whereas the /sdcard partition is vFAT. So, once I've gotten through the encryption on the partition images, they should mount normally, right?
I know that dm-crypt accepts plain, LUKS, LoopAES and TrueCrypt device formats. I'm inferring from the PBKDF2 extension that Android goes the LUKS route for encrypting. Is this conclusion correct?
Could someone explain whether it's possible to decrypt a dumped android image? I'm really hoping that the cypher information is stored on the file system and not on some key file that I nuked in the factory reset. If it can, in theory, be decrypted, am I using the right tools to approach the matter? If so, I'll continue fiddling with cryptsetup and mount, but no sense in wasting time if it's an impossible task.
Click to expand...
Click to collapse
Can you give the result of the "file sdcard.img" and "file data.img" commands?
You are quite right. With regular LUKS container/partition, you would do (being root) the following. With the following commands, you can create a container named "safe", setup it, then format its content in ext3 and mount the partition:
Code:
dd if=/dev/zero bs=1M count=50 of=safe
losetup /dev/loop0 safe
cryptsetup luksFormat -c aes -h sha256 /dev/loop0
cryptsetup luksOpen /dev/loop0 safe
mkfs.ext3 /dev/mapper/safe
(losetup /dev/loop0 safe)
(cryptsetup luksOpen /dev/loop0 safe)
mkdir mnt
mount -t ext3 /dev/mapper/safe mnt
//HERE: do whatever you want in your mounted encrypted filesystem
umount mnt
cryptsetup luksClose safe
losetup -d /dev/loop0
For details, you can go there: http://blog.theglu.org/index.php/20...-couteau-suisse-du-chiffrement-de-partitions/
Sorry, the article is in French but you can translate it if you need to.
Here, using "hexdump", you can see the "safe" file has a LUKS magic at the beginning. And doing a "file safe" command, you can check it detects it as a "LUKS encrypted file".
If doing "file" on your .img files does not give you the same result, you may not be able to directly use the "cryptsetup" command and need to adapt it.
Finally: usually in Android the header containing the key is stored on another partition so you may have lost it when wiping your phone, sorry.
---------- Post added at 02:44 PM ---------- Previous post was at 02:41 PM ----------
Borden Rhodes said:
Never did get a response to this question, so I'll try it again, but start with a simpler question:
If someone dds an Android (specifically Cyanogenmod 10.x) partition to an img file, is there any way to read that image from, say a Linux laptop? I dumped the contents of the /system partition using
Code:
adb shell "dd if=/dev/block/mmcblk0p1" > system.img
I expected system.img to be a normal ext4 partition. However, attempting to loopback mount it with
Code:
sudo mount -t ext4 -o loop,ro system.img ~/android/system
Gave me errors about corrupt group descriptors, bad magic numbers and other maladies indicative of a thoroughly corrupted file system. I'm assuming that:
/data has the same ext4 partition structure as /system; and
The process to mount /storage would be no different to mounting /system with the exception that the former uses vFAT as its file system
However, as my Android is currently working normally (well, as well as one can hope for Android to work), I know I don't have a corrupted file system.
So what's going on? Does Android use a special version of ext4 that other Linuxes don't recognise? Am I not dd-ing correctly? Is there a block-size issue I ignored to my peril?
Click to expand...
Click to collapse
Can you give the result of the "file system.img" command?
Thanks, saidlike, for your reply:
saidelike said:
Can you give the result of the "file sdcard.img"...
Click to expand...
Click to collapse
sdcardPartitionDump.img: data
saidelike said:
... and "file data.img" commands?
Click to expand...
Click to collapse
data.img: data
saidelike said:
Can you give the result of the "file system.img" command?
Click to expand...
Click to collapse
system.img: Linux rev 1.0 ext4 filesystem data, UUID=57f8f4bc-abf4-655f-bf67-946fc0f9f25b (needs journal recovery) (extents) (large files)
Again, attempting to run
Code:
mount -t ext4 -o loop systemimg mountpoint/
yields
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
Click to expand...
Click to collapse
Ignoring the results of data.img and sdcard.img for the time being, the fresh dump of the system partition shows that it's an EXT4 filesystem, but that it's heavily corrupted. fsck.ext4 on that partition basically asks me to fix every single inode, so it's not a simple unclean journal issue. Therefore, is it fair to conclude that CyanogenMod (and maybe AOSP too) have modified the ext4 partiiton type?
@Borden Rhodes
Maybe, my reply is too late, but you could try to make the same experiment with backup of your current data.
If you get the same results as with the old pre-wipe backup, then you still have a hope.

If ... then ... else and init.rc

Hi, I'd like to ask a general question about device boot. I'd like to mount /system, /data, and /cache partitions in selected locations based on detection of sdcard in the device.
How could I add an if ... then ... else statement to init.rc before that /system, /data, and /cache partitions are mounted? Any ideas?
Solved
I've found a way to perform this task. It's possible to place if ... then ... else statement into a shell script and put the shell script into ramdisk root directory of boot.img. Then, just run the script by busybox ash command from init.rc (with busybox located into ramdisk root directory).
cristian_c said:
I've found a way to perform this task. It's possible to place if ... then ... else statement into a shell script and put the shell script into ramdisk root directory of boot.img. Then, just run the script by busybox ash command from init.rc (with busybox located into ramdisk root directory).
Click to expand...
Click to collapse
Hey... I managed to mount /dev/block/mmcblk1p2 as my /data partition by editing my boot.img ramdisk(the 3. fstab files and the .rc files... i replaced [email protected] with dev/block/mmcblk1p2 wherever i saw them)
So i was trying to use an if statement in some of the .rc files to check if /dev/block/mmcblk1p2 was mounted on /data and if not then mount /dev/block/mmcblk0p9 (my usrdata partition) on /data... Soon i realised that this isn't exactly bash...
Please explain how you managed to get a .sh to run from your .rc files( or do you only need it in the init.rc, and remove all the /data mounting lines from them and do it all from the script???)
I don't always have access to a pc so if my sdcard somehow dies i want my phone to boot using the internal /data partition otherwise i will bootloop until i flash the original boot.img
nullbyte001 said:
Hey... I managed to mount /dev/block/mmcblk1p2 as my /data partition by editing my boot.img ramdisk(the 3. fstab files and the .rc files... i replaced [email protected] with dev/block/mmcblk1p2 wherever i saw them)
So i was trying to use an if statement in some of the .rc files to check if /dev/block/mmcblk1p2 was mounted on /data and if not then mount /dev/block/mmcblk0p9 (my usrdata partition) on /data... Soon i realised that this isn't exactly bash...
Please explain how you managed to get a .sh to run from your .rc files( or do you only need it in the init.rc, and remove all the /data mounting lines from them and do it all from the script???)
I don't always have access to a pc so if my sdcard somehow dies i want my phone to boot using the internal /data partition otherwise i will bootloop until i flash the original boot.img
Click to expand...
Click to collapse
I've found on fs_property:ro.mount.fs=EXT4 in init.rc. In that section, I've added the following iine:
Code:
exec /busybox ash /mount_partitions.sh
[of course, I've placed busybox arm compiled binary (the version provided by busybox android app should work) and a mount_partitions.sh script (created by myself) into boot image ramdisk (I mean / main directory, the same where init.rc is located) ]
You could also need to give permissions to busybox and to .sh script. You could also need to remount / in read-write mode, in case of issues with the above command.

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.

[Support] Perfect boot image - disable verity and forced encrypt

ive created a boot.img maybe someone can try and report back - in theory it should speed up /data /system and /cache partitions by the fstab flags set.
also uploaded the default boot.img from oxygen 4-7-5 (please make sure you're on 4-7-5) maybe someone can help fix this if it doesnt work.
please note this may wipe all storage / etc etc take all necessary precautions (external backup etc) until we get it working 100% as i havent tested
this work is open to anyone who'd like to use it.
Cliffs
- ive modified boot.img to try and disable verity and force encrypt - also enabling / disabling certain IO functions to improve throughput
- i need someone to go into twrp > flash the modifiedboot.img then format /data and check if it boots (i.e boots into OS if it does please report back)
-please make all necessary backups incase it doesnt work
-attached stock boot.img incase it doesnt work (please make external backup too)
here are my attempts:
Modified boot.img:
https://drive.google.com/open?id=154jrUAQ1oq7Fpjw7PgBKCJ_E6yBCxvaQ
stock boot.img
https://drive.google.com/open?id=17JU_OiEGdGm_9K1TcYlFtEkiiTJmODve
please report back if it works or not (i.e does it boot into OS or hang?)
background
my previous android phones ive created a perfect boot image whereby i edit the fstab in the boot.img
to disable force encryption and apply other android attributed in the fstab.
however i do not yet have my 1+5T as of yet so i can not try the edits as the boot.img is alittle different from my previous android phones.
The stock boot.img for the oneplus 5T (extracted from 4-7-5)
has two fstab files
the first fstab.qcom, and the second fstab_nodata.qcom
both these fstab are alittle different.
fstab.qcom looks like this:
Code:
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1,discard,errors=panic wait,verify
/dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,nodiratime,inline_xattr wait,check,forceencrypt=footer,resize
/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard,errors=panic wait,check,fileencryption=ice,resize
#/devices/soc/c0a4900.sdhci/mmc_host* /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,encryptable=footer
/dev/block/zram0 none swap defaults zramsize=536870912
/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults
/dev/block/bootdevice/by-name/modem /firmware vfat ro,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait
/dev/block/bootdevice/by-name/bluetooth /bt_firmware vfat ro,shortname=lower,uid=1002,gid=3002,dmask=227,fmask=337,context=u:object_r:bt_firmware_file:s0 wait
/dev/block/bootdevice/by-name/cache /cache ext4 rw,nosuid,nodev,barrier=1 wait,check
/devices/soc/a800000.ssusb/a800000.dwc3/xhci-hcd.0.auto/usb* auto auto defaults voldmanaged=usbotg:auto
and fstab_nodata.qcom looks like this:
Code:
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1,discard wait,verify
#/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard,errors=panic wait,check,forceencrypt=footer,resize
tmpfs /data tmpfs defaults defaults
#/devices/soc/c0a4900.sdhci/mmc_host* /storage/sdcard1 vfat nosuid,nodev wait,voldmanaged=sdcard1:auto,encryptable=footer
/dev/block/zram0 none swap defaults zramsize=536870912
/dev/block/bootdevice/by-name/misc /misc emmc defaults defaults
/dev/block/bootdevice/by-name/modem /firmware vfat ro,shortname=lower,uid=1000,gid=1000,dmask=227,fmask=337,context=u:object_r:firmware_file:s0 wait
/dev/block/bootdevice/by-name/bluetooth /bt_firmware vfat ro,shortname=lower,uid=1002,gid=3002,dmask=227,fmask=337,context=u:object_r:bt_firmware_file:s0 wait
/dev/block/bootdevice/by-name/cache /cache ext4 rw,nosuid,nodev,barrier=1 wait
/devices/soc/a800000.ssusb/a800000.dwc3/xhci-hcd.0.auto/usb* auto auto defaults voldmanaged=usbotg:auto
as you can see these two files are alittle different - previous android devices have only had one fstab file.
so my first question why are there two fstab files? - anywho ive added my modifications to both where applicable.
secondly the modified fstab id like to introduce is the following:
Code:
/dev/block/bootdevice/by-name/system /system ext4 ro,noatime,noauto_da_alloc,nodev,nodiratime,barrier=0,data=writeback,nobh wait
/dev/block/bootdevice/by-name/userdata /data f2fs nosuid,nodev,noatime,nodiratime,discard,inline_data,inline_xattr wait,check,encryptable,resize
/dev/block/bootdevice/by-name/userdata /data ext4 noatime,nosuid,nodev,nodiratime,barrier=0,data=writeback,noauto_da_alloc,discard,nobh wait,check,encryptable,resize
/dev/block/bootdevice/by-name/cache /cache ext4 rw,nosuid,nodev,noatime,noauto_da_alloc,nodiratime,barrier=0,data=writeback,nobh wait,check
virtyx said:
Hi guys
my previous android phones ive created a perfect boot image whereby i edit the fstab in the boot.img
to disable force encryption and apply other android attributed in the fstab.
however i do not yet have my 1+5T as of yet so i can not try the edits as the boot.img is alittle different from my previous android phones.
The stock boot.img for the oneplus 5T (extracted from 4-7-5)
has two fstab files
the first fstab.qcom, and the second fstab_nodata.qcom
both these fstab are alittle different.
fstab.qcom looks like this:
and fstab_nodata.qcom looks like this:
as you can see these two files are alittle different - previous android devices have only had one fstab file.
so my first question why are there two fstab files? - anywho ive added my modifications to both where applicable.
secondly the modified fstab id like to introduce is the following:
ive created a boot.img maybe someone can try and report back - in theory it should speed up /data /system and /cache partitions by the fstab flags set.
also uploaded the default boot.img from oxygen 4-7-5 (please make sure you're on 4-7-5) maybe someone can help fix this if it doesnt work.
please note this may wipe all storage / etc etc take all necessary precautions (external backup etc) until we get it working 100% as i havent tested
this work is open to anyone who'd like to use it.
here are my attempts:
Modified boot.img:
https://drive.google.com/open?id=1BYH4J3Du9VBRyxM1hyTQhs_hKNLgOU0W
stock boot.img
https://drive.google.com/open?id=1IpByGusbuWXKOXGKamHHEwax3aSnsvfm
please report back if it works or not (i.e does it boot into OS or hang?)
Click to expand...
Click to collapse
You also need to make the kernel compatible, without verity. Otherwise won't boot
jgcaap said:
You also need to make the kernel compatible, without verity. Otherwise won't boot
Click to expand...
Click to collapse
please read OP again as ive done this
by default force encryption on /data is enabled, and dm-verify is enabled...boot.img needs to be modified to disable. also /data will have to be formatted to flash ROMS.
with dm-verify enabled, any changes to /system will cause no boot
to modify boot.img:
Code:
open /ramdisk/fstab.qcom
change:
/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1 wait,verify
/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard,errors=continue wait,check,formattable,forceencrypt=/dev/block/bootdevice/by-name/extra
to:
/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard,errors=continue wait,check,formattable,encryptable=/dev/block/bootdevice/by-name/extra
virtyx said:
If we flash the boot.Img then another kernel may it work? @jgcaap how would we get it to work?
Never needed to do that on a previous android
Click to expand...
Click to collapse
You need to compile kernel that will allow to boot without the verity and change the ram disk.
benny3 said:
by default force encryption on /data is enabled, and dm-verify is enabled...boot.img needs to be modified to disable. also /data will have to be formatted to flash ROMS.
with dm-verify enabled, any changes to /system will cause no boot
to modify boot.img:
Code:
open /ramdisk/fstab.qcom
change:
/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1 wait,verify
/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard,errors=continue wait,check,formattable,forceencrypt=/dev/block/bootdevice/by-name/extra
to:
/dev/block/bootdevice/by-name/system /system ext4 ro,barrier=1 wait
/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noauto_da_alloc,discard,errors=continue wait,check,formattable,encryptable=/dev/block/bootdevice/by-name/extra
Click to expand...
Click to collapse
which is why ive asked users to format /data before flashing the boot.img which should disable verity and forceencrypt
jgcaap said:
You need to compile kernel that will allow to boot without the verity and change the ram disk.
Click to expand...
Click to collapse
this is what im doing...
so if someone is brave enough to test this (as i dont have a 1+5T yet)
format /data then using mtp trasnfer the modifiedboot.img to the phone, then flash modified boot.img
and see if you can boot into OS if you can please report back.
updated the modifiedboot.img to omit discard flag - should slightly improve performance but requires a cron job to manually trim partitions, automatic trim can cause hangs upon large file deletion, plus i dont find the need to run trim on the block layer every time a file is deleted, i would rather run it daily with a cron job.
Isn't this what the disable force encryption and disable no verity zip is for? To flash over stock boot image and allow boot on a decrypted device by disabling Force encryption and no verity.?
yung40oz84 said:
Isn't this what the disable force encryption and disable no verity zip is for? To flash over stock boot image and allow boot on a decrypted device by disabling Force encryption and no verity.?
Click to expand...
Click to collapse
yes, those zips only remove verity and force encryption
this boot img includes other tweaks not found elsewhere (ie, data writeback, barrier=0, noatime, nodiratime, noautoalloc, disabling auto-trim, etc) which all theoretically should improve throughput while reducing overhead
virtyx said:
yes, those zips only remove verity and force encryption
this boot img includes other tweaks not found elsewhere (ie, data writeback, barrier=0, noatime, nodiratime, noautoalloc, disabling auto-trim, etc) which all theoretically should improve throughput while reducing overhead
Click to expand...
Click to collapse
Doesn't the auto-trim flag keeps the NAND flash healthy and prevents data corruption? ?
ground-zero said:
Doesn't the auto-trim flag keeps the NAND flash healthy and prevents data corruption? ?
Click to expand...
Click to collapse
No, doesnt prevent corruption.
we dont need the trim command to run every time a file is deleted that just causes unnecessary overhead, its better if we run the trim command daily via a cron job.
(imagine deleting files and running the trim command everytime we do so, its not needed, the OS does adequate garbage collection and the Trim command gets issued automatically from android 5 so its not needed to add it in the fstab)
for your reading
https://wiki.archlinux.org/index.php/Solid_State_Drives#Periodic_TRIM

Alcatel/Vodafone VFD720 dm-verity disable

Hi!
This phone has separate system and vendor partitions which are verified with dm-verity. I want to add Polish strings to apks/framework.
So I tried to disable veryfying of vendor and system partition (by editing fstab in boot.img), but there's only fstab.enableswap file available, which doesn't contain system/vendor mountpoints.
Later I found fstab.mt6739 on the vendor image, in /etc, and it had the desirable mounts. But after removing 'verify' flag, the phone still keeps restarting on android logo (only if system was modified).
I've also noticed, that changing anything in vendor image doesn't take effect (tried removing vodafone apps, changing strings in an apk). Is it possible that vendor partition is somehow bypassed? Is there an other way to disable dm-verity?
PS I'm flashing the firmware using NCK box.
Hi
flash the stock Boot.img ,flash it to the recovery partition. using SP flash tools
It allows to boot to the system os with recovery editing permissions
Boot into recovery mode
Hold power + volume up on boot
Adb push fstab.mt6739 /sdcard/
adb Shell
su
mount -o rw,remount /system
mount -o rw,remount /vendor
cp /sdcard/fstab.mt6739 /vendor/etc/
chmod 644 /vendor/etc/fstab.mt6739
Flash back the stock recovery when your finished

Categories

Resources