I got a new FP4 and first thing after registration was to wipe the system and install Calyx OS. For anyone out there who wants to try it, I’d like to share my experience, since at the time of this writing, the CalyxOS easy device flasher does not support FP4 yet and installation can be a bit scary. So this is exactly what I did.
Warning and Disclaimer: While this worked for me, there is no guarantee that this can be reliably reproduced. So proceed with caution. I am not responsible for any damages that might occur by following this how to. If you brick your phone, that’s your own responsibility, do not blame me. You have been warned!
Additional Warning: This will wipe all user data. So make backups.
I used Arch Linux with android-sdk-platform-tools 33.0.1-1 (aur) and android-udev 20220102-1 installed.
Connect phone to PC via USB and run adb reboot bootloader. From now on, just keep it connected until we are finished. Phone reboots into fastboot mode. If adb cannot find your device, try different USB cables and ports. Also make sure that your phone’s USB usage is set to “Transfer Data”. Try adb kill-server; adb start-server, reconnect and try again. Allow access on the phone from your computer.
When the phone has rebooted into fastboot mode run fastboot flashing unlock. Confirm with Vol Down + Power. This will wipe your data. You might need sudo if udev rules are missing. If fastboot cannot find your device, again try different cables and ports, it seems to be very picky. The phone erases all data and reboots into FPOS. Skip through setup and again enable Developer Options and USB Debugging. Make sure OEM unlock is still enabled.
Again run adb reboot bootloader.
Now from the extracted FP4-sp2a.220505.002 directory run ./flash_all.sh.
This is the scary part, this will wipe your OS! For me, there were a lot of errors that said FAILED (remote: 'Flashing is not allowed for Critical Partitions') but it still worked out in the end, so bear with me. The device will reboot a couple of times.
When the script finished my Phone tried to reboot twice and then went to recovery mode with the following error: Cannot load Android system. Your data may be corrupt. If you continue to get this message, you may need to perform a factory data reset and erase all user data stored on this device.
With Vol Down select Factory Data Reset and confirm with Power. System will again erase all data and finally reboot into CalyxOS.
If boot was succesfull, skip through setup and again enabled Developer Options and USB Debugging. We will wipe data one last time.
adb reboot bootloader
Relock the bootloader: fastboot flashing lock. This is strictly not required but highly recommended. Also if you want to have SafetyNet Attestation, you must relock your bootloader. Again, this will erase all user data. Beware: there have been reports of unrecoverable bootloader loops after relocking, this can brick your phone. Before relocking, make absolutely sure, that your phone can boot into Calyx and that OEM Unlock is enabled in Developer Options. Double check if unsure!
Watch reboot into CalyxOS and enjoy your new degoogled privacy OS!
You can use fastboot flashing unlock_critical before starting the installation to get rid of those errors.
It works without that but your critical partitions won’t get flashed. So if those have been changed from the stock ones by the Calyx devs (AFAIK they haven’t) this might lead to problems in the future.
Better safe than sorry though
I wonder if/why in your case OEM unlock was enabled after flashing and booting CalyxOS. It wasn’t and still isn’t in my case, and I think I followed essentially the same procedure. The only differences I am aware of: I did unlock_critical and started with FP4-factory-22303020.zip.
I’ve seen this on some other threads (I think about installing /e/?), but it seems this might be correlated to some of the boot loop bricks that have occured. On the CalyxOS install instruction page there is also no mentioning of unlock_critical and on their Matrix testing channel they said to stick exactly to their instructions until this boot loop thing can be figured out. So that’s why I decided not to unlock_critical. But sure, I don’t know what consequences that will have down the road.
On the Matrix testing channel I read that there could have been a bug that messed with lock/unlock in earlier images that has been fixed in the latest image. So maybe that’s what could have happened to you?
Possibly. But if so, re-flashing with the latest image does not fix things. When I tried this at first I was happy because immediately after flashing get_unlock_ability was 1 - but after booting into CalyxOS OEM unlocking still was disabled/greyed and get_unlock_ability again was 0.
OK, I’ll wait if someone finds a safe way to fix this.
I know it’s not mentioned in their instructions and they weren’t clear about it when people asked them on Matrix in the past, but they are shipping critical partitions and there is code in flash-all.sh to flash those. What would be the point of including those if you don’t want them to end up on the device?
Fairphone had to be made aware of that command as well and they subsequently changed the documentation to include it. So if you follow the official Fairphone guide to unlock the bootloader, you’ll end up with critical partitions unlocked as well.
As I was saying, those critical partitions are still the same across the different custom ROMs (and stock FPOS) as far as I can tell, so you probably don’t have to change something on your newly installed system because you already were on the right version, but that might not be the case in the future.
So one thing that apparently does not work when you haven’t used unlock_critical is automatic OTA update. At least the first one. According to information from the Matrix channel, you need to sideload the first OTA update. But the next should be fine and work as expected.
I followed all the steps but got this message and after reboots its in a boot loop. I can get to to bootloader but Calyx dont start.?
Waarschuwing: ‘stripe’-breedte 1 is geen even veelvoud van ‘stride’ 2.
/tmp/TemporaryFile-44cKFP: Ongeïmplementeerde Ext2-bibliotheekfunctie tijdens aanmaken van superblok
/usr/lib/android-sdk/platform-tools/mke2fs failed with status 1
mke2fs failed: 1
error: Cannot generate image for userdata
That sounds like a problem with Android Platform-Tools.
What OS and version are you running the script on?
What’s the output of fastboot --version and mke2fs -V?
Since you are only failing the "wipe userdata" step, have you tried booting into recovery (fastboot reboot fastboot and select “Enter recovery”) and using “Wipe data/factory reset”?
I’d still fix that problem on your PC afterwards if I were you
Can I still root with Calyx or is it completely against the concept? (Yes I read Security FAQ , but I really like to use apps like Neo Backup, to transfer my data, which will not work without root)
If there is a way for 2. - what does it mean for all the bootloader locked or not locked discussions and/or possibility to use OTA Updates? When I read the thread here it feels like the locking does not work well together with OTA, Magisk (root) does require an unlocked bootloader - probably only the fastboot flashing unlock is needed for that.
Thx for the quick reply. Most of the stuff is clear to me now.
Just some details / double check questions:
When we talk about unlock bootloader is it just the fastboot flashing unlock or also fastboot flashing unlock_critical? The last one was discussed here in some posts and it seems that also /e/OS and official Fairphone guides point on that. So do you leave this second option unlocked as well or do you lock it again (at least in between updates or so)? As far as I understood it should stay unlocked as well, at least in regards of the following two issues (correct me if it is wrong):
** during first installation with the factory version → to get rid of a lot of FAILED (remote: 'Flashing is not allowed for Critical Partitions')
** prevent problems during OTA updates
The update procedure is performed within the running CalyxOS (except the reboot of course), right? (uninstall Magisk within the Magisk App; run the OTA update; install Magisk again [via inactive Slot option] ← never saw that up to now tbh - anyway.
the first installation of Magisk procedure, you explained here, is still the recommended way? (with a boot from the patched boot image in between) - I didn’t get the A/B boot image point up to now, so I feel a bit unsafe and I think I will pick the boot.img from the Calyx factory zip for patching in Magisk App.
(Last point: I can edit the initial post as well (handled like a wiki post I think - and depending on the privileges some users can edit). @R2D2 do you mind when I (/we … whoever can) edit it, in case there is anything to add/re-word (first example might be 'unlock_critical`)?)
EDIT: Will eventually create a separate guide for Calyx including root and don’t touch this one…
I read some more stuff and I think both should stay unlocked, as boot partitions are critical partitions. So Magisk setup would fail without it. Also at a later stage during OTA updates Magisk will be uninstalled and installed to inactive Slot, which will probably fail, when the critical partitions are locked again, right? Furthermore locking in between does not really make sense in such a setup, as it always wipes everything ´unlock_critical´ as well as ´lock_critical´.
With that said I think 1. is answered. Feel free to add/correct.
Yes you should use fastboot flashing unlock_critical and I would keep it unlocked. I’m not sure if there are still problems with locked critical partitions when it comes to OTA, haven’t seen anything scroll by on Matrix. But since you have to keep your bootloader unlocked for Magisk anyway, might as well keep everything easily accessible.
Magisk doesn’t touch critical partitions though, so you could lock them, it’s just more hassle if you do (and have to fix something)
Yes, performed on a running Calyx system. Just a quick Magisk uninstall → OTA update → Magisk install to the other slot. I’ve used that method on several updates without any problem.
The Magisk install procedure is still the same, you just use the boot.img from the Calyx factory images, that’s correct
And thanks for all your informative posts and your quick reply, @hirnsushi , they really help to get things sorted (it was a bit different with the FP2 which is still in use here ).
Also thanks for that, will use it, when I going to flash the first time, but with my first question here I meant more a page like Lineage has (example for FP2: LineageOS Downloads ) where I can see the builds listed or so!? With that way you can just point to the lastest build. Right now, it feels more like one has to know the URL. ^^
Yeah, I always have to dig through their news section myself when I need the link. Can’t seem to remember putting it in my notes
CalyxOS on the FP4 is still in the testing phase, not installable through their “easy installer”, that’s why it isn’t featured more prominently on the website.
Regarding the link, I just took the latest link from their news (https://release.calyxinstitute.org/FP4-factory-22305000.zip) and swapped the old build number 22305000 with the newer 22307020 mentioned here.
That usually works with all kinds of stuff (for example Fairphone kernels)