Refurbed Fairphone 4 purchase. Returning to default OS

Well, I haven’t gotten very far for some reason:

$ adb devices
List of devices attached
b96db9a6        device
$ adb reboot bootloader

At this point, the Fairphone 4 shuts down, but doesn’t reboot. I have to ctrl c out of the last command, or it just sits there, waiting. I have also tried:

adb -d reboot bootloader

with the same result.

Note that the bootloader is already unlocked, and that I have set Ubuntu Touch in developer mode.

So it just turns off? That’s strange. I mean bootlader is a special mode so it should not reboot into the OS of course :wink:

Normally the command should get back directly and not wait for anything.
It triggers the boot into bootlader not more.

Alternatively turn off your phone and start in bootloader mode manually:

With the device powered off - hold Volume Down, then plug a power attached USB-C cable . Release Volume Down when you see the Fairphone logo

and check if it accepts fastboot commands like:
fastboot devices

1 Like

I got a long way, however the flashing didn’t succeed:

$ ./flash_fp4_factory.sh

*** Fairphone 4 flashing script ***

INFO: The procedure will start soon. Please wait...
INFO: The package type is "user-factory"
INFO: The build number is "TP29"
INFO: You are using a Linux distribution.

INFO: Validating the integrity of the package.
      This might take a while. Please wait...
INFO: Validation complete.
WARNING: Flashing this image wipes all user data and settings on the phone.
         It will also remove the Google factory reset protection.
         Are you sure you want to continue?
         Type "Yes" (case sensitive) and press enter to continue: Yes
INFO: Looking for connected device(s)...
INFO: One Fairphone 4 in fastboot mode found (serial number: b96db9a6).
INFO: The device is fully unlocked.
INFO: Proceeding to flash the device.
INFO: flashing partitions...
Sending 'abl_a' (152 KB)                           OKAY [  0.005s]
Writing 'abl_a'                                    OKAY [  0.011s]
Finished. Total time: 0.028s
Sending 'abl_b' (152 KB)                           OKAY [  0.006s]
Writing 'abl_b'                                    OKAY [  0.002s]
Finished. Total time: 0.018s
Sending 'aop_a' (174 KB)                           OKAY [  0.015s]
Writing 'aop_a'                                    OKAY [  0.002s]
Finished. Total time: 0.029s
Sending 'aop_b' (174 KB)                           OKAY [  0.014s]
Writing 'aop_b'                                    OKAY [  0.002s]
Finished. Total time: 0.027s
Sending 'bluetooth_a' (940 KB)                     OKAY [  0.033s]
Writing 'bluetooth_a'                              OKAY [  0.007s]
Finished. Total time: 0.053s
Sending 'bluetooth_b' (940 KB)                     OKAY [  0.028s]
Writing 'bluetooth_b'                              OKAY [  0.004s]
Finished. Total time: 0.044s
Sending 'boot_a' (98304 KB)                        OKAY [  2.403s]
Writing 'boot_a'                                   OKAY [  0.599s]
Finished. Total time: 3.013s
Sending 'boot_b' (98304 KB)                        OKAY [  2.420s]
Writing 'boot_b'                                   OKAY [  0.541s]
Finished. Total time: 2.971s
Sending 'core_nhlos_a' (111900 KB)                 OKAY [  2.775s]
Writing 'core_nhlos_a'                             OKAY [  0.606s]
Finished. Total time: 3.461s
Sending 'core_nhlos_b' (111900 KB)                 OKAY [  2.772s]
Writing 'core_nhlos_b'                             OKAY [  0.498s]
Finished. Total time: 3.351s
Sending 'devcfg_a' (42 KB)                         OKAY [  0.008s]
Writing 'devcfg_a'                                 OKAY [  0.001s]
Finished. Total time: 0.020s
Sending 'devcfg_b' (42 KB)                         OKAY [  0.006s]
Writing 'devcfg_b'                                 OKAY [  0.001s]
Finished. Total time: 0.018s
Sending 'dsp_a' (65536 KB)                         OKAY [  1.606s]
Writing 'dsp_a'                                    OKAY [  0.255s]
Finished. Total time: 1.872s
Sending 'dsp_b' (65536 KB)                         OKAY [  1.602s]
Writing 'dsp_b'                                    OKAY [  0.237s]
Finished. Total time: 1.850s
Sending 'dtbo_a' (24576 KB)                        OKAY [  0.620s]
Writing 'dtbo_a'                                   OKAY [  0.083s]
Finished. Total time: 0.727s
Sending 'dtbo_b' (24576 KB)                        OKAY [  0.621s]
Writing 'dtbo_b'                                   OKAY [  0.089s]
Finished. Total time: 0.733s
Sending 'featenabler_a' (84 KB)                    OKAY [  0.007s]
Writing 'featenabler_a'                            OKAY [  0.001s]
Finished. Total time: 0.027s
Sending 'featenabler_b' (84 KB)                    OKAY [  0.004s]
Writing 'featenabler_b'                            OKAY [  0.002s]
Finished. Total time: 0.018s
Sending 'hyp_a' (399 KB)                           OKAY [  0.015s]
Writing 'hyp_a'                                    OKAY [  0.003s]
Finished. Total time: 0.028s
Sending 'hyp_b' (399 KB)                           OKAY [  0.014s]
Writing 'hyp_b'                                    OKAY [  0.003s]
Finished. Total time: 0.027s
Sending 'imagefv_a' (524 KB)                       OKAY [  0.024s]
Writing 'imagefv_a'                                OKAY [  0.010s]
Finished. Total time: 0.046s
Sending 'imagefv_b' (524 KB)                       OKAY [  0.025s]
Writing 'imagefv_b'                                OKAY [  0.005s]
Finished. Total time: 0.042s
Sending 'keymaster_a' (257 KB)                     OKAY [  0.011s]
Writing 'keymaster_a'                              OKAY [  0.002s]
Finished. Total time: 0.025s
Sending 'keymaster_b' (257 KB)                     OKAY [  0.014s]
Writing 'keymaster_b'                              OKAY [  0.003s]
Finished. Total time: 0.028s
Sending 'modem_a' (149596 KB)                      OKAY [  3.697s]
Writing 'modem_a'                                  OKAY [  0.669s]
Finished. Total time: 4.468s
Sending 'modem_b' (149596 KB)                      OKAY [  3.703s]
Writing 'modem_b'                                  OKAY [  0.876s]
Finished. Total time: 4.681s
Sending 'multiimgoem_a' (13 KB)                    OKAY [  0.009s]
Writing 'multiimgoem_a'                            OKAY [  0.001s]
Finished. Total time: 0.023s
Sending 'multiimgoem_b' (13 KB)                    OKAY [  0.004s]
Writing 'multiimgoem_b'                            OKAY [  0.001s]
Finished. Total time: 0.018s
Sending 'qupfw_a' (53 KB)                          OKAY [  0.005s]
Writing 'qupfw_a'                                  OKAY [  0.001s]
Finished. Total time: 0.018s
Sending 'qupfw_b' (53 KB)                          OKAY [  0.006s]
Writing 'qupfw_b'                                  OKAY [  0.001s]
Finished. Total time: 0.018s
Sending 'recovery_a' (98304 KB)                    OKAY [  2.415s]
Writing 'recovery_a'                               OKAY [  0.529s]
Finished. Total time: 2.955s
Sending 'recovery_b' (98304 KB)                    OKAY [  2.428s]
Writing 'recovery_b'                               OKAY [  0.532s]
Finished. Total time: 2.971s
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::compare: __pos (which is 917456) > this->size() (which is 0)
./flash_fp4_factory.sh: line 214:  3257 Aborted                 (core dumped) ( "${FASTBOOT_BIN}" -s "${1}" flash "${2}" "${3}" )
ERROR: Could not flash the super partition on device b96db9a6.

ERROR: Please unplug the phone, take the battery out, boot the device into
ERROR: fastboot mode, and start this script again.
ERROR: (To get to fastboot mode, press Volume-Down and plug in the USB-C)
ERROR: (cable until the fastboot menu appears.)
ERROR: Aborting now (press Enter to terminate).

This has now happened twice.

This is the bug I talked about. Do NOT turn off your phone or it will be bricked!
Download fastboot from SDK Platform Tools release notes  |  Android Studio  |  Android Developers and try with that.

Yes, unfortunately I turned off the phone. Is there any way to recover?

Well… sorry to say, but I 'm afraid not. If you cannot enter the bootloader mode, you need to flash using EDL. As Fairphone does not release any files for this, you will most likely have to send your phone in.

The phone is currently in fastboot mode.

Phew, then you are most likely fine. Just retry with the fastboot linked above.

1 Like

What do I do with it?

Alternatively, there are some /e/ os images here:

Extract the archive to a folder and prepend the directory with fastboot to your PATH variable, like this: PATH=/path/to/tools:$PATH ./flash-all.sh

/e/OS includes a fastboot binary with their image (at least on FP5), so it should be fine as well.

No such thing:

~/platform-tools$ ls
adb       fastboot    lib64      make_f2fs_casefold  mke2fs.conf  source.properties
etc1tool  hprof-conv  make_f2fs  mke2fs              NOTICE.txt   sqlite3

~/platform-tools/lib64$ ls
libc++.so

Sorry, I was a bit unclear. Run the command PATH=~/platform-tools:$PATH ./flash-all.sh from your extracted Fairphone OS image directory. Then it should use the fastboot binary from the directory you showed me.

There is a ./flash_fp4_factory.sh, but I don’t see any ./flash-all.sh

Yeah, that one. Sorry, I’m pretty tired ATM. This should be correct now:
PATH=~/platform-tools:$PATH ./flash_fp4_factory.sh

1 Like

Wow. Fantastic. I am now in the Fairphone OS setup. Many thanks. The phone rebooted after the script completed, and I needed to see if the flashing had actually worked. Can I wipe the Fairphone OS preferences and then try to lock the bootloader?

If you want to lock the bootloader, I would advise you to flash the OS again (technically you only need the frp partition) so that “fastboot flashing get_unlock_ability” returns 1. Then, do “fastboot flashing lock_critical”, keep Volume Down pressed while confirming to reboot into the bootloader and finally do “fastboot flashing lock”. That way, you should be safe from bricks.

2 Likes

Many thanks again. That appears to have worked.

2 Likes

Glad to have helped! Enjoy your new phone!

1 Like

Just to reiterate: so far bricking was only an issue for the FP5 when Arch Linux with platform tools 34.0.4. was used when it got stuck at the point mentioned. While I guess its not device specific its def specific to the platform tools version, so verisons 33. should not cause this brick.

For the FP4: Always! Check get_unlock_ability before locking. Dont just assume its set back to 1. You said it at the beginning, and for the FP4 thats reallly important!

5 Likes