No Such Device or Address
Production Risk
Indicates missing hardware or unloaded driver — cannot be resolved in software alone.
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.
- 1Accessing a character device whose hardware has been removed
- 2Opening a /dev entry for a device driver that is not loaded
- 3Seeking beyond the end of a device
- 4Trying to access a non-existent SCSI device or tape position
Reading from a removed USB serial device.
// C: read from a disconnected device
int fd = open("/dev/ttyUSB0", O_RDWR);
char buf[64];
read(fd, buf, 64);
// Returns -1, errno = ENXIOexpected 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
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.
✕ 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.
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev