'How to fix "Segmentation fault (core dumped)" when creating new dotnet project?
I am following https://dotnet.microsoft.com/learn/dotnet/hello-world-tutorial/create
When I try to create a project, I get the following:
oskar@oskarslaptop:~/Programming/Resorvoir-CLI$ dotnet new console -o MyApp
Segmentation fault (core dumped)
I have installed dotnet 5.0 via snap using:
sudo snap install dotnet-sdk --classic --channel=5.0
sudo snap alias dotnet-sdk.dotnet dotnet
Snap information:
oskar@oskarslaptop:~/Programming/Resorvoir-CLI$ sudo snap info dotnet-sdk
name: dotnet-sdk
summary: Develop high performance applications in less time, on any platform.
publisher: Microsoft .NET Core (dotnetcore✓)
store-url: https://snapcraft.io/dotnet-sdk
contact: https://dot.net/core
license: unset
description: |
.NET Core is the modular and high performance implementation of .NET for creating web applications
and services that run on Windows, Linux and Mac. It is open source and it can share the same code
with .NET Framework and Xamarin apps.
.NET Core is a .NET Foundation project. https://dotnetfoundation.org/
commands:
- dotnet-sdk.dotnet
snap-id: uHc4y9lWxyqYfxsqcr4xILzAai4L1BHs
tracking: 5.0/stable
refresh-date: today at 13:36 BST
channels:
latest/stable: 5.0.302 2021-07-13 (132) 139MB classic
latest/candidate: ↑
latest/beta: ↑
latest/edge: 5.0.202 2021-04-16 (120) 137MB classic
lts/stable: 3.1.411 2021-07-13 (133) 123MB classic
lts/candidate: ↑
lts/beta: ↑
lts/edge: ↑
6.0/stable: –
6.0/candidate: –
6.0/beta: 6.0.100-preview.6.21355.2 2021-07-14 (134) 144MB classic
6.0/edge: ↑
5.0/stable: 5.0.302 2021-07-13 (132) 139MB classic
5.0/candidate: ↑
5.0/beta: 5.0.100 2020-11-10 (105) 267MB classic
5.0/edge: ↑
3.1/stable: 3.1.411 2021-07-13 (133) 123MB classic
3.1/candidate: ↑
3.1/beta: ↑
3.1/edge: ↑
2.1/stable: 2.1.816 2021-05-11 (124) 245MB classic
2.1/candidate: ↑
2.1/beta: ↑
2.1/edge: 2.1.808 2020-07-14 (91) 245MB classic
installed: 5.0.302 (132) 139MB classic
Solution 1:[1]
POP OS is based on Ubuntu. If you installed the dotnet runtime via snap install you can access it via "sudo dotnet ..." only. I had the same problem in VS Code, it runs the dotnet commands without sudo and I recived the "Segmentation fault (core dumped)" error. I solved by installing the dotnet runtime via apt-get (now is installed in "/usr/bin ..." and works without sudo (see: https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#2004-))
Solution 2:[2]
I think this is the issue in snap itself. Instead of snap , use pacman
sudo snap remove dotnet-sdk
sudo pacman -S dotnet-sdk
More info of this issue is here https://github.com/dotnet/sdk/issues/11639
Solution 3:[3]
I get 'Segmentation fault (core dumped)' with .Net 6.0 (dotnet build) on Ubuntu 22.04. After downgrade to Ubuntu 20.04. 'dotnet build' works well
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Amit Kotha |
Solution 3 | user2219822 |