Howto install Calyx OS on FP4

Interesting issue :thinking:

Does the script throw any errors? Could you please post the output :pray: maybe we’ll get some clues.

Have you checked that you have the latest fastboot version installed? The install script is very particular about the minimum requirements.

I’m not a Windows user, so this might be a known problem :man_shrugging: If you have a Linux “live CD” lying around you could always try that (or run it in WSL).

Here’s the full output. I’m working on reinstalling my fastboot to see if that helps. I’ll report back shortly:

C:\Users\Majorian\Downloads\FP4-factory-22307020\FP4-sq3a.220705.003.a1>flash-all.bat

target reported max download size of 805306368 bytes

sending 'abl_a' (148 KB)...

OKAY [ 0.017s]

writing 'abl_a'...

OKAY [ 0.014s]

finished. total time: 0.037s

target reported max download size of 805306368 bytes

sending 'abl_b' (148 KB)...

OKAY [ 0.014s]

writing 'abl_b'...

OKAY [ 0.004s]

finished. total time: 0.020s

target reported max download size of 805306368 bytes

sending 'aop_a' (176 KB)...

OKAY [ 0.012s]

writing 'aop_a'...

OKAY [ 0.004s]

finished. total time: 0.021s

target reported max download size of 805306368 bytes

sending 'aop_b' (176 KB)...

OKAY [ 0.007s]

writing 'aop_b'...

OKAY [ 0.005s]

finished. total time: 0.018s

target reported max download size of 805306368 bytes

sending 'bluetooth_a' (940 KB)...

OKAY [ 0.029s]

writing 'bluetooth_a'...

OKAY [ 0.009s]

finished. total time: 0.045s

target reported max download size of 805306368 bytes

sending 'bluetooth_b' (940 KB)...

OKAY [ 0.030s]

writing 'bluetooth_b'...

OKAY [ 0.008s]

finished. total time: 0.043s

target reported max download size of 805306368 bytes

sending 'core_nhlos_a' (108492 KB)...

OKAY [ 2.338s]

writing 'core_nhlos_a'...

OKAY [ 0.659s]

finished. total time: 3.009s

target reported max download size of 805306368 bytes

sending 'core_nhlos_b' (108492 KB)...

OKAY [ 2.343s]

writing 'core_nhlos_b'...

OKAY [ 0.555s]

finished. total time: 2.910s

target reported max download size of 805306368 bytes

sending 'devcfg_a' (44 KB)...

OKAY [ 0.006s]

writing 'devcfg_a'...

OKAY [ 0.004s]

finished. total time: 0.011s

target reported max download size of 805306368 bytes

sending 'devcfg_b' (44 KB)...

OKAY [ 0.006s]

writing 'devcfg_b'...

OKAY [ 0.004s]

finished. total time: 0.013s

target reported max download size of 805306368 bytes

sending 'dsp_a' (65536 KB)...

OKAY [ 1.412s]

writing 'dsp_a'...

OKAY [ 0.251s]

finished. total time: 1.675s

target reported max download size of 805306368 bytes

sending 'dsp_b' (65536 KB)...

OKAY [ 1.405s]

writing 'dsp_b'...

OKAY [ 0.243s]

finished. total time: 1.660s

target reported max download size of 805306368 bytes

sending 'featenabler_a' (88 KB)...

OKAY [ 0.048s]

writing 'featenabler_a'...

OKAY [ 0.038s]

finished. total time: 0.137s

target reported max download size of 805306368 bytes

sending 'featenabler_b' (88 KB)...

OKAY [ 0.026s]

writing 'featenabler_b'...

OKAY [ 0.029s]

finished. total time: 0.108s

target reported max download size of 805306368 bytes

sending 'hyp_a' (396 KB)...

OKAY [ 0.014s]

writing 'hyp_a'...

OKAY [ 0.013s]

finished. total time: 0.036s

target reported max download size of 805306368 bytes

sending 'hyp_b' (396 KB)...

OKAY [ 0.018s]

writing 'hyp_b'...

OKAY [ 0.012s]

finished. total time: 0.060s

target reported max download size of 805306368 bytes

sending 'imagefv_a' (524 KB)...

OKAY [ 0.021s]

writing 'imagefv_a'...

OKAY [ 0.034s]

finished. total time: 0.085s

target reported max download size of 805306368 bytes

sending 'imagefv_b' (524 KB)...

OKAY [ 0.022s]

writing 'imagefv_b'...

OKAY [ 0.036s]

finished. total time: 0.085s

target reported max download size of 805306368 bytes

sending 'keymaster_a' (240 KB)...

OKAY [ 0.010s]

writing 'keymaster_a'...

OKAY [ 0.032s]

finished. total time: 0.089s

target reported max download size of 805306368 bytes

sending 'keymaster_b' (240 KB)...

OKAY [ 0.016s]

writing 'keymaster_b'...

OKAY [ 0.030s]

finished. total time: 0.078s

target reported max download size of 805306368 bytes

sending 'modem_a' (146332 KB)...

OKAY [ 3.164s]

writing 'modem_a'...

OKAY [ 0.648s]

finished. total time: 3.821s

target reported max download size of 805306368 bytes

sending 'modem_b' (146332 KB)...

OKAY [ 3.166s]

writing 'modem_b'...

OKAY [ 0.741s]

finished. total time: 3.919s

target reported max download size of 805306368 bytes

sending 'multiimgoem_a' (16 KB)...

OKAY [ 0.011s]

writing 'multiimgoem_a'...

OKAY [ 0.047s]

finished. total time: 0.098s

target reported max download size of 805306368 bytes

sending 'multiimgoem_b' (16 KB)...

OKAY [ 0.009s]

writing 'multiimgoem_b'...

OKAY [ 0.037s]

finished. total time: 0.082s

target reported max download size of 805306368 bytes

sending 'qupfw_a' (56 KB)...

OKAY [ 0.006s]

writing 'qupfw_a'...

OKAY [ 0.004s]

finished. total time: 0.014s

target reported max download size of 805306368 bytes

sending 'qupfw_b' (56 KB)...

OKAY [ 0.025s]

writing 'qupfw_b'...

OKAY [ 0.047s]

finished. total time: 0.124s

target reported max download size of 805306368 bytes

sending 'tz_a' (2944 KB)...

OKAY [ 0.067s]

writing 'tz_a'...

OKAY [ 0.013s]

finished. total time: 0.086s

target reported max download size of 805306368 bytes

sending 'tz_b' (2944 KB)...

OKAY [ 0.068s]

writing 'tz_b'...

OKAY [ 0.013s]

finished. total time: 0.094s

target reported max download size of 805306368 bytes

sending 'uefisecapp_a' (124 KB)...

OKAY [ 0.014s]

writing 'uefisecapp_a'...

OKAY [ 0.004s]

finished. total time: 0.023s

target reported max download size of 805306368 bytes

sending 'uefisecapp_b' (124 KB)...

OKAY [ 0.008s]

writing 'uefisecapp_b'...

OKAY [ 0.011s]

finished. total time: 0.021s

target reported max download size of 805306368 bytes

sending 'xbl_a' (3300 KB)...

OKAY [ 0.082s]

writing 'xbl_a'...

OKAY [ 0.189s]

finished. total time: 0.279s

target reported max download size of 805306368 bytes

sending 'xbl_b' (3300 KB)...

OKAY [ 0.117s]

writing 'xbl_b'...

OKAY [ 0.116s]

finished. total time: 0.240s

target reported max download size of 805306368 bytes

sending 'xbl_config_a' (96 KB)...

OKAY [ 0.014s]

writing 'xbl_config_a'...

OKAY [ 0.043s]

finished. total time: 0.086s

target reported max download size of 805306368 bytes

sending 'xbl_config_b' (96 KB)...

OKAY [ 0.008s]

writing 'xbl_config_b'...

OKAY [ 0.042s]

finished. total time: 0.078s

target reported max download size of 805306368 bytes

sending 'frp' (512 KB)...

OKAY [ 0.017s]

writing 'frp'...

OKAY [ 0.041s]

finished. total time: 0.088s

target reported max download size of 805306368 bytes

sending 'devinfo' (4 KB)...

OKAY [ 0.010s]

writing 'devinfo'...

OKAY [ 0.004s]

finished. total time: 0.019s

erasing 'misc'...

