hippy
Posts: 6069
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Installing VS Code on Raspbian Buster

Mon Aug 21, 2017 4:31 pm

The following sequence installs the pre-built Visual Studio Code editor binary (code-oss) provided by Headmelted on a Pi 3B.

My own last verification of the procedure described working was on 11th of March 2019, on a Pi 3B running Raspbian Stretch.

However, due to a variety of ongoing issues with the Headmelted releases I have now taken to using the Steve Desmond release as detailed in later posts.

The Steve Desmond release works on Buster as well as Stretch.

This post should therefore now be considered as a historical document.

1) Install GPG key

Code: Select all

sudo wget -qO - https://packagecloud.io/headmelted/codebuilds/gpgkey | sudo apt-key add -;
2) Add source repository

Code: Select all

sudo nano /etc/apt/sources.list
and add ...

Code: Select all

deb https://packagecloud.io/headmelted/codebuilds/raspbian/ jessie main
Ctrl-X, Y, enter to exit 'nano' and save the updated file.

Note it should be "jessie" even when using "stretch".

3) Install VS Code (code-oss)

Code: Select all

sudo apt-get update
sudo apt-get install code-oss
Note the "sudo apt-get update" is essential. Failing to do that will result in an "E: Unable to locate package code-oss" error.

Note that "sudo apt-get update" from now on will will show entries for
"packagecloud.io/headmelted/codebuilds/raspbian", and
"packages.microsoft.com/repos/vscode".

4) Launching VS Code (code-oss)

Under the Pi desktop start menu, under Programming, there should now be a "Code - OSS" link.

VS Code can also be launched from the command line with -

Code: Select all

code-oss

5) VS Code Version

This guide installs version 1.14.0 of code-oss ( as of 2019-03-11 ) which does not appear to be the latest version - The reason for this will need to be investigated.

The version number of what is currently installed can be determined from within VS Code using the Help then About menu options, or from the command line with -

Code: Select all

code-oss -version

6) Black Window Issue

When VS Code first starts, and particularly immediately after its installation, it will display a blank black window for a good few seconds before it fills its window with a list of keyboard command options.

VS code ( and code-oss ) have experienced 'black window' issues where that is all one gets. The 1.14 version currently installed ( as of 2019-03-11 ) does not appear to have have such issues; just leave it for a few seconds before expecting it to be ready for use.

7) Links

Headmelted home page : https://code.headmelted.com
Package releases : https://packagecloud.io/headmelted/codebuilds
GPG key from : https://packagecloud.io/headmelted/codebuilds/gpgkey

8) Edit History

2017-08-21 : Original post
2018-05-30 : Added note about using "Jessie" in the sources.list
2019-01-12 : Added note about "sudo apt-get update" being essential
2019-01-12 : Added note about launching from command line
2019-01-12 : Verified as working on Pi 3B, Raspbian Stretch
2019-03-11 : Added note about Microsoft packages on apt-get update
2019-03-11 : Added section on version number
2019-03-11 : Added section on 'black window' issue
2019-03-11 : Verified as working on Pi 3B, Raspbian Stretch
2019-03-11 : Gave up on Headmelted, using Steve Desmond's release instead
2019-09-18 : Confirmed Steve Desmond's 1.28.2 working on Pi 3B under Buster
2019-10-20 : Updated title to include Buster.
Last edited by hippy on Sun Oct 20, 2019 1:13 pm, edited 14 times in total.

Heater
Posts: 13602
Joined: Tue Jul 17, 2012 3:02 pm

Re: Installing VS Code on Raspbian Stretch

Mon Aug 21, 2017 5:36 pm

That's fantastic. How does it perform. I might give it a go.

If VS Code runs on the Pi that means Electron does. Is there a running Electron anywhere?
Memory in C++ is a leaky abstraction .

hippy
Posts: 6069
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Installing VS Code on Raspbian Stretch

Mon Aug 21, 2017 6:26 pm

VS Code seems reasonably sprightly.

I'm not familiar with electron but there does seem to be a /usr/lib/electron (v1.6.2) which may be of interest. Not sure.

Dougi
Posts: 2
Joined: Mon Feb 12, 2018 10:16 am

Re: Installing VS Code on Raspbian Stretch

Wed Apr 11, 2018 7:08 am

Thanks for the post. Sounds really cool. However, I can't seem to get it to work.

I followed the instructions to the letter and it all looks as if it should have worked perfectly. I can see the "Code - OSS" menu item etc. However, when I actually click the menu item I see the hour glass as if it's doing something for a 5 or so seconds and then the hour glass just disappears and nothing more happens.

I am on a Pi Zero running Raspbian 9 (Stretch)

Any idea whats going on by any chance please? Have others had this issue?

Thanks very much!

hippy
Posts: 6069
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Installing VS Code on Raspbian Stretch

Wed Apr 11, 2018 8:58 am

Dougi wrote:
Wed Apr 11, 2018 7:08 am
I am on a Pi Zero running Raspbian 9 (Stretch)
I have a vague recollection that Headmelted's VS Code only runs on a Pi 3B ( and presumably later ). I recall wasting time and struggling to get something which worked on a 3B running on a Zero W and/or B+ and it would not; I have a feeling it may have been this.

That I only mention 3B in the OP suggests it did not work on the Zero W or B+ because I usually test things I document here on everything I have. I likely did not say "only 3B" because I wasn't sure if it should work on others or not.

Perhaps open a Terminal and try launching it from there: code-oss

That may reveal some error message the GUI launcher is hiding or give some clue as to why it fails to run.

Nightlock
Posts: 1
Joined: Fri Mar 08, 2019 1:44 am

Re: Installing VS Code on Raspbian Stretch

Fri Mar 08, 2019 1:48 am

Thanks a lot for this step by step. Now I can get to work on my project ideas in my code editor.

jtmoderate876
Posts: 33
Joined: Sat Dec 05, 2015 9:38 pm

Re: Installing VS Code on Raspbian Stretch

Mon Mar 11, 2019 2:37 am

@hippy - thanks for maintaining the:
6) Edit History
section in your first post!
Awesome to see, right away, that two years later there is still confirmation that things work (or perhaps someday when they don't).
Thx.

hippy
Posts: 6069
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Installing VS Code on Raspbian Stretch

Mon Mar 11, 2019 2:22 pm

jtmoderate876 wrote:
Mon Mar 11, 2019 2:37 am
@hippy - thanks for maintaining the:
6) Edit History
section in your first post!
Awesome to see, right away, that two years later there is still confirmation that things work (or perhaps someday when they don't).
Thx.
You are welcome. I always find 'last verified as working' useful in any How To guide, as it provides at least some confidence that the instructions are not so outdated as to no longer be usable or useful.

I am not sure if you are also alluding to the recent post which indicates an upgrade has broken VS Code on a Pi -

viewtopic.php?f=28&t=234887

I saw that post, and reinstalled VS Code on a 3B which had never had it installed to see if my instructions still work. They do for me, no black screen. But I did note the version installed is the 1.14.0 version, which is a far earlier version than the above linked thread references, and not the latest version seemingly available from Headmelted.

I am not sure why my instructions get version 1.14.0, not something later, what I need to do to get a later version, why that isn't automatically updating.

I do not know what others who have a later version are using to get that. If there is a better way to do it I'm happy to update this guide. This guide came about because this was the easiest way to get VC Code installed on a Pi at the time.

I guess I'll also be updating the first post with further information for being stuck with the 1.14 version in due course.

Updated : It seems being stuck with version 1.14 is because I am explicitly using a Jessie repository.

There is a newer Stretch repository but running the recommended apt.sh install script fails and trying to manually do what the apt.sh script does also fails. Seems it's still a known issue -

https://github.com/headmelted/codebuilds/issues/58

And I can't even install a downloaded release now as the package seems broken or whatever I tried earlier has trashed my Raspbian installation. I recall these issues, and the utter frustration with trying to get things to work, was why I wrote this guide in the first place.

hippy
Posts: 6069
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Installing VS Code on Raspbian Stretch

Mon Mar 11, 2019 4:45 pm

I think I'm going to throw in the towel with headmelted. His efforts were much appreciated but I just can't consider what he's producing fit for purpose any more. I've wasted too many hours on it.

Steve Desmond has a VS Code version 1.28.2 build for the Pi which 'just works' without faffing about -

Code: Select all

cd ~
wget https://github.com/stevedesmond-ca/vscode-arm/releases/download/1.28.2/vscode-1.28.2.deb
sudo apt install ./vscode-1.28.2.deb
I'll update my instructions later.

Heater
Posts: 13602
Joined: Tue Jul 17, 2012 3:02 pm

Re: Installing VS Code on Raspbian Stretch

Mon Mar 11, 2019 4:58 pm

I will always advise against downloading and installing packages from random, unknown, untrusted sources. It is a huge security risk.

It should be possible to install Visual Studio Code on the Pi from sources, directly from the Microsoft repository on github: https://github.com/Microsoft/vscode

The procedure to do that is short and sweet and described here: "Building Visual Studio Code on a Raspberry Pi 3": https://www.hanselman.com/blog/Building ... ryPi3.aspx

I have not actually tried this yet but I have confidence that it will work.
Memory in C++ is a leaky abstraction .

hippy
Posts: 6069
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Installing VS Code on Raspbian Stretch

Tue Mar 12, 2019 1:12 am

Heater wrote:
Mon Mar 11, 2019 4:58 pm
It should be possible to install Visual Studio Code on the Pi from sources, directly from the Microsoft repository on github: https://github.com/Microsoft/vscode
"Should" being the operative word.
Heater wrote:
Mon Mar 11, 2019 4:58 pm
The procedure to do that is short and sweet and described here: "Building Visual Studio Code on a Raspberry Pi 3": https://www.hanselman.com/blog/Building ... ryPi3.aspx
Rather ironically those instructions require downloading and installing packages from random, unknown, untrusted sources which, as you note, is a huge security risk :roll:
Heater wrote:
Mon Mar 11, 2019 4:58 pm
I have not actually tried this yet but I have confidence that it will work.
Given the problems I and others have had in trying to build it your confidence may be misplaced. I recall it was an absolute nightmare. But if you, or anyone else, do get it to build on a Pi, please do provide the proven and tested step by step guide and I will gratefully add that.

Heater
Posts: 13602
Joined: Tue Jul 17, 2012 3:02 pm

Re: Installing VS Code on Raspbian Stretch

Tue Mar 12, 2019 4:56 am

hippy,
Rather ironically those instructions require downloading and installing packages from random, unknown, untrusted sources which, as you note, is a huge security risk
Only if node-arm.herokuapp.com is deemed untrusted by you.

If so install node.js from nodejs.org itself https://nodejs.org/en/download. A simple script, nvm, makes that very easy: https://github.com/creationix/nvm

Also not using random .deb packages from random, unknown sites means I don't have to install the thing globally with root permissions and there is no chance of it hosing my system. As is often the case with such things.
Given the problems I and others have had in trying to build it your confidence may be misplaced
Your failures say nothing of my competence :)

