apt-mark(8)
Mark or unmark packages as automatically or manually installed, or hold them from upgrades.
Synopsis
apt-mark {auto|manual|hold|unhold|showauto|showmanual|showhold} [PACKAGE]...Description
apt-mark changes how apt tracks package installation state. It can mark packages as automatically installed (will be removed if no manual packages depend on them), manually installed (kept unless explicitly removed), or held (pinned at current version, ignored by upgrades).
This tool is essential for managing package dependencies and preventing unwanted upgrades. Use showauto, showmanual, and showhold to view packages in each state.
Common options
| Flag | What it does |
|---|---|
auto | mark packages as automatically installed |
manual | mark packages as manually installed |
hold | prevent packages from being upgraded |
unhold | allow held packages to be upgraded again |
showauto | display all automatically installed packages |
showmanual | display all manually installed packages |
showhold | display all held packages |
-v, --verbose | show detailed output of changes |
Examples
prevent the kernel image from being upgraded automatically
apt-mark hold linux-image-genericallow the kernel image to be upgraded again
apt-mark unhold linux-image-genericlist all packages currently held from upgrades
apt-mark showholdmark curl and wget as automatically installed (candidates for removal)
apt-mark auto curl wgetmark python3-pip as manually installed so it won't be auto-removed
apt-mark manual python3-pipview the first 20 automatically installed packages
apt-mark showauto | head -20mark emacs as manual with verbose output showing the change
apt-mark -v manual emacscount how many packages are manually installed
apt-mark showmanual | wc -l