Ivan F.
Ivan F.

Reputation: 119

Rooted Android 10, ioctl Permission denied errors

When I try to run some commands on Android 10 (Galaxy A11) with root access, I get the ioctl "Permission denied" errors. For example:

# ip tuntap add mode tun
ioctl(TUNSETIFF): Permission denied
# ifconfig wlan0
ifconfig: ioctl 8927: Permission denied

and the like. I tried googling about this issue but couldn't find anything to solve it. Some people talk about SELinux limitations. But root checker shows that SELinux status is permissive. How do I get rid of this ioctl errors and get the command line utilities to work properly on my rooted phone?

Upvotes: 0

Views: 2471

Answers (1)

FAHID
FAHID

Reputation: 3395

I was able to fix the issue by replacing ifconfig script with the following:

Bad command:

./adb -s $device shell ifconfig wlan0 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}'

New command:

./adb -s $device shell ip addr show wlan0 | grep -e wlan0$ | cut -d " " -f 6 | cut -d/ -f 1

Upvotes: 0

Related Questions