Quicktip: Fixing Android 'Permission Denied' issues with TWRP

Quicktip: Fixing Android 'Permission Denied' issues with TWRP


AndroidTWRPOxygenOSOnePlus

Recently, I’ve decided to do a clean install of the latest OxygenOS on my OnePlus 6T.

For that, I booted into TWRP recovery, and wiped Dalvik Cache, Cache, System, Data and Internal Storage.
After some other issues (which were solved by running fastboot --set-active=a in fastboot mode and installing the newest modded TWRP version from XDA, see here), I was finally able to successfully flash OxygenOS.

However, after booting into it, I’ve noticed some very strange issues, which included:

  • Installing or updating apps via Google Play regularly failed for most apps.
  • Downloading files via Google Chrome consistently led to a crash.
  • Creating files or folders failed with an error like Permission denied.

After reflashing OxygenOS multiple times and trying lots of other things, I read up on the different options in TWRP. I stumbled across an option under the Advanced menu called Fix Permissions, which was recently renamed to Fix Contexts (see this commit).
What this option exactly does it out of the scope of this post (see here for an explanation), but it basically fixes SELinux permissions. Apparently, when I chose to wipe Internal storage all metadata about SELinux permissions was also removed. Those permissions do not get rewritten during an OxygenOS flash and so they were missing after the install leading to the problems I mentioned above.

So the solution to my issue was just to run Fix Contexts in TWRP.

After booting into System, everything worked again :).

Please note though: This is a very specific issue, and in most cases you should not just run Fix Contexts as there are numerous reports of this option causing bootloops. However, if you have no other ideas left, you can give this a try.

© 2025 Marian Lambert