[OnePlus 5 Questions & Answers] hachamacha:
To me, it doesn't sound like a conflict to re-install Magisk over itself in FOS and see if that helps. The real "action" that counts is all about whether you've already booted into the OS after installing TWRP and then how you go about getting rid of the .p file without doing a regular reboot via the OS. Even installing the FOS ROM should get rid of the .p file (rename it), so something else is going on. I'll look around some more and update this if I can.

By the way: Depending upon how exactly you got from TWRP to the OS the first time, it could already have rewritten the stock recovery by the time you noticed *.p file renamed to *.bak.

OK: I recalled how I did this without a problem: I wrote instructions somewhere but have no idea where. This is what I think I did:

---------- Post added at 09:26 AM ---------- Previous post was at 08:59 AM ----------

Just saw this note:

Anytime you're in TWRP, you're automatically "rooted" for the time you're there. It's integral to TWRP having permissions to do anything like install etc. If you just "loaded" TWRP (as in fastboot boot twrprecovery.img) then you'd be rooted, but when you rebooted to the system, you'd be unrooted. While you were in TWRP, in theory you could make file system changes to the /system partition (a) if TWRP lets you mount it rw which I think that first swipe does and b) if you can see the correct files in it's file manager.

So it "seems" like those file changes should be actual file changes to the correct place. Keep in mind that while booted in TWRP, TWRP may have it's own ./system/ that has nothing to do with the OS's ./system folder, so you've got to be able to mount the OS's ./system. TWRP's ./system is already fine and of no importance for this. I can boot mine into TWRP and look around to try to clear this up, but it might not be crystal clear to me either.

The output of a TWRP terminal emulator "mount" command might be of use but it will be messy. Maybe if you can do this in emulator from TWRP:

# mount | grep system, and look at that output, perhaps put it in this post, it'd be of help. The mounted rw ./system we need is going to be the same one you'd see from adb shell or terminal emulator while booted from the OS. My guess is that the one we don't want from TWRP's perspective will be mounted as /system (params...) and that the the OS's system either will not yet be mounted and you'll have to go to mounts and mount it and then look at the output of the mount cmd again to figure out what it was mounted as. Sorry about how complicated this explanation has become. Anyway: The ./system that corresponds to the OS is the only one we care about.

There's no easy way to explain it so I'll leave it hidden to spare anyone having to look at it:

I just booted into TWRP and used terminal emulator and file manager to explore:

findings: While in TWRP, using terminal emulator to do a

$ df and then a $ mount command shows no ./system mounted specifically. // maybe not a surprise.

// TWRP just mounts it's root / file system and there is a /system folder, just not a specific mount point for it.

// TWRP does not auto mount the OS's ./system partition by default. It depends what you're going to do there.

Without going into "mounts" and clicking on /system, it won't even try to mount /system for the OS.

If you can get that mount to work in read/write mode, then you should be able to see the ./system mount using terminal emulator as such.

$ mount | grep -i system (and look specifically for ./system on the right side of whatever appears).

In theory you should be able to make changes to the OS's /system partition now. When you're done, unmount it. (I'm assuming all this works from TWRP, a dodgy assumption)

At this point: I'm just trying to figure out how TWRP does things like installs OS zips to the /system & /data partitions which it is clearly successfully able to do. It could do it without mounting anything because it could use the linux dd command, which just writes to the /dev name. OR: It could mount /system and use it. I'm not sure which.