I had to install back a second time Android on my Fairphone 4, this time I've took some notes shared below.
TLDR: LineageOS developer options pane allows you to enable Rooted debugging. This allows you to use the adb root command which start a rooted debugging session. Then you can use adb shell to open a console on the device and run restorecon -FR /mnt/vendor/persist to restore the SELinux permissions.
From Ubuntu Touch, the easiest way to go to the fastboot mode, is to open the terminal application and run:
sudo reboot -f bootloader
Then, I used the Android 11 factory reset image provided by Fairphone (but don't do like me, see below).
Then, I wanted to install LineageOS and they require to have Android 13/15.
So, I opened Android 11, go to phone information in the settings application, repeatedly touch the build number until the developer mode is enabled.
Go, to the system panel in the settings application, open the developer mode and enable the ADB debugging.
On my computer, I go back to the fastboot mode with:
adb reboot bootloader
I've installed Android 13 factory reset image provided by Fairphone as I already have downloaded it for another experiment.
Then I boot Android 13 and enabled usb debugging with same steps than Android 11 (see above).
Then I've followed LineageOS instructions to install it step by step:
https://wiki.lineageos.org/devices/FP4/install/
Then, with LineageOS, you can enable developer options with same procedure.
The LineageOS developer options have two options: USB debugging and Rooted debugging, you need the last one to be able to run commands to reset correctly permissions on the hardware drivers.
Then, on my computer I was able to run, adb root to start rooted debugging, open a shell on the phone with adb shell and run in this shell restorecon -FR /mnt/vendor/persist:
$ adb root
restarting adbd as root
$ adb shell
FP4:/ # restorecon -FR /mnt/vendor/persist
SELinux: Loaded file context from:
/system/etc/selinux/plat_file_contexts
/system_ext/etc/selinux/system_ext_file_contexts
/product/etc/selinux/product_file_contexts
/vendor/etc/selinux/vendor_file_contexts
/odm/etc/selinux/odm_file_contexts
FP4:/ #
Then you need to reboot and you can check this worked by enabling the automatic rotation feature: open an application and rotate your phone, the application should follow the movement