lineageOS: cannot use internal SD after factory reset: "Failed to find root" (peregrine) I have a Moto G 4G (LTE) peregrine which worked fine with the latest LineageOS 14.1. + twrp-3.1.1-0.
Then i made a factory reset because i wanted to gift it to my mother.

After that, no app could access the INTERNAL SD card for storing eg. pictures or downloads.
When you open the "Files" app, it crashes immediately.
Then logcat shows the output here: https://pastebin.com/R2wBL0W8

I tried the following to no avail:


reset with formating data, cache, etc (factory reset)
reset with formating EVERYTHING, including /system, then reflashing lineage-14.1-20170811-nightly-peregrine-signed.zip and open_gapps-arm-7.1-nano-20170813.zip
reset with formating EVERYTHING, including /system, then reflashing some other 7.1 ROM found here in the forum (cannot remember which)
reset with formating EVERYTHING, including /system, then reflashing the original ROM XT1039_Retail_Germany_51_Untouched.zip


the original ROM was rather bad because the keyboard kept crashing and it was totally unusable. still no access to the internal SD card.


messing with the directory structure in LineageOS:

/sdcard is a softlink to /storage/self/primary 


/storage/self/primary is a softlink to /mnt/user/0/primary 


/mnt/user/0/primary doesn't exist, it only goes as far as /mnt/user/0



so i tried different scripts from this thread https://forum.xda-developers.com/showthread.php?t=2211109 to create /mnt/user/0/primary at boot, which all didn't work. 

it seems LOS 14.1 cannot run init scripts or user init scripts or whatever. 
it didn't work.

also, the external SD card slot isn't reliable anymore, so that's out of the question as well.

I'm rather stuck! 
can anybody help me? 
any help is appreciated!

Thank you very much!
Thank you very much, @acejavelin!
The solution was to format /data with ext4 instead of f2fs:

connect with adb while in TRWP, get the device name for /data, umount it, format with ext4, mount it again


df -h
umount /data
make_ext4fs /dev/block/mmcblk0p36
mount /data/


Then reboot