How to disable the Microsoft repo on the Raspberry Pi

Raspberry Pi
Raspberry Pi (Image credit: Windows Central)

A recent, silent update to the official Raspberry Pi OS that added a Microsoft repo caused a bit of a ruckus among the community, many of whom weren't happy about it being there or the way in which it had been added. Both new images and existing installs ended up with it, and while the official purpose is in relation to Visual Studio Code, the controversy had already set its roots.

This isn't discussing whether it's right or wrong or whether anyone should be worried. The good news, if you're in the camp that doesn't want a Microsoft repo "phoning home" every time you use apt update, the repo can be disabled.

Here's how.

How to disable the Microsoft repo on the Raspberry Pi

Raspberry Pi

Source: Windows Central (Image credit: Source: Windows Central)

The fact the Microsoft repo isn't shown in sources.list might lead you to think you're stuck with it. Fortunately, as long as you know where to look, you can disable the repo and continue using Raspberry Pi OS.

The steps here were carried out on the desktop version of Raspberry Pi OS, but you'll also be able to carry this out if you're running a headless setup and have connected over SSH.

  1. Open up a terminal window.
  2. Enter cd /etc/apt/sources.list.d

Source: Windows Central (Image credit: Source: Windows Central)
  1. Enter sudo ls to check for an item called vscode.list.

Source: Windows Central (Image credit: Source: Windows Central)
  1. Next, enter nano vscode.list to open the file in nano (substitute for your preferred text editor if required).

Source: Windows Central (Image credit: Source: Windows Central)
  1. Comment out the last line of the text file with the Microsoft URL in it.

Source: Windows Central (Image credit: Source: Windows Central)
  1. Save the file and exit the text editor.

Raspberry Pi

Source: Windows Central (Image credit: Source: Windows Central)

Now, run

sudo apt update

and you should no longer see the Microsoft repo being pinged on your Raspberry Pi. If you plan to run Visual Studio Code on your Raspberry Pi at all, however, you should probably leave it alone. Nevertheless, if you really don't want it, you can simply stop it from operating and be on your merry way.

Richard Devine
Managing Editor - Tech, Reviews

Richard Devine is a Managing Editor at Windows Central with over a decade of experience. A former Project Manager and long-term tech addict, he joined Mobile Nations in 2011 and has been found on Android Central and iMore as well as Windows Central. Currently, you'll find him steering the site's coverage of all manner of PC hardware and reviews. Find him on Mastodon at mstdn.social/@richdevine