How to Hold a Package in Debian/Ubuntu with apt-mark hold
Sometimes a software update breaks things. You finally have a working version of an application (like VS Code 1.128.0), but apt upgrade wants to pull in a newer buggy version.
This is exactly when you should hold the package.
What Does “Holding a Package” Mean?
Holding a package tells APT (the package manager used by Debian, Ubuntu, Linux Mint, Pop!_OS, etc.) to ignore newer versions of that specific package during upgrades.
The package stays at its current version until you manually remove the hold.
Why Should You Use apt-mark hold?:
- Prevents automatic upgrades that break your workflow (very common with VS Code, NVIDIA drivers, browsers, etc.)
- Lets you keep the rest of your system fully updated and secure
- Gives you control and time to test newer versions safely
- Reversible — you can unhold anytime
- Very lightweight and built into APT
When Should You Hold a Package?:
- A recent update is causing crashes (like VS Code 1.129.0 on Debian Trixie)
- You need stability for development tools or critical software
- You’re waiting for a fix from the developers
- You prefer a specific version that works well with your setup
Step 1: Hold the Package
To hold a package (example: code for VS Code):
sudo apt-mark hold code
Verify the Hold
apt-mark showhold
You should see code in the output.
Step 2: Upgrade Other Packages Safely
Now you can update your entire system without touching the held package:
sudo apt update
sudo apt upgrade
APT will skip the held package and show it as “kept back”.
Step 3: Remove the Hold (When Ready)
When a stable version is released and you want to update:
sudo apt-mark unhold code
sudo apt upgrade
Useful Related Commands
| Command | Purpose |
|---|---|
apt-mark hold <package> |
Hold a package |
apt-mark unhold <package> |
Remove hold |
apt-mark showhold |
List all held packages |
apt-mark showmanual |
Show manually installed packages |
Example: Holding VS Code
# Hold VS Code
sudo apt-mark hold code
# Check status
apt-mark showhold
# Safely update everything else
sudo apt update
sudo apt upgrade
Conclusion
Using apt-mark hold is a smart and simple way to maintain system stability without sacrificing security updates for other packages.
It’s especially useful for tools like VS Code, Google Chrome, NVIDIA drivers, or any software where updates sometimes introduce regressions.
Pro Tip: After holding a package, keep an eye on the project’s release notes so you know when it’s safe to unhold and upgrade.
Happy Linuxing!

