LinuxCommandLibrary

apt-cdrom

Add a CD-ROM as an APT source

SYNOPSIS

apt-cdrom [options] command

PARAMETERS

add
    Adds a CD-ROM to APT's list of package sources, scanning it for packages and updating sources.list.

ident
    Identifies the CD-ROM in the drive and prints its unique identity string.

list
    Lists all CD-ROMs currently known to APT from its sources.list configuration.

-h, --help
    Displays a short help message and exits.

-v, --version
    Shows the program version and exits.

-c, --config-file
    Specifies an alternative configuration file to use instead of the default.

-o, --option =
    Sets a specific APT configuration option directly. Can be used multiple times.

-d, --cdrom
    Specifies the mount point for the CD-ROM/DVD drive, overriding auto-detection.

-r, --rename
    Allows renaming an existing CD-ROM entry in the sources list to a new descriptive name.

-m, --mount
    Attempts to mount the CD-ROM if it's not already mounted at the specified or default mount point.

-f, --fast
    Optimizes the scanning process by assuming package lists on the CD-ROM are sorted, leading to faster indexing.

-a, --thorough
    Performs a complete and comprehensive scan of every package on the CD-ROM, which is slower but ensures all packages are found.

-n, --no-act
    Performs a 'dry run' without actually writing any changes to the sources.list file.

-D, --debug
    Enables debugging output for specific internal components of apt-cdrom.

--id
    When used with the 'add' command, explicitly sets the identity string for the CD-ROM rather than auto-detecting it.

--passphrase
    When used with 'add', provides a GPG passphrase if the CD-ROM repository is signed and requires authentication.

--with-source
    When used with 'add', also includes source package URIs for the CD-ROM in sources.list.

--no-auto-detect
    Prevents apt-cdrom from attempting to auto-detect the CD-ROM device path, requiring the mount point to be specified with -d.

DESCRIPTION

apt-cdrom is a utility within the APT (Advanced Package Tool) suite designed to add a CD-ROM or DVD as a source for APT's package management system. When executed, it scans the inserted disc for valid package files (typically located in the dists/ directory), identifies the distribution and components, and then automatically appends an entry for the CD-ROM to APT's /etc/apt/sources.list file or a file within the /etc/apt/sources.list.d/ directory. This allows package managers like apt, apt-get, and aptitude to locate and install software directly from the physical media. It is particularly useful for offline installations, systems with limited internet access, or for using official distribution media as a local repository. After successfully adding a disc, it's essential to run apt update to refresh the package cache, making the newly available packages discoverable.

CAVEATS

apt-cdrom typically requires root privileges (or sudo) to modify system configuration files like /etc/apt/sources.list. After successfully adding a CD-ROM source, it is crucial to execute apt update (or apt-get update) to refresh the package cache and make the packages from the CD-ROM discoverable by APT. The command expects a standard Debian package repository structure on the disc. Its utility has significantly decreased in modern computing environments due to widespread internet access, as most users now rely on network repositories for software updates and installations.

SOURCES.LIST ENTRY

When a CD-ROM is successfully added, apt-cdrom creates an entry in /etc/apt/sources.list or a dedicated file in /etc/apt/sources.list.d/. This entry typically looks like deb cdrom:[Debian GNU/Linux 11.5.0 _Bullseye_ - Official amd64 DVD Binary-1 20220910-10:48]/ bullseye main contrib, allowing APT to recognize the CD-ROM as a valid package source when mounted.

OFFLINE USAGE

Despite its declining general use, apt-cdrom remains valuable for air-gapped systems or environments with extremely limited internet connectivity. It provides a reliable mechanism to install base systems and essential packages directly from official distribution media without requiring an active network connection.

HISTORY

apt-cdrom is a long-standing component of the APT (Advanced Package Tool) suite, which was first developed for Debian in the late 1990s. Its primary role was to enable offline installations and updates from physical distribution media (CD-ROMs and later DVDs). In an era before pervasive high-speed internet, this was a critical feature for deploying and maintaining Debian-based systems, especially in areas with limited connectivity. While still functional and maintained, its usage has significantly diminished as network-based package repositories have become the dominant method for software distribution and updates.

SEE ALSO

apt(8), apt-get(8), sources.list(5), mount(8)

Copied to clipboard