Blame

193f02 Samuli Seppänen 2025-02-11 11:47:26 1
# I get the error Cannot ioctl TUNSETIFF tun0: File descriptor in bad state (errno=77)
2
3
>>What was happening
4
>>earlier was that I built openvpn first, then realized I needed to build
5
>>the tun/tap kernel module, so built that and then rebuilt openvpn - but
6
>>configure (god bless it) used the cached result of NOT finding if_tun.h.
7
>>I cleared configure's cache and rebuilt it again - this time it found
8
>>"tun/tap v1.4". Now I'm onto a new set of problems though. Now I get:
9
>>
10
>>34: Cannot ioctl TUNSETIFF tun: File descriptor in bad state (errno=77)
11
>>
12
>>Though I've never seen this error personally, it has been talked about
13
>>extensively on the vtun list (another tunneling daemon that uses the TUN/TAP
14
>>driver).
15
>>
16
>>Go to [http://sourceforge.net/mailarchive/forum.php?forum_id=1826](http://sourceforge.net/mailarchive/forum.php?forum_id=1826)
17
>>
18
>>and search for "bad state".
19
>>
20
>>It appears to be caused by a mismatch between the tun/tap kernel module and
21
>>the kernel itself.
22
>>
23
>>What kernel version are you using?
24
>>
25
>>Because in versions 2.4.6 and higher, the TUN/TAP module is integral to the
26
>>kernel -- if you try to build an external version of the module, rather than
27
>>using the one already bundled, it will likely fail.
28
> Also, I've read a few posts that suggest that /usr/src/linux needs to point
29
> to headers that match the running kernel. Depending on what Sean has, it
30
> may be worthwhile to ensure all the various versions
31
> (kernel/headers/tunTap) all match.