Why apt upgrade Didn’t Update VS Code (and What Actually Happened)
Problem Statement
sudo apt update
sudo apt upgrade
But Visual Studio Code (Visual Studio Code) remains outdated.
sudo apt install --only-upgrade code
it updates successfully.
This behavior is not accidental. It is a consequence of how APT resolves dependencies under different upgrade strategies.
Key Concept: APT Upgrade Policies
APT provides multiple upgrade strategies with different levels of aggressiveness:
| Command | Behavior |
|---|---|
apt upgrade | Upgrades packages without installing or removing dependencies |
apt full-upgrade | Allows installing/removing dependencies to complete upgrades |
apt install --only-upgrade <pkg> | Forces upgrade of a specific package, allowing dependency resolution |
What Happened in This Case
During the upgrade attempt, APT reported:
The following NEW packages will be installed:
socat
This is the critical detail.
The new version of VS Code introduced a new dependency: socat.
Under apt upgrade, APT refused to proceed because:
- It would require installing a new package (
socat) - This violates the conservative policy of
apt upgrade
As a result:
- VS Code remained at version
1.114.0 - No upgrade occurred
Why --only-upgrade Worked
When you executed:
sudo apt install --only-upgrade code
APT switched to a targeted resolution strategy:
- The goal became: upgrade
code - APT was allowed to:
- Install required dependencies (
socat) - Complete the upgrade
- Install required dependencies (
Result:
code 1.114.0 → 1.117.0
Dependency Evolution in Packages
This situation is common when:
- A package introduces new runtime features
- New dependencies are added in newer versions
In Debian-based systems (like Ubuntu), package metadata defines:
DependsRecommendsSuggests
If a new version modifies Depends, upgrading may require additional packages.
Correct Upgrade Strategies
Safe Global Upgrade
sudo apt upgrade
Use when you want minimal system changes.
Complete System Upgrade
sudo apt full-upgrade
Use when:
- You want all packages updated
- You accept dependency changes
Targeted Package Upgrade
sudo apt install --only-upgrade code
Use when:
- A specific package is blocked
- You want precise control
Verification
After upgrade:
code --version