-# Bind $PREFIX so Termux programs expecting
-# to find e.g. configurations files there work.
-ARGS="$ARGS -b $PREFIX/..:$PREFIX/.."
+# On some devices /vendor is required for termux packages to work correctly
+# See https://github.com/termux/proot/issues/2#issuecomment-303995382
+ARGS="$ARGS -b /vendor:/vendor"
+
+# Bind /data to include system folders such as /data/misc. Also $PREFIX
+# and $HOME so that Termux programs with hard-coded paths continue to work:
+ARGS="$ARGS -b /data:/data"
+
+
+# Bind Magisk binary directories so root works, closing per Issue #2100.
+if [ -d /sbin ] && [ -d /root ]; then
+ # Both of these directories exist under Android even without Magisk installed,
+ # The existence check is to ensure that it doesn't break if this changes.
+ ARGS="$ARGS -b /sbin:/sbin -b /root:/root"
+fi
+
+if [ -f /property_contexts ]; then
+ # Used by getprop (see https://github.com/termux/termux-packages/issues/1076)
+ # but does not exist on Android 8.
+ ARGS="$ARGS -b /property_contexts:/property_contexts"
+fi