:warning: Magisk has a warning for A/B slot devices not to modify /system
with regards to OTA; if you don't want to re-flash Magisk after every update, check out these alternatives for hosts files:
Pre-requisites:
Plug a USB in and mount the phone to a computer running ADB.
In a terminal, run:
adb root
to access the device with root permissions.
Copy the local hosts file from your desktop (for example) onto the device:
adb push /home/angela/Desktop/hosts /system/etc/hosts
[100%] /system/etc/hosts
Check your /system/etc/
or /etc
directory and you should see the hosts file modified time with today's date.
Unable to mount read-only filesystem.
Simply run:
adb remount
adb root
Usually fixes the read-write issue.