Skip to content

Instantly share code, notes, and snippets.

@GithubUser5462
Last active October 10, 2024 21:11
Show Gist options
  • Save GithubUser5462/5b0e11f67912b094c18bd805ce5db606 to your computer and use it in GitHub Desktop.
Save GithubUser5462/5b0e11f67912b094c18bd805ce5db606 to your computer and use it in GitHub Desktop.
ERROR: unable to configure virtual network port: could not open TUN/TAP device: No such file or directory

ERROR: unable to configure virtual network port: could not open TUN/TAP device: No such file or directory

The error message you are seeing is related to the TUN/TAP device. This device is used to create virtual network interfaces. The error message suggests that the device is not available or not configured correctly.

You can try the following steps to resolve the issue:

1. Kernel module

  • Check if the TUN/TAP device is loaded by running the command lsmod | grep tun

  • If it is not loaded, you can load it by running sudo modprobe tun

  • To make the tun kernel module get loaded at boot time add it to the /etc/modules file, with the following command:

    • echo "tun" | sudo tee -a /etc/modules

2. Permissions

  • Check if your user has permission to use the TUN/TAP device by running the command id -u
  • If your user ID is not in the dialout group, you can add it by running sudo usermod -a -G dialout <username>

3. Missing device file

  • Check if the TUN/TAP device is available by running the command ls /dev/net/tun
  • If it is not available, you can create it by running
    • sudo mkdir -p /dev/net && sudo mknod /dev/net/tun c 10 200 && sudo chmod 0666 /dev/net/tun

Related links

Raspberry Pi missing TUN/TAP device
Unable to join ZeroTier network
Other

@justaCasualCoder
Copy link

Thanks! This was really helpful.

@uniquegch
Copy link

Thank you very much for that great readme. fixed my issue with missing directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment