EMEDIUMTYPE
Linux / POSIXERRORNotableDeviceHIGH confidence

Wrong Medium Type

Production Risk

Hardware compatibility issue; verify media type matches device specifications.

What this means

EMEDIUMTYPE (errno 124) is returned when the wrong type of media is inserted in a device — for example, inserting a DVD in a drive that only supports CDs.

Why it happens
  1. 1Inserting DVD-R media into a CD-only drive
  2. 2Wrong tape type for a tape drive
  3. 3Incompatible media format for the device
How to reproduce

open() when media type does not match device capabilities.

trigger — this will error
trigger — this will error
// Wrong media type for device
int fd = open("/dev/sr0", O_RDONLY);
// Returns -1, errno = EMEDIUMTYPE

expected output

open: Wrong medium type (EMEDIUMTYPE)

Fix

Use compatible media for the device

WHEN When EMEDIUMTYPE is returned

Use compatible media for the device
# Check device capabilities
udevadm info /dev/sr0 | grep -i cdrom
# Use media type that matches device capabilities

Why this works

Check device documentation for compatible media types; use udevadm to query capabilities.

Sources
Official documentation ↗

Linux Programmer Manual errno(3)

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

← All Linux / POSIX errors