[Xiaomi Redmi Note 5 / 5 Plus Questions & Answers] rvnlord:
// Update (Original problem described in the bottom of the post)

So I have actually tried a lot of different things, in the end I wiped the encrypted storage and everything else using TWRP however I have another bizarre problem - whatever ROM I flash it doesn't boot, there is only black screen.

Trying to repair the '/data' filesystem or change it from ext4 to ext2 and back in TWRP gives an error:

Failed to mount '/data' (Operation not supported on transport endpoint)
Unable to mount storage

Trying to 'Repair or Change File System' in TWRP for 'Internal storage' gives an error (maybe because its really '/data/media' folder? - https://twrp.me/faq/datamedia.html):

Invalid partition selection

'/data' (partition) = 'userdata' in parted = whole internal storage
'/data/media' (folder, virtual parittion?) = sdcard = user files in internal storage

It looks like after every system boot, filesystem change or repair, '/data' (internal storage?) gets unmounted and can't be mounted back. I used 'parted' and `adb shell` to recreate `/data` partition manually (called `userdata` in parittion table) but it didn't help:

adb push parted /
chmod 755 parted
adb shell
cd /dev
/parted block/mmcblk0
unit b
p
rm 50
mkpart primary 5570568192 62537055743
name 50 userdata
mke2fs -t ext4 /dev/block/mmcblk0p50

Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3481600 inodes, 13907833 blocks
695391 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
425 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

My partition table looks like this, I don't know what to make of it:

Number Start End Size File system Name Flags
1 67.1MB 155MB 88.1MB fat16 modem
2 201MB 201MB 1024B fsc
3 201MB 201MB 8192B ssd
4 201MB 202MB 524kB sbl1
5 202MB 202MB 524kB sbl1bak
6 202MB 203MB 524kB rpm
7 203MB 203MB 524kB rpmbak
8 203MB 206MB 2097kB tz
9 206MB 208MB 2097kB tzbak
10 208MB 208MB 262kB devcfg
11 208MB 208MB 262kB devcfgbak
12 208MB 225MB 16.8MB ext4 dsp
13 225MB 227MB 1573kB modemst1
14 227MB 228MB 1573kB modemst2
15 268MB 268MB 32.8kB DDR
16 268MB 270MB 1573kB fsg
17 270MB 270MB 16.4kB sec
18 336MB 347MB 11.5MB splash
19 403MB 404MB 1049kB aboot
20 404MB 405MB 1049kB abootbak
21 405MB 472MB 67.1MB boot
22 472MB 539MB 67.1MB recovery
23 539MB 540MB 1049kB devinfo
24 540MB 3761MB 3221MB ext2 system
25 3825MB 4094MB 268MB ext4 cache
26 4094MB 4127MB 33.6MB ext4 persist
27 4127MB 4128MB 1049kB misc
28 4128MB 4129MB 524kB keystore
29 4129MB 4129MB 32.8kB config
30 4129MB 4397MB 268MB oem
31 4429MB 4429MB 32.8kB limits
32 4496MB 4497MB 524kB mota
33 4497MB 4498MB 1049kB dip
34 4498MB 4531MB 33.6MB mdtp
35 4531MB 4532MB 524kB syscfg
36 4532MB 4536MB 4194kB mcfg
37 4563MB 4564MB 131kB lksecapp
38 4564MB 4564MB 131kB lksecappbak
39 4564MB 4564MB 262kB cmnlib
40 4564MB 4564MB 262kB cmnlibbak
41 4564MB 4564MB 262kB cmnlib64
42 4564MB 4565MB 262kB cmnlib64bak
43 4565MB 4565MB 262kB keymaster
44 4565MB 4565MB 262kB keymasterbak
45 4631MB 4631MB 262kB apdp
46 4631MB 4631MB 262kB msadp
47 4631MB 4631MB 8192B dpo
48 4631MB 4698MB 67.1MB logdump
49 4698MB 5571MB 872MB ext2 cust
50 5571MB 62.5GB 57.0GB ext4 userdata

I am confused because it should be more than enough.

Summary: I can flash ROMs and other things, they install without errors but to do that I have to first use TWRP's 'Format Data' each time and Reboot to Recovery. After that '/data' can be mounted properly in TWRP. Every time I try to do anything with the partition under TWRP it "dismounts" and can't be mounted back, if I try to boot the installed ROM (clean, any) instead, I end up with a Black Screen which rebooted to recovery again prevents '/data' from being mounted (until another 'Format Data').

I have also tried older versions of TWRP (to no avail) and newest OrangeFox recovery (touch doesn't work, presumably due to the original problem).

// ORIGINAL PROBLEM

I really need your help guys, will be grateful for any assistance.

My `XIaomi Redmi 5 Plus` was accidentally flooded. I disassembled it completely, checked the parts, soaked and cleaned with 99% isopropyl alcohol, then waited for it to dry completely.

I have also replaced screen into this: https://allegro.pl/oferta/wyswietlacz-ekran-lcd-ramka-xiaomi-redmi-5-plus-8501826695?snapshot=MjAyMi0wMS0yMVQwMjoxNjo1Ny40NDRaO2J1eWVyOzUyNDA1ZTkzODY3MTkzYTRlYTVlOGZkYjM3OGIwZDJjOTQ0NGI4MmZiM2Y1MmQ4MGMzYjZlNGU4ODdkNzA1MjU=

I have `lineage-15.1-20180526-UNOFFICIAL-vince` ROM installed since 2018: https://xdaforums.com/t/rom-stable-...al-lineageos-15-1-updated-26-05-2018.3780298/ (I am not sure if this is the correct version, I can provide the file if necessary)

Also TWRP and Magisk

My Android is encrypted and incompatible with TWRP decryption since day one (its a bug apparently).

Everything works except touch on Android (pre-boot auth screen), to my astonishment touch works under TWRP), I also have adb access.

Dirty and clean flashing different ROMs and kernels didn't fix the issue.