ENODEV
Linux / POSIXERRORNotableDeviceHIGH confidence

No Such Device

Production Risk

Container environments frequently encounter ENODEV when host kernel modules are not available inside the container.

What this means

ENODEV (errno 19) is returned when an operation references a device that does not exist in the kernel's device table. The device file may exist in /dev but the corresponding driver is not loaded or the hardware is absent.

Why it happens
  1. 1Opening a /dev node whose driver is not loaded (e.g. /dev/net/tun without the tun module)
  2. 2A hardware device was removed while in use
  3. 3Referencing a device by major/minor number that has not been registered
How to reproduce

Opening /dev/net/tun without the tun kernel module.

trigger — this will error
trigger — this will error
// C: open TUN device without module
int fd = open("/dev/net/tun", O_RDWR);
// Returns -1, errno = ENODEV

expected output

open: No such device (ENODEV)

Fix

Load the required kernel module

WHEN When the driver for the device is not loaded

Load the required kernel module
sudo modprobe tun
# Verify:
lsmod | grep tun
# Now open /dev/net/tun again

Why this works

modprobe loads the kernel module that registers the device with the kernel. After loading, the device is available.

Sources
Official documentation ↗

Linux Programmer Manual errno(3)

modprobe(8)

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Linux / POSIX errors