Open Anduin2017 opened 10 months ago
Rebooting doesn't help.
General ping. This issue is still blocking us upgrading from 7 to 8.
Same issue here. I installed .NET 8 SDK on Ubuntu 22.04 using this method:
sudo dpkg --purge packages-microsoft-prod && sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y gpg
wget -O - https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o microsoft.asc.gpg
sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/
wget https://packages.microsoft.com/config/ubuntu/22.04/prod.list
sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list
sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg
sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update && sudo apt-get install -y dotnet-sdk-8.0
Can you all follow the steps described in the Corehost tracing docs to log how the app is trying to discover/load the runtime? That would help us identify where the gap is coming from. This works on both 7.0 and 8.0, so if you had examples of these traces from apps built with either SDK that would help.
Hi @baronfel
The output log is:
edi@edi-virtual-machine:~/curry$ ls
bin curry.csproj curry.sln obj Program.cs
edi@edi-virtual-machine:~/curry$ cd bin/Release/net8.0/publish/
edi@edi-virtual-machine:~/curry/bin/Release/net8.0/publish$ ls
curry curry.deps.json curry.dll curry.pdb curry.runtimeconfig.json
edi@edi-virtual-machine:~/curry/bin/Release/net8.0/publish$ ./curry
Tracing enabled @ Fri Dec 29 04:59:54 2023 GMT
--- Invoked apphost [version: 8.0.0 @Commit: 5535e31a712343a63f5d7d796cd874e563e5ac14] main = {
./curry
}
The managed DLL bound to this executable is: 'curry.dll'
Using environment variable DOTNET_ROOT=[/home/edi/.dotnet] as runtime location.
Looking for architecture-specific install_location file in '/etc/dotnet/install_location_x64'.
The install_location file ['/etc/dotnet/install_location_x64'] does not exist - skipping.
Looking for install_location file in '/etc/dotnet/install_location'.
The install_location file ['/etc/dotnet/install_location'] does not exist - skipping.
The required library libhostfxr.so could not be found. Searched with root path [/home/edi/curry/bin/Release/net8.0/publish/], environment variable [DOTNET_ROOT], default install location [/usr/share/dotnet], self-registered config location [/etc/dotnet/install_location_x64]
You must install .NET to run this application.
App: /home/edi/curry/bin/Release/net8.0/publish/curry
Architecture: x64
App host version: 8.0.0
.NET location: Not found
Learn more:
https://aka.ms/dotnet/app-launch-failed
Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=linux-x64&os=ubuntu.22.04&apphost_version=8.0.0
@EdiWang is this with a standard, package-based installation? can you include the output from dotnet --info
? I suspect that your installation is not quite correct because the packages should create those install_location files. Note that installing .NET from the Microsoft packages requires more than you've shown in your comment - you must also tell apt to ignore the distro feeds for the .NET packages, because .NET is available from Canonical as well. Details for doing this can be found here.
The command I used to install .NET 8 SDK is actually from the official document here
Previous to this step. I've tried Scripted install. However, that did not even give me the $HOME/.dotnet
directory, this is why I tried my second option.
I believe I am installing .NET from Microsoft package source.
My dotnet --info
output (without corehost trace):
edi@edi-virtual-machine:~$ dotnet --info
.NET SDK:
Version: 8.0.100
Commit: 57efcf1350
Workload version: 8.0.100-manifests.6c33ef20
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/8.0.100/
.NET workloads installed:
Workload version: 8.0.100-manifests.6c33ef20
There are no installed workloads to display.
Host:
Version: 8.0.0
Architecture: x64
Commit: 5535e31a71
.NET SDKs installed:
8.0.100 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
DOTNET_ROOT [/home/edi/.dotnet]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
The DOTNET_ROOT from the scripted installation is corrupting your installation. Unset that env var and you should be good to go.
Thanks @baronfel
I removed DOTNET_ROOT
, the Linux executable works fine now!
edi@edi-virtual-machine:~/curry/bin/Release/net8.0/publish$ ./curry
Hello
Hi, @baronfel
My situation seems to be different:
anduin@lab:~/Console/bin/Release/net8.0/publish$ dotnet --info
.NET SDK:
Version: 8.0.100
Commit: 57efcf1350
Workload version: 8.0.100-manifests.6c33ef20
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/8.0.100/
.NET workloads installed:
Workload version: 8.0.100-manifests.6c33ef20
There are no installed workloads to display.
Host:
Version: 8.0.0
Architecture: x64
Commit: 5535e31a71
.NET SDKs installed:
8.0.100 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
anduin@lab:~/Console/bin/Release/net8.0/publish$ ./Console
Tracing enabled @ Fri Dec 29 06:06:02 2023 GMT
--- Invoked apphost [version: 8.0.0 @Commit: 5535e31a712343a63f5d7d796cd874e563e5ac14] main = {
./Console
}
The managed DLL bound to this executable is: 'Console.dll'
Looking for architecture-specific install_location file in '/etc/dotnet/install_location_x64'.
Found registered install location '/usr/lib/dotnet'.
Using global installation location [/usr/lib/dotnet] as runtime location.
The required library libhostfxr.so could not be found. Searched with root path [/home/anduin/Console/bin/Release/net8.0/publish/], environment variable [DOTNET_ROOT], default install location [/usr/lib/dotnet], self-registered config location [/etc/dotnet/install_location_x64]
You must install .NET to run this application.
App: /home/anduin/Console/bin/Release/net8.0/publish/Console
Architecture: x64
App host version: 8.0.0
.NET location: Not found
Learn more:
https://aka.ms/dotnet/app-launch-failed
Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=linux-x64&os=ubuntu.22.04&apphost_version=8.0.0
@Anduin2017 you have mixed packages from your distro and from packages.microsoft.com. you need to follow the instructions I linked above and ensure that all of the dotnet packages are coming from one source. They are not able to be mixed.
@baronfel I have the same problem as @Anduin2017. How can I check if my packages are mixed? If they are mixed, what should I do to fix it? I followed official instructions from here: https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu?fbclid=IwAR0fOHfXfHRlQclJVyutLcJ9D_9eXwZH8hFYjgDQ5BNU5sb1n_kodq0qXe0#register-the-microsoft-package-repository
First of all, I used those commands:
declare repo_version=$(if command -v lsb_release &> /dev/null; then lsb_release -r -s; else grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"'; fi)
wget https://packages.microsoft.com/config/ubuntu/$repo_version/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
Next, I installed:
sudo apt install dotnet-sdk-8.0
sudo apt install dotnet-runtime-8.0
My dotnet info:
dotnet --info
.NET SDK:
Version: 8.0.101
Commit: 6eceda187b
Workload version: 8.0.100-manifests.69afb982
Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/8.0.101/
.NET workloads installed:
Workload version: 8.0.100-manifests.69afb982
There are no installed workloads to display.
Host:
Version: 8.0.1
Architecture: x64
Commit: bf5e279d92
.NET SDKs installed:
8.0.101 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Same issue as users reports below:
dotnet --info .NET SDK: Version: 8.0.101 Commit: 6eceda187b Workload version: 8.0.100-manifests.69afb982
Runtime Environment: OS Name: ubuntu OS Version: 22.04 OS Platform: Linux RID: linux-x64 Base Path: /usr/share/dotnet/sdk/8.0.101/
.NET workloads installed: Workload version: 8.0.100-manifests.69afb982 There are no installed workloads to display.
Host: Version: 8.0.1 Architecture: x64 Commit: bf5e279d92
.NET SDKs installed: 8.0.101 [/usr/share/dotnet/sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 8.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 8.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found: None
Environment variables: Not set
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download
But attempt to run any .net 8 app shows: You must install .NET to run this application.
App: /home/akrotov/train-nn/train Architecture: x64 App host version: 8.0.0 .NET location: Not found
Learn more: https://aka.ms/dotnet/app-launch-failed
Download the .NET runtime: https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=linux-x64&os=ubuntu.22.04&apphost_version=8.0.0
Spent half of the night trying all the fixes. The only what worked was setting:
export DOTNET_ROOT=/usr/share/dotnet
Seems that with in version 8 dotnet lost ability to write installation path during installation)
P.S it was last time when I've upgraded project to latest released .net version without very serious reasons for this. No updates - no problems :)
export DOTNET_ROOT="/usr/share/dotnet"
wasn't enough for me, however changing /etc/environment
by adding DOTNET_ROOT="/usr/share/dotnet
there worked for me
The same problem met when trying to use a dotnet tool with dotnet-8 SDK installed on Ubuntu from the Microsoft package repository by following the guide on the docs
The environment variable DOTNET_ROOT=/usr/share/dotnet
setting works for me
I finally mitigated via installing from Ubuntu official source:
sudo apt install dotnet8
And everything works fine.
Describe the bug
After installing the 8.0 SDK in Ubuntu 22.04, can't run the binary generated.
To Reproduce
Install .NET SDK 8 in Ubuntu, following the official document:
I tried both ways:
After installing, everything seems fine:
But if you build a console app:
It will crash:
Exceptions (if any)
Further technical details
Mentioned above.