This also happened to me.
I use Infinity X (the GApps Variant) and have it rooted with KernelSU.
When running adb shell and su, I have the same error.
The solution is very simple:
Open KernelSU, switch to the Super user tab, find Shell (the one with com.android.shell), and grant it Super user priviledge.
Done!
- Open
KernelSU, - Switch to the
Super usertab, - Find
Shell(the one withcom.android.shell), - And grant it Super user priviledge.