OKAY [ 0.024s]

finished. total time: 0.026s

erasing 'modemst1'...

OKAY [ 0.022s]

finished. total time: 0.023s

erasing 'modemst2'...

OKAY [ 0.019s]

finished. total time: 0.051s

fastboot: unknown option -- set-active=a

rebooting into bootloader...

OKAY [ 0.038s]

finished. total time: 0.038s

< waiting for device >

erasing 'avb_custom_key'...

OKAY [ 0.016s]

finished. total time: 0.019s

target reported max download size of 805306368 bytes

sending 'avb_custom_key' (1 KB)...

OKAY [ 0.006s]

writing 'avb_custom_key'...

OKAY [ 0.054s]

finished. total time: 0.077s

fastboot: unknown option -- skip-reboot

rebooting into bootloader...

OKAY [ 0.003s]

finished. total time: 0.003s

Press any key to exit...

Edit: Updated the format per Hirnsushi’s recommendation

There’s your error, apparently flash-all.bat doesn’t include a version check, I just checked (pun intended :smirk:).
What’s the output of fastboot --version? You need at least 31.0.3.

BTW, please put the output of the script between code tags like this…

```
Your output
```

… or push the </> button, makes it way easier to read.

Figured it out! Turns out I had two fastboots on my C drive. One was updated, but the other was pre 31.0.3, which was causing the issue. Had to remove the old install and rearrange the folders, but then the rest of the install went smoothly. CalyxOS on FP4 is fantastic. Thanks @hirnsushi :sunglasses:

3 Likes

Unfortunately, I got a boot loop using the instructions here and in the comments. I spent quite a bit of time trying to fix and speaking with the CalyxOS folks in the matrix channel. But finally figured it out. I can’t edit the original post, but here are the instructions edited to be more up to date and fixed all issues for me:

Prerequisites:

  • Make sure you have the latest version of adb and fastboot, which is 33.0.3-8952118 as of the time of this writing. Not having the latest versions is what caused a boot loop for me.
  • Download the latest FP4 CalyxOS install image (as of 9/7/2022): https://release.calyxinstitute.org/FP4-factory-22308020.zip (check if a newer one is available by visiting releases on the repository)
  • unzip FP4-factory-22308020.zip
  • cd FP4-sq3a.220705.003.a1 (we will run the script flash-all.sh in this directory later during installation)

Installation:

  1. Go through Fairphone setup and install all available updates
  2. Enable Developer Options. Settings → About Phone → Hit ‘Build Number’ until activated
  3. Get Bootloader Unlocking Code for Fairphone 3 - Fairphone and follow instructions to enable OEM unlocking in Developer Options
  4. in Developer Options enable USB Debugging
  5. 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.
  6. 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.
  7. Again run adb reboot bootloader.
  8. Run fastboot flashing unlock_critical to fix any potential errors. I know earlier comments say not to do this. But I’ve been advised by experts in the CalyxOS matrix channel that this should be done
  9. Now from the extracted FP4-sq3a.220705.003.a1 directory run ./flash-all.sh.
    This is the scary part, this will wipe your OS! The device will reboot a couple of times.
  10. When the script finishes start bootloader and go to recovery mode. If you get the screen with Android lying on its back, press Volume Up button while holding Power button down.
  11. With Vol Down select Factory Data Reset and confirm with Power. System will again erase all data and finally reboot into CalyxOS.
  12. If boot was successful, skip through setup and again enabled Developer Options and USB Debugging. We will wipe data one last time.
  13. adb reboot bootloader
  14. 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!
  15. Watch reboot into CalyxOS and enjoy your new degoogled privacy OS!
6 Likes

Great instructions :clap:

The only thing I would add: If you want to lock your bootloader, make absolutely sure you are installing a version with a matching or newer patch level than the one you have installed.

Once Fairphone releases a new OTA, following these instructions without a new Calyx release available can brick the device.

4 Likes

Hi there, what do you mean by installing a new version with a matching or newer patch level than the one you have installed?

I am looking at getting a FP4. Should I then not do OTA updates, in order for CalyxOS to be safely installed?

Thanks
David

Welcome to the community :wave:

When you receive your phone, you should check the current patch level under Settings → About phone → Android version → Android security update (or run adb shell getprop ro.build.version.security_patch).
In the case of the latest stock FPOS A.163 you would have a security patch level of 2022-08-05.

Now you can, for example, check if BoardConfig.mk in the CalyxOS sources has been updated recently, as you can see the default branch is at 2022-07-05 at the moment, so you are definitely not getting the latest version.
You should check the patch level of the Calyx images you download as well, or just ask in the forum, someone is probably already running the latest version :slightly_smiling_face:

Hi @hirnsushi
Thanks, but this does mean thet if I get one with stock patch level later than latest CalyxOS patch level it could brick (or create other issues) when flashing Calyx?

Doesn’t matter for flashing Calyx, but if you want to lock the bootloader there’s a chance to brick your device if you aren’t careful, yes.

But don’t worry, your new phone is probably not running the latest FPOS release and there will be updated Calyx images in the future as well.

1 Like

But don’t you need to to all the updates on FPOS to get the bootlader unlocking code from Fairphone?
I remember that I was wondering why I should do all the updates as explained in the first message of this thread as I don’t want a more recent patch level, but then when I followed Fariphone’s guidelines to get the unlocking code, I was asked to update the phone. Did someone try to get the code without updating? Does it work?

1 Like

I don’t think you do, sometimes updates for specific carriers get delayed for weeks or even months, you wouldn’t be able to unlock the bootloader during that time.

But I don’t have a outdated device to test this, so :man_shrugging:

Update: Well, seems you were right and I was wrong…

…you actually do need to update to the latest version :see_no_evil:

So whoever is planning on installing CalyxOS, if you’ve been on the latest FPOS (A.163), don’t lock the bootloader before the next Calyx release that ups the patch level!

1 Like

Hello, so I have followed this very helpful updated guide from @mek63. There were a lot of errors while installing flash-all.sh (e.g. “fastboot: error: Cannot load ‘abl.img’: No such file or directory”). I have tried this with several Fairphone 4’s and the result is always the same: After starting into recovery mode and doing a factory reset, the device boots a couple of times and ends up booting the original FPOS. I have then used fastboot getvar current-slot and fastboot --set-active=a/b to make sure this wasn`t the problem (installed into both) - but no change. So it seems to me that the installation failed entirely - not sure why. At least the bootloader is still unlocked, so no problems there.

When I enter fastboot --version and mke2fs -V (as suggested by @hirnsushi here I receive 33.0.3-android tools and 1.46.5 (not sure whether this is up to date and how to update it if not?).

Does anybody have an idea on how to move forward from here? Thank you!

Welcome to the community :wave:

That shouldn’t be happening, is the abl.img in the directory you are running flash-all.sh from?
Does your user have the necessary permissions, have you tried running the script with sudo?
Which version of the Calyx factory images are you trying to install? 22308020 / 3.8.0? :thinking:

Yes to all three questions. Everything is in the same folder and I have tried running flash-all.sh with sudo. Same result.

Interesting, which distro are you on? :thinking:
Your fastboot version should be sufficient, the requirements haven’t been bumped up, according to the script.

This seems weird, could you try with the latest 4.1.9-2 release (Android 13 testing)?

Just FYI, depending on when you unlocked your bootloader, don’t lock it once you get it running, Calyx doesn’t ship the latest patch level (A.170) yet.

I am using Manjaro KDE. Thank you for the link to the Android 13 testing version. I have tried it - unfortunately with the same result.

Weird :thinking:
So I’m assuming you have android-tools and android-udev installed. Works for me on vanilla Arch, I don’t think there should be a difference on Manjaro.

What’s the output of fastboot oem device-info?

Yes, both are installed. Fastboot oem device-info results are:

(bootloader) Verity mode: false
(bootloader) Device unlocked: true
(bootloader) Device ritical unlocked: true
(bootloader) Charger screen enabled: false

Then I’m out of ideas at the moment :man_shrugging:
You seem to meet every requirement, the phone is in the right state, and you tried different releases.
Were you able to flash the FP4 with some other ROM before? :thinking:

I mean different cables / ports is always a possibility, fastboot is very particular about that, but your problems sounds more like an OS issue.
If you have one available, try a different PC, if not, try a Live USB with persistent storage.