ENXIO
Linux / POSIXERRORNotableDeviceHIGH confidence

No Such Device or Address

Production Risk

Indicates missing hardware or unloaded driver — cannot be resolved in software alone.

What this means

ENXIO (errno 6) is returned when a device or address does not exist at the kernel level, or when trying to access a device file that references hardware no longer present. It differs from ENODEV in that ENXIO also applies to specific I/O addresses.

Why it happens
  1. 1Accessing a character device whose hardware has been removed
  2. 2Opening a /dev entry for a device driver that is not loaded
  3. 3Seeking beyond the end of a device
  4. 4Trying to access a non-existent SCSI device or tape position
How to reproduce

Reading from a removed USB serial device.

trigger — this will error
trigger — this will error
// C: read from a disconnected device
int fd = open("/dev/ttyUSB0", O_RDWR);
char buf[64];
read(fd, buf, 64);
// Returns -1, errno = ENXIO

expected output

read: No such device or address (ENXIO)

Fix

Verify the device is present and driver loaded

WHEN When opening or reading from a device node

Verify the device is present and driver loaded
ls -l /dev/ttyUSB0    # check node exists
lsusb              # confirm hardware present
lsmod | grep usbserial  # verify driver loaded

Why this works

ENXIO from a /dev node means either the hardware is absent or the driver is not loaded. Plug in the device or modprobe the driver.

What not to do

Retry ENXIO in a tight loop

The device is physically absent. Polling wastes CPU — use udev events or inotify on /dev to detect device arrival.

Sources

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

← All Linux / POSIX errors