When setting up OpenVPN on Linux, you may encounter the error modprobe: FATAL: Module tun not found or Cannot open TUN/TAP dev /dev/net/tun: No such file or directory. This usually means the TUN/TAP kernel module is missing or not loaded. This guide walks you through the steps to fix the modprobe tun error, covering module loading, device creation, and common pitfalls.
What You’ll Need
- Root or sudo access on your Linux system.
- OpenVPN installed (the error often appears during client or server startup).
- Basic familiarity with the terminal.
Step-by-Step
- Check if the tun module exists. Run
modinfo tun. If it returns module information, the module is available. If it saysmodinfo: ERROR: Module tun not found, the module is not installed or the kernel headers are missing. - Load the tun module. Run
sudo modprobe tun. If you getmodprobe: FATAL: Module tun not found, proceed to the next steps. - Install the kernel module package. On Debian/Ubuntu, run
sudo apt update && sudo apt install linux-modules-extra-$(uname -r). On CentOS/RHEL/Fedora, runsudo yum install kernel-modules-extraorsudo dnf install kernel-modules-extra. After installation, trysudo modprobe tunagain. - Create the device node if missing. If the module loads but
/dev/net/tunis missing, create it:sudo mkdir -p /dev/netandsudo mknod /dev/net/tun c 10 200. Then set permissions:sudo chmod 600 /dev/net/tun. - Enable the module at boot. Add
tunto/etc/modules(Debian/Ubuntu) or create a file/etc/modules-load.d/tun.confcontainingtun(systemd-based). - Check virtualization restrictions. If you are on a VPS or container (OpenVZ, LXC), the host may not allow TUN/TAP. Contact your provider to enable it, or switch to a plan that supports it.
- Reboot and test. After enabling the module, reboot and run
ls -l /dev/net/tun. You should see a character device. Then start OpenVPN again.
Common Mistakes
- Running modprobe without sudo – you need root privileges.
- Installing the wrong kernel module package – ensure it matches your running kernel (
uname -r). - Creating the device node with wrong major/minor numbers – it must be
10 200. - Forgetting to set permissions – OpenVPN needs read/write access.
- Assuming the module is available on minimal installations – many cloud images lack it.
Tips
- Use
lsmod | grep tunto verify the module is loaded. - If you compile your own kernel, ensure TUN/TAP is enabled (CONFIG_TUN=y or m).
- On systemd systems, use
systemctl restart systemd-modules-loadafter adding the module. - For Docker containers, run with
--device=/dev/net/tunand--cap-add=NET_ADMIN.
Troubleshooting
- Still getting ‘modprobe: FATAL’ after installing extra modules? Reboot to load the new kernel modules, or run
sudo depmod -ato rebuild module dependencies. - Device exists but OpenVPN says ‘Cannot open TUN/TAP dev’? Check permissions:
sudo chmod 666 /dev/net/tun(temporary) or add your user to the appropriate group. Also check if SELinux or AppArmor is blocking – temporarily disable to test. - On a VPS, the module loads but the device doesn’t work? The host kernel may have disabled TUN/TAP. Contact your provider – many have a toggle in the control panel.
- OpenVPN runs but no internet? This is separate from the tun error – check routing and NAT rules.
Frequently Asked Questions
What does the modprobe tun error mean?
It means the TUN/TAP kernel module is not available or cannot be loaded, so OpenVPN cannot create the virtual network interface it needs.
Can I fix this without root access?
No, loading kernel modules and creating device nodes require root privileges. You need sudo or access to the root account.
Why is the tun module not present on my system?
Many minimal installations, containers, or cloud images omit the module to save space. Installing linux-modules-extra-* usually adds it.
Is TUN/TAP safe to enable?
Yes, it is a standard kernel feature used by VPNs and virtualization. It only creates virtual network interfaces when requested.
Do I need to reboot after installing the module?
Not always – sudo modprobe tun loads it immediately. However, a reboot ensures it loads automatically if you added it to /etc/modules.
What if my provider doesn’t support TUN/TAP?
You cannot fix this from your side. You would need to switch to a provider that allows TUN/TAP, or use a VPN protocol that doesn’t require it (rare).
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- OnePlus Watch 2 Teased? What We Know
- Vagrant vs Docker: Which Should You Use for Development?
- iQOO Neo 10 vs Neo 10R: Which Phone Should You Choose?
- Embedded OS: What They Do & When You Need One
- Best Sony E-Mount Lenses: Format & Subject Guide
- Samsung Galaxy Note Discontinued? Status Explained