[Solved] Phone sensors stopped working after installing experimental image [Ubuntu]

Yes thanks. I did try that and the affected sensors sadly don’t produce any data.

If the issue is an Ubuntu one resetting the phone really means reinstalling the default OS. If that was done there would likely be no problem and so no ‘need’ to send it to Fairphone. If of course you couldn’t install FPOS and that is down to them then yes it is a bit of a liability for them.

As Fairphone don’t run this forum there is no chance they will silence posts etc.

Done: Is it OK ?

As stated initially:

After a lot of troubleshooting, as well as attempts to flash only parts of the FPOS offline installer (Divest devs suspected a driver/firmware issue), I finally gave in and decided to download and flash the full FPOS package, wiping everything in the process. But again no luck, not even after upgrading from the settings updater, multiple reboots and turning the developer option for sensors off and on.

Resetting and reinstalling the default OS didn’t help, meaning I could “play dumb” and send it in for a fix. But I want to try to fix this myself if possible, since all leads I can find points to some driver or firmware package not being reset by the default installer.

1 Like

Oh, and yes, thank you for changing the title!

1 Like

Yes missed that Oops!

1 Like

I’ve for now added a warning in #oslist wiki (✏ Operating Systems for Fairphones).

5 Likes

Your topic reminded me of the following one:

In this case only the tilt sensor did not work and it refers to a FP2.
But the interesting thing (and probably relation) is that installing UT changed it (in that case it solved it).
So it’s another hint that UT does something with the sensors which other OS don’t and even a factory reset doesn’t…

2 Likes

@mhv Thanks to that hint from Luca Weiss on your issue I have indeed been able to get things working again. It requires getting root using magisk and then as root running restorecon -FR /mnt/vendor/persist which restores the SELinux attributes. After a reboot everything should work again! :smile:

5 Likes

Oh, that’s great, will have to try it tomorrow, I’ll report back as soon as I do!

In Linux systems that have SELinux enabled as well it’s often recommended to relabel the whole filesystem if SELinux was disabled at some point. I’m not sure if Android has support for that. The command fixfiles onboot sets a file in the root (/.autorelabel) and then at boot the whole is relabeled. Just my 2 cents in the context of Fedora/Red Hat systems.

As I don’t have magisk set up I was wondering if you know if I can run this from a recovery image like twrp? I see that /mnt/vendor/persist is /dev/block/sda3 on my phone, but I’m not sure if running restorecon from recovery will do the same as when the OS is running (I need to read up on SELinux one of these days…)

Just tried this and it didn’t help. Guessing the “SELinux attributes” needs to be set by the running OS, so I’ll give Magisk a go.

You don’t need a proper Magisk setup for this, just install the app and use fastboot boot patched_boot.img, make your adjustments, reboot.
I have uploaded some prepatched boot.imgs in this folder, if you want to skip patching the image.

1 Like

I wouldn’t do that as you need the correct file_contexts. You can relabel everything manually, but it will be a lot easier when file_contexts is known, because else you will have to specify everything by hand

Will your prepatched boot.img work if I’m running DivestOS, or would I have to go back to the Stock OS?

In that case I would suggest extracting and patching the boot.img that’s shipped with DivestOS, just to be safe.

Edit: I had an extracted one lying around already, here you go :slightly_smiling_face:

3 Likes

Thank you, but I just did it myself, a great learning experience. Downloaded yours and it has the exact same md5sum as mine even, so I think I did it right :joy:

2 Likes

AND IT WORKED!

So in summary:

  • You need to get a root shell in your currently installed Android flavour, either via permanent or one-time booting to a magisk image
  • Run restorecon -FR /mnt/vendor/persist
  • Reboot

As people have mentioned here and elsewhere MESSING WITH THE PERSIST IMAGE CAN BRICK YOUR DEVICE, so do this at your own risk!

I’m not sure if or how I could get into contact with the right people, but maybe this is something the default OS package should fix automatically? I won’t make a very hard argument for this, as it will probably only affect people who should be able to fix it themself now that this thread exist.

Thank you very much everyone in this thread!

7 Likes

If there’s any interest from fairphone developers or others, I extracted an image of my persist partition before and after the restorecon operation, so one could see exactly what changed to make it work again. (This is after a DivestOS install, but from my understanding “persist” should be the same for all Android installations?)

1 Like

Maybe ask @lucaweiss :wink:

2 Likes