On Linux operating systems that use the APT package management system, the apt-mark command performs advanced administrative tasks on installed packages. It helps repair a damaged or corrupted local package repository.
Description
The apt-mark tool can change the settings of software packages used by APT.
Description
“Auto” and “manual” marks
“Hold” marks
Selection states
Syntax
Commands
Options
Examples
Related commands
Linux command index
“Auto” and “manual” marks
“Hold” marks
Selection states
Commands
Options
These settings, called “marks”, fall into three general categories:
- “Automatically”, or “manually”, installed.
- “Hold” (held back). Held back packages cannot be installed, removed, purged, or upgraded unless the hold mark is removed.
- Selection states.
“Auto” and “manual” marks
aptitude, the package is marked as manually installed: you explicitly installed it, so the system will not remove it unless you ask for it to be removed.
On the other hand, some packages are installed because they’re dependencies of a package you manually installed. APT marks these dependencies as automatically installed. These packages are marked for auto-removal if they are no longer needed, for instance with apt-get autoremove.
Using apt-mark, you can change how a package is marked, protecting it from (or making it eligible for) auto-removal.
“Hold” marks
If a package is marked “hold”, it is held back: The package cannot be installed, upgraded, or removed until the hold mark is removed.
Selection states
The selection state of a package can be:
- install: this package is marked for installation.
- deinstall (remove): this package is marked for removal.
- purge: this package, and all its configuration files, are marked for removal.
- hold: this package cannot be installed, upgraded, removed, or purged.
Selection states are used internally by APT and dpkg. For more information about setting selection states, see dpkg –set-selections.
Syntax
apt-mark {-c=location} | {-f=filename} | {auto | manual} pkg… | {showauto | showmanual} [pkg…] } | {-v | –version} | {-h | –help} | {hold | unhold | install | remove | purge} pkg… | {showhold | showinstall | showremove | showpurge} [pkg…]
Commands
Options
Examples
sudo apt-mark auto ruby
Mark the software package ruby as automatically installed. When no other software packages depend on it, ruby will be eligible for auto-removal.
sudo apt-mark manual ruby
Mark the software package ruby as manually installed. It is not eligible for auto-removal, even if no other packages depend on it.
apt-mark showinstall
Show all packages with a selection state of “install”.
sudo apt-mark hold emacs
Mark the package emacs as held back. It cannot be installed, upgraded, removed, or purged.
sudo apt-mark unhold emacs
Cancel the hold on emacs.
Related commands
apt — A unified APT front end for the command line.apt-cache — Get information about installed and available APT software packages.apt-get — Download and install APT software packages.aptitude — An enhanced APT front end for the terminal.dpkg — Install, remove, and maintain Debian software packages.