I have great confidence, Scott Hanselman is a well known and respected engineer. Currently an employee at Microsoft. I feel sure if his instructions don't work he could soon sort them out for us.
Memory in C++ is a leaky abstraction .

hippy
Posts: 6069
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Installing VS Code on Raspbian Stretch

Tue Mar 12, 2019 11:43 am

Heater wrote:
Tue Mar 12, 2019 4:56 am
I have great confidence, Scott Hanselman is a well known and respected engineer. Currently an employee at Microsoft. I feel sure if his instructions don't work he could soon sort them out for us.
As I said; if you, or anyone else, do get it to build on a Pi, please do provide the proven and tested step by step guide and I will gratefully add that. Or you can create your own guide and I can link to that.

This guide was written to give people, who may not have any or much experience with Linux, the step-by-step instructions for installing the VS Code application, tried and tested, with a good degree of certainty that it works. It is intended to be 'this is what to do' not 'this might work, but who knows'.

While the rationale of the Pi is education and learning, it is also about doing and making. I have never been a great believer in people having to go off and learn something they have no interest in learning to do what they actually want to do; learning to drive should not have the prerequisite that one needs to be able to build a car, or its engine, etc.

This guide is intended to let people install VS Code stuff with the minimal amount of fuss so they can get on with using it and doing whatever they want to do with it.

Matha
Posts: 9
Joined: Mon Dec 17, 2012 3:22 pm

Re: Installing VS Code on Raspbian Stretch

Wed Apr 24, 2019 7:00 pm

Appreciate the efforts on all fronts here (and I don't want to get in the fray of sizing whose whatchamacallit is bigger) but just a little feedback here: I'm staring at two blank screens after having dutifully followed the instructions on two RPi3B with basic cut-n-paste operations to avoid fat-fingering.

The installed version of code-oss is reported as 1.32.0.

Thanks again for keeping the information as current as your resources permit. Regards.

hippy
Posts: 6069
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Installing VS Code on Raspbian Stretch

Wed Apr 24, 2019 11:27 pm

Matha wrote:
Wed Apr 24, 2019 7:00 pm
I'm staring at two blank screens[/i] after having dutifully followed the instructions on two RPi3B with basic cut-n-paste operations to avoid fat-fingering.
If that's the head-melted stuff then it is all a bit of a mess. I have thrown the towel in with that and have the Steve Desmond release installed.

hippy
Posts: 6069
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Installing VS Code on Raspbian Stretch

Wed Jun 05, 2019 3:58 pm

WARNING: After installing Headmelted's 1.29 version a 'sudo apt-get update /upgade' pulled in a code-oss upgrade ( presumably 1.32 ) which has the 'black window issue' described earlier which makes VS Code unusable. That may be 'as expected' or may be because of previous things done allowing that automatic upgrade. It is probably best recommended to stick with the Steve Desmond install.

A minor update. It appears that Steve Desmond's VS Code version is staying at 1.28. Headmelted has a 1.29 version which can be installed as follows -

Code: Select all

wget --content-disposition https://packagecloud.io/headmelted/codebuilds/packages/debian/stretch/code-oss_1.29.0-1539702238_armhf.deb/download.deb
sudo apt install ./code-oss_1.29.0-1539702238_armhf.deb
That appears to work for me on a Pi 3B (non-plus) but the later version 1.32 does not (2019-06-05).

Note that what seem to be package files listed on the https://packagecloud.io/headmelted/codebuilds page are not the packages themselves, but links to HTML pages which describe that package. You need to go through those pages to find the package to actually download.

Return to “General discussion”