Dual Boot -> Sysadmin approach :)
I am using right now dual boot stock fw / ubport - switching boot from TWRP.
I write down thees steps to my self to remember and for everyone ho would like to try...
Using stock because is good... (dm-verity, rooted , ad-aware .... ) , I could not find any rom with scheduled Power On/Off feature. Needed a solution without wipe. As I understand won't mix the stuff because rootfs.img and system.img is used on ubuntu touch so it will be separated.
So try ubuntu for freedom:
Having already an unlocked Redmi4x, with working StockRom, rooted, dm-verity, and TWRP installed.
-
Boot to TWRP recovery, Backup ALL stuff including DATA.
-
Copy TWRP folder outside from the phone , ex. to Your desktop.
-
Format Data, to remove encryption, otherwise ubport installer won't work.
-
Copy back the TWRP folder backups to phone and restore stock rom.
-
Fingerprint and unlock won't work so need these steps in recovery mode:
Mount Data, System, and Delete from '/data/system' folder: files with .key extension and files with 'locksettings' keyword. Reboot to system. Everything should be fine , setup up again a security pattern. Fingerprints works after that.
-
Reboot to recovery and Backup stock Boot partition.
-
Backup to fasboot , flash halium-boot.img.
-
Reboot to Recovery, so ADB recovery is active , flash from Your Desktop:
path/to/halium-install -p ut path/to/rootfs.tar.gz path/to/system.img
-
Backup Hallium boot partition.
Now You can switch any time , just restore Boot partition. Enjoy .