apt-mark
Mark/unmark packages for specific apt operations
TLDR
Mark a package as automatically installed
Hold a package at its current version and prevent updates to it
Allow a package to be updated again
Show manually installed packages
Show held packages that aren't being updated
SYNOPSIS
apt-mark {auto | manual | hold | unhold | showauto | showmanual | showhold} [options] {pkg ... | regexp ...}
apt-mark [--help | --version]
PARAMETERS
auto <pkg...>
Marks the specified packages as automatically installed. These packages can later be removed by apt autoremove if no longer needed by manually installed packages.
manual <pkg...>
Marks the specified packages as manually installed. This prevents apt autoremove from suggesting their removal, even if they are no longer dependencies.
hold <pkg...>
Places the specified packages on hold. A held package cannot be upgraded, installed, or removed by APT until it is unheld. This is useful for preventing unwanted changes.
unhold <pkg...>
Removes the hold mark from the specified packages, allowing APT to manage them normally again (upgrade, install, remove).
showauto
Lists all packages that are currently marked as automatically installed.
showmanual
Lists all packages that are currently marked as manually installed.
showhold
Lists all packages that are currently on hold.
--help
Displays a short usage summary and exits.
--version
Displays the program version and exits.
-q, --quiet
Suppress progress indicators and other verbose output.
--config-file <file>
Specify a configuration file to use instead of the default.
-o, --option <opt>
Set a configuration option. For example, -o Dpkg::Options::="--force-confdef".
DESCRIPTION
apt-mark is a command-line utility within the APT (Advanced Package Tool) suite, used to manage special settings, or "marks," for installed packages. Its primary functions include marking packages as automatically or manually installed, which influences whether apt autoremove will consider them for removal. It also allows users to hold packages, preventing them from being upgraded, installed, or removed, and to unhold them. This tool provides fine-grained control over how individual packages are managed by the APT system, offering a simplified interface compared to direct manipulation of package selection states. It plays a vital role in maintaining a clean and efficient system by managing dependencies effectively.
CAVEATS
Hold state: A package placed on hold will not be upgraded, installed, or removed by apt until the hold is explicitly removed. This is a powerful feature for maintaining specific package versions.
Permissions: Modifying package states (auto, manual, hold, unhold) requires root privileges (e.g., using sudo). Displaying states (showauto, showmanual, showhold) typically does not.
INTERACTION WITH <I>APT AUTOREMOVE</I>
The auto and manual marks are fundamental to the behavior of the apt autoremove command. When a package is installed as a dependency (e.g., required by another package), it's usually marked auto. If the dependent package is later removed, and no other manually installed packages require it, apt autoremove will identify and suggest removing this 'orphaned' auto-marked package to free up disk space. Conversely, explicitly marking a package as manual ensures that it is always treated as an essential component, preventing autoremove from ever suggesting its removal, regardless of its dependency status.
HISTORY
apt-mark is a more recent addition to the APT toolkit, developed to simplify and standardize the management of package installation states. Prior to its introduction, similar functionalities for managing hold states were often performed using dpkg --set-selections. apt-mark provides a more intuitive and direct interface for these common tasks, aligning with the broader goal of the apt command to offer a user-friendly, unified frontend for package management on Debian-based systems.