locked Microsoft repo added in latest Raspberry Pi OS update


Basil Gunn
 

In case you noticed some discussion on other forums about a recent
update the Raspberry Pi Foundation made that installed a Microsoft apt
repository, here is some information.

You can view the reddit discussion here:

https://www.reddit.com/r/linux/comments/lbu0t1/microsoft_repo_installed_on_all_raspberry_pis/

If you do an 'apt-get update' and see the Microsoft package line then
you already have the update with the added repository which looks like
this:

sudo apt-get update
Hit:1 http://packages.microsoft.com/repos/code stable InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian buster InRelease
Hit:3 http://archive.raspberrypi.org/debian buster InRelease
Reading package lists... Done

This is what an apt-get update looks like without the Microsoft package
repo:

sudo apt-get update
Hit:1 http://archive.raspberrypi.org/debian buster InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian buster InRelease
Reading package lists... Done

I personally do not want to access a Microsoft server every time I do an
update on my RPi and I really don't want it on my headless units so I
wrote a script that removes that "feature". For more information please
look at the reddit link above.

My script lives here:
https://github.com/nwdigitalradio/n7nix/blob/master/bin/block_msvscode.sh

Get the script in the usual manner:

cd
cd n7nix
git pull
cd config
./bin_refresh.sh

When running the script with an argument it displays the status of the
Microsoft config without editing any files. This is what it will display
if you have the Microsoft "feature".

cd
cd n7nix/bin

./block_msvscode.sh -
Test if Microsoft repo has been configured
File: /etc/hosts has NOT been edited
File: /etc/apt/trusted.gpg.d/microsoft.gpg exists and is NOT empty
File: /etc/apt/sources.list.d/vscode.list IS active

If you run the script without any arguments it will edit 3 files which
will block the Microsoft Visual Studio repository update.

./block_msvscode.sh
Test if Microsoft repo has been configured
Microsoft gpg key or repository entry IS active
0.0.0.0 packages.microsoft.com
Removing Microsoft key
removed '/etc/apt/trusted.gpg.d/microsoft.gpg'
Making new empty Microsoft key file
Verify Microsoft gpg file is protected
----i---------e---- /etc/apt/trusted.gpg.d/microsoft.gpg
Modifying Microsoft APT file


After running the script, status should look like this

./block_msvscode.sh -
Test if Microsoft repo has been configured
File: /etc/hosts OK, has been edited
File: /etc/apt/trusted.gpg.d/microsoft.gpg exists but IS empty
File: /etc/apt/sources.list.d/vscode.list is NOT active

/Basil n7nix

Join udrc@nw-digital-radio.groups.io to automatically receive all group messages.