Back to Stock Rom

Hi, I installed LineageOS 20 on my FP4 (256).
Now i want to switch back to stock ROM with this Guide: https://support.fairphone.com/hc/en-us/articles/4405858261777

When i run the Script it stops without errormessage ( no matter if i tried it in Kubuntu oder Windows 10).


*** Fairphone 4 flashing script ***

INFO: The procedure will start soon. Please wait...
INFO: The package type is "user-factory"
INFO: The build number is "FP4I"
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: xxxx)
what i am doing wrong?

BR DrCyber

Just to make sure: Dud you use tbe new “v2”-image to flash back to stock?
The old one had an error in its script and your problem reads just like issue.

4 Likes

I don’t see any reasons for this to happen when having a quick look at the script. The only place where maybe an error could occur is the device unlock check, this would be the next step. So did you enable OEM unlocking, run
fastboot flashing unlock
and (!)
fastboot flashing unlock_critical ?
If so, we would have to add some debug output to your script to see where it really gets stuck.

And since you posted the last time eight years ago and I don’t know how much you read the forum in the meantime:
Please DO NOT LOCK YOUR BOOTLOADER afterwards. There is a high risk of bricking the device if you do not check get_unlock_ability and get 1back and even then, I’m not sure if there aren’t more ways to brick it…

2 Likes

I first tried the new one, and because this did not work i also tried the old one, but without success too.

Yes i did a fastboot flashing unlock and fastboot flashing unlock_critical.
Otherwise i wouldnt have been able to flash LineageOS, right?

Yes the last time i was here , was when i was using FP 1.

So i cannot relock the Bootloader at all? Or do i have to do some extra steps to do so?

Thx for your Help!

BR

I think fastboot flashing unlock_critical isn’t necessary to flash LOS successfully, but definitely to flash stock ROM.
fastboot oem device-info should show you the status.

If that’s not the problem, can you add some echo statements to get closer to the place where the script seems to terminate? I don’t have access to the script right now, I would look it up and write again later otherwise.

when i run fastboot oem device-info i get this:

fastboot oem device-info
                                                   FAILED (remote: 'Command not supported in default implementation')
fastboot: error: Command failed

but fastboot devices shows my phone, so the connection is working

Reminds me of checking stuff I read in the internet…
I don’t know any other way than running the command then. It would do nothing but to print out a message if the critical partitions were already unlocked. Since you want to return to stock OS, I assume that you already backed up all data.
Otherwise, you can try to find out how the script determines if everything is unlocked, that’s the part we will likely have to look at anyway. I will be home in an hour or so, then I can make more reliable statements…

Yes i backed up my data.
i guess this is the part of the Script , but i do not know much about programming at all, so i dont know what i would need to REM out?

# Check if the device is unlocked. If not, stop the script.
is_unlocked() {
  # Store the string that we will look for when checking
  UNLOCKED_STRING="Device unlocked: true"
  CRITICAL_UNLOCKED_STRING="Device critical unlocked: true"

  # Get the current status of the bootloader
  # Note that the output goes to stderr, so we need a redirect
  DEVICE_INFO_OUTPUT=$(${FASTBOOT_BIN} oem device-info 2>&1)

  # Check our strings against the output of the status command.
  # Provide feedback to the user, and exit if needed.
  if [[ $DEVICE_INFO_OUTPUT == *$UNLOCKED_STRING* ]]; then
    if [[ $DEVICE_INFO_OUTPUT == *$CRITICAL_UNLOCKED_STRING* ]]; then
      echo "INFO: The device is fully unlocked."
    else
      echo -en "$RED"
      echo "ERROR: The critical partitions are not unlocked."
      echo "       Please refer to our support articles for help."
      abort_now
    fi
  else
    echo -en "$RED"
    echo "ERROR: The device is not unlocked."
    echo "       Please refer to our support articles for help."
    abort_now
  fi
}

This time it worked suddenly:

fastboot oem device-info
                                                   (bootloader) Verity mode: true
(bootloader) Device unlocked: true
(bootloader) Device critical unlocked: false
(bootloader) Charger screen enabled: false
OKAY [  0.002s]
Finished. Total time: 0.002s

so ctritical seems not to be unlocked…

when i try to unlock critical i just see:

fastboot flashing unlock_critical
< waiting for any device >

and the phone just shows a Fairphone and “powered by Android” Logo

Can you try to get into the bootloader by running
adb reboot bootloader
and then try to run
fastboot flashing unlock_critical
again?

Try to run the command as sudo, too, sometimes that helps even if there is no explicit error message.

1 Like

now it worked, at least the unlock_critical…

astboot oem device-info
                                                   (bootloader) Verity mode: true
(bootloader) Device unlocked: true
(bootloader) Device critical unlocked: true
(bootloader) Charger screen enabled: false
OKAY [  0.002s]
Finished. Total time: 0.002s

but the script still does not work

Now, after a few reboots to bootloader, the script is running…
I dont know what i did different this time…

Stock-Rom is Running now, Thx for your help!
Is there a way how to close the Bootloader now or is this impossible without the risk of bricking the Phone?

Most likely the script had the same issue and so it was stuck at this point. Hard to tell the reason for this. After the installation, check get_unlock_ability and the status of OEM unlocking in the developer settings (is it set and is it editable or read-only). Post this and maybe someone more experienced in relocking the bootloader can estimate if this could be harmful (or if you need to check additional parameters). But I don’t know if anyone is able to guarantee you that relocking it is safe.

3 Likes

The most important part is to lock the bootloader before booting into the system for the first time, because that will reset get_unlock_ability apparently (at least in my experience).

My suggestion would be:

  • Install the system again and don’t boot into Android
  • Check if fastboot flashing get_unlock_ability returns 1
  • If it does, lock the bootloader with fastboot flashing lock

If you check get_unlock_ability beforehand you should be able to unlock the bootloader again if something fails (patch level mismatch for example).

But, there is still a risk involved, the bootloader is a black box, only Fairphone knows what’s wrong with it and when it bricks your phone, and they haven’t cleared it up yet.

6 Likes

My bootloader is locked again, thx guys for your help :+1: :clap:

4 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.