Skip to content

Instantly share code, notes, and snippets.

@richlander
Last active March 24, 2024 14:54
Show Gist options
  • Star 77 You must be signed in to star a gist
  • Fork 17 You must be signed in to fork a gist
  • Save richlander/467813274cea8abc624553ee72b28213 to your computer and use it in GitHub Desktop.
Save richlander/467813274cea8abc624553ee72b28213 to your computer and use it in GitHub Desktop.
Installing .NET Core 3.0 on Linux ARM64

Installing .NET Core on Linux ARM64

The following intructions can be used to install .NET Core on Linux ARM64.

Pro tip: Check out .NET Core Docker files to determine the exact instructions for installing .NET Core builds, for example .NET Core 3.1 ARM32 SDK Dockerfile.

Installing .NET Core Globally

The following instructions install the latest .NET Core globally. It isn't required to do that, but it provides the best experience.

curl -SL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-arm64.tar.gz
sudo mkdir -p /usr/share/dotnet
sudo tar -zxf dotnet.tar.gz -C /usr/share/dotnet
sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet

Dependencies

.NET Core has the following dependencies, on Ubuntu (other distros will vary):

  • libc6
  • libgcc1
  • libgssapi-krb5-2
  • libicu60
  • liblttng-ust0
  • libssl1.0.0
  • libstdc++6
  • zlib1g

Trying out .NET Core

The following steps can be used to try out .NET Core.

dotnet new console -o app
cd app
dotnet run

Other software

Copy link

ghost commented Sep 22, 2019

I can confirm. Doesn't compile or run on arm64
admin@pi5:~ $ curl -SL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-arm64.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 110M 100 110M 0 0 7497k 0 0:00:15 0:00:15 --:--:-- 8154k
admin@pi5:~ $ sudo mkdir -p /usr/share/dotnet
admin@pi5:~ $
admin@pi5:~ $ sudo tar -zxf dotnet.tar.gz -C /usr/share/dotnet
admin@pi5:~ $ sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
admin@pi5:~ $ dotnet new console -o app
-bash: /usr/bin/dotnet: cannot execute binary file: Exec format error

Hi, is there any script that works on Raspberry Pi 4?

I tried to run this on my brand new Pi 4 but it doesn't work.

Any help is welcome.

Copy link

ghost commented Sep 22, 2019

Very strange error when running as root:
admin@pi5:~ $ sudo dotnet console -o app
/usr/bin/dotnet: 1: /usr/bin/dotnet: ELF??2@@?@8: not found
/usr/bin/dotnet: 2: /usr/bin/dotnet: @!: not found
/usr/bin/dotnet: 2: /usr/bin/dotnet: : not found
/usr/bin/dotnet: 2: /usr/bin/dotnet: Q?t?R?t??A?/lib/ld-linux-aarch64.so.1GNUGNU~??pEϖ???bq?: not found
/usr/bin/dotnet: 3: /usr/bin/dotnet: Syntax error: ")" unexpected
admin@pi5:~ $

@WrongBit
Copy link

I got same "Exec format error" as scotdwg. What "other" ARM64-linux exists that binaries do not work on standard Raspbian?

@edyesaro
Copy link

I got same "Exec format error" as scotdwg. What "other" ARM64-linux exists that binaries do not work on standard Raspbian?

Try install for 32bit
curl -SL -o dotnet.tar.gz https://download.visualstudio.microsoft.com/download/pr/8ddb8193-f88c-4c4b-82a3-39fcced27e91/b8e0b9bf4cf77dff09ff86cc1a73960b/dotnet-sdk-3.0.100-linux-arm.tar.gz
sudo mkdir -p /usr/share/dotnet
sudo tar -zxf dotnet.tar.gz -C /usr/share/dotnet
sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet

@WrongBit
Copy link

@edyesaro: thank you! Your solution works, but requires clarification: As I understood, Raspbian OS is 32-bit ONLY(!) and even for ARM64 devices like RaspberryPI 3 you still need to install 32-bit programs. :(

@martijnvanschie
Copy link

Have the same issue... Got myself a raspberry pi 4 with a, what I thought 64bit ARM. But the above 64 script does not work. Also dont understand why the 64 version does not work.

I will try the 32bit version and post the results later.

@martijnvanschie
Copy link

Yep... 32 bit version it is...

Oh and another thing... Downloading the "latest" version as stated above you will now get version 5.0+ which is not always what you want.

@CarolEidt
Copy link

I have been able to successfully install a 64-bit Ubuntu 18.04 using the instructions here: https://jamesachambers.com/raspberry-pi-4-ubuntu-server-desktop-18-04-3-image-unofficial/. It's a bit painful because you have to use a raspbian image to update the firmware, but it works.

@Altologic
Copy link

Altologic commented Nov 8, 2019

You can now get an official 64-bit Ubuntu 19.10 Preinstalled Server image for Raspberry Pi 4 from: https://ubuntu.com/download/iot/raspberry-pi . After installing Ubuntu 19.10, on my Pi 4, I was able to install dependencies, proceed to manually install the .NET Core 3.0 ARM64 binary and make/run Console app successfully. Prior to installing Ubuntu, I did use the 32-bit Raspbian image to update the Pi 4 firmware.

@fegrimaldi
Copy link

Here is the direct download link for the dotnet sdk version 3.0.100: https://download.visualstudio.microsoft.com/download/pr/cbc83a0e-895c-4959-99d9-21cd11596e64/b0e59c2ba2bd3ef0f592acbeae7ab27d/dotnet-sdk-3.0.100-linux-arm64.tar.gz. On a Pi3 running Ubuntu 19.10, I used wget to pull this file down and then followed all the other instructions on this page. Worked like a charm.

@SylvainDevidal
Copy link

SylvainDevidal commented Nov 22, 2019

When I run this :

dotnet new console -o app
cd app
dotnet run

I get this…

freebox@drive:~$ dotnet new console -o app

Welcome to .NET Core 5.0!
---------------------
SDK Version: 5.0.100-alpha1-015756

Telemetry
---------
The .NET Core tools collect usage data in order to help us improve your experience. The data is anonymous. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
Getting ready...
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on app/app.csproj...
  Restore completed in 10.69 sec for /home/freebox/app/app.csproj.

Restore succeeded.

freebox@drive:~$ cd app
dotnet runfreebox@drive:~/app$ dotnet run
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.0-preview1.19506.1' was not found.
  - The following frameworks were found:
      5.0.0-alpha.1.19564.1 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The specified framework can be found at:
  - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0-preview1.19506.1&arch=arm64&rid=debian.10-arm64
freebox@drive:~/app$

What is that version 5 ? And why the created application targets version 3.1.0 as the Template project is shipped with that version 5 ???

@pkese
Copy link

pkese commented Nov 25, 2019

Raspbian is a 32-bit OS (they are keeping it 32-bit because they don't wan't to have to respond to questions like "why doesn't the latest Raspbian work on my old Raspberry Pi 1.0").
Even if you install 64-bit Raspbian kernel, the userspace is still 32-bit, so no, 64-bit dotnet won't work there and this is not a problem of dotnet.

If you wish to test on 64-bits, then it is probably best to install Ubuntu.

Copy link

ghost commented Dec 19, 2019

Same issue here. Target framework set to netcoreapp3.0.. but dotnet --version returns 5.0.100-alpha1-016050

Funnily enough.. setting netcoreapp5.0 actually works. :)

Screenshot_20191219_140721

@richlander
Copy link
Author

I updated the gist to resolve a bunch of the issues raised. Thanks!

@bitsmaker
Copy link

Followed the instructions and getting this when I run dotnet in my cross-compiler shell

dotnet
/lib/ld-linux-aarch64.so.1: No such file or directory

@waheedrafiq
Copy link

Hi guys I am getting the following error when i run sudo dotnet new console -o app :

linaro@tinkerboard:/usr/bin$ dotnet
-bash: /usr/bin/dotnet: cannot execute binary file: Exec format error
linaro@tinkerboard:/usr/bin$ sudo dotnet new console
/usr/bin/dotnet: 1: /usr/bin/dotnet:ELF▒▒2@@▒@8: not found
PuTTY/usr/bin/dotnet: 2: /usr/bin/dotnet: @!: not found
/usr/bin/dotnet: 3: /usr/bin/dotnet: $9@GPZkv}▒▒b▒▒▒: not found
/usr/bin/dotnet: 4: /usr/bin/dotnet: ▒: not found
/usr/bin/dotnet: 5: /usr/bin/dotnet: ▒: not found
/usr/bin/dotnet: 6: /usr/bin/dotnet: ▒: not found
/usr/bin/dotnet: 7: /usr/bin/dotnet: ▒: not found
/usr/bin/dotnet: 7: /usr/bin/dotnet: Syntax error: Unterminated quoted string
linaro@tinkerboard:/usr/bin$

the process i am running is armv71 on my Asus TinkerBoard has anyone manage to fix this issue or is there something that I can try

Thanks

@waheedrafiq
Copy link

waheedrafiq commented Jul 2, 2020

Hi Senior developers

Looks like I fix my issue for some reason you have to use the export command please follow this website tutorial to find out how to install .netcore on armv71 [.netcore]()

@AdiSegev
Copy link

AdiSegev commented Jul 7, 2020

Hi,

I need to run an exe file on an arm base device.

Can I do it with .NET core?

How can I do it after I download and install .NET core?

@chamaraonline
Copy link

chamaraonline commented Jul 21, 2020

.NET Core SDK
Version: 3.1.302

Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: linux-arm64
Base Path: /usr/share/dotnet/sdk/3.1.302/

MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
Microsoft.Build.BackEnd.NodeFailedToLaunchException: No such file or directory
---> System.ComponentModel.Win32Exception (2): No such file or directory

@ShikiSuen
Copy link

ShikiSuen commented Jul 22, 2020

@NessInOnett

Sorry for running out of topic, but could you please tell me which linux distro & desktop environment are you using?

@waheedrafiq
Copy link

waheedrafiq commented Jul 22, 2020 via email

@resistancelion
Copy link

.NET Core SDK
Version: 3.1.302

Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: linux-arm64
Base Path: /usr/share/dotnet/sdk/3.1.302/

MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
Microsoft.Build.BackEnd.NodeFailedToLaunchException: No such file or directory
---> System.ComponentModel.Win32Exception (2): No such file or directory

similar error on ubuntu 19 arm64...

@brianpopow
Copy link

the link to the .Net Core 3.1 ARM Dockerfile seems to be broken, it should be: https://github.com/dotnet/dotnet-docker/blob/master/src/sdk/3.1/bionic/arm32v7/Dockerfile

@Spongman
Copy link

i'm running arm64 ubuntu, why don't the regular ubuntu instructions just work?

@ryanbuening
Copy link

@richlander I did these steps

curl -SL -o dotnet.tar.gz https://dotnetcli.blob.core.windows.net/dotnet/Sdk/master/dotnet-sdk-latest-linux-arm64.tar.gz
sudo mkdir -p /usr/share/dotnet
sudo tar -zxf dotnet.tar.gz -C /usr/share/dotnet
sudo ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet
dotnet --version
6.0.100-preview.3.21168.18

and dotnet --version reported 6.0.100-preview.3.21168.18. Is there a way to get the latest non-preview version 6.0.201?

@ryanbuening
Copy link

@ksandaru
Copy link

ksandaru commented Jul 9, 2022

DO anyone know the supported .Net core version and how it can be installed on Raspberry pi 3 model B 64bit ARM running with Raspbian os 11?
I already installed .Net core 6.0, but CLI can not identify it when I run

dotnet

@richlander
Copy link
Author

Can you open an issue at dotnet/sdk and CC me?

@ksandaru
Copy link

ksandaru commented Jul 9, 2022

Can you open an issue at dotnet/sdk and CC me?

Sure. Thanks

@Hanprogramer
Copy link

Can this be used in Android?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment