Why VS Code Wasn’t Updating on Ubuntu (and the surprisingly annoying fix)

I ran into something recently that felt simple on the surface but turned into a bit of a rabbit hole: VS Code just… wasn’t updating.

No errors. No warnings. Just silently stuck on an old version while everything else on the system updated fine. And every time I started VSCode it said “There is a new version available! Would you like to update?” And I would run apt update, but it didn’t update VS Code.

If you’re here, you’re probably in the same situation. Here’s what was actually going on, and how to fix it while preserving your current vscode config.


The symptom

Everything looks normal:

sudo apt update
sudo apt upgrade

But VS Code never shows up in the upgrade list.

If you check it directly:

apt policy code

you might see something like:

code/now ... [installed,local]

That little [installed,local] turns out to matter a lot.


First problem: it wasn’t really “installed” the right way

If you installed VS Code by downloading a .deb from the website, Ubuntu installs it—but it doesn’t tie it to any repository. And you probably did because THATS WHAT IS RECOMMENDED ON THE WEBSITE!!!. Remember, Microsoft secretly hates linux

So from apt’s point of view:

  • it exists
  • but there’s nowhere to check for updates

That’s why nothing happens when you upgrade.

The fix is simple:

sudo apt remove code

and then reinstall it properly from Microsoft’s repo (we’ll get there in a second).


Second problem: the repo key silently failed

This part is subtle.

When you add the Microsoft repo, you’re supposed to fetch their signing key. On paper, it looks like a one-liner. In reality, mine failed like this:

gpg: no valid OpenPGP data found.

Which basically means: you didn’t actually get a key.

Because of that, apt refuses to trust the repo and throws this:

NO_PUBKEY EB3E94ADBE1229CF

At this point, you can add the repo all you want—nothing will install.

What worked for me was skipping the download and pulling the key directly from a keyserver:

gpg --keyserver keyserver.ubuntu.com --recv-keys EB3E94ADBE1229CF
gpg --export EB3E94ADBE1229CF | sudo tee /usr/share/keyrings/microsoft.gpg >/dev/null

Then add the repo and move on.


Third problem (the one that made this painful): IPv6

Even after fixing the repo and the key, installing VS Code still failed—but in a completely different way.

The download would start… and then die halfway through with something like:

Error reading from server ... [IP: 2620:...]

That IP is IPv6.

What was happening:

  • Ubuntu prefers IPv6 by default
  • my network (likely VPN-related) didn’t handle IPv6 properly
  • downloads would randomly break mid-transfer

This is the kind of issue that doesn’t look like a network problem until you notice the IP.

Forcing IPv4 fixed it immediately:

sudo apt -o Acquire::ForceIPv4=true install code

After that, everything worked.

I made it permanent so I don’t have to think about it again:

echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4

Where I landed

After all of that, this finally worked the way it should:

sudo apt update
sudo apt upgrade

And apt policy code now shows it coming from Microsoft’s repo instead of “local.”


What this really was

This wasn’t one bug—it was three small things stacking:

  • VS Code installed outside of apt → no updates
  • repo key silently failed → repo unusable
  • IPv6 issues → downloads failing

Each one by itself is manageable. Together, they make it feel like nothing works.


Quick sanity check if you’re debugging this

If you’re dealing with the same issue, check these in order:

  1. Does apt policy code say [installed,local]?
  2. Do you see a NO_PUBKEY error when running apt update?
  3. Are downloads failing with an IPv6 address in the error?

Those three answers will usually tell you exactly where things are breaking.


Final thought

This is one of those problems where everything looks fine until you dig a little deeper. If VS Code isn’t updating on Ubuntu, don’t assume it’s just one thing—it’s often a chain of small issues.

Hopefully this saves you an hour or two.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *