runtime: .NET runtime not found on Ubuntu

Description

My weekly GitHub actions build started failing. I suspect some change in Ubuntu .NET 6 results in the apps no longer running, and complaining no runtime found.

Docker:

# Build externally
# dotnet publish ./PlexCleaner/PlexCleaner.csproj --runtime linux-x64 --self-contained false --output ./Docker/PlexCleaner
COPY PlexCleaner /PlexCleaner
RUN dotnet --info \
    && /PlexCleaner/PlexCleaner --version

Actions error:

#15 [10/10] RUN dotnet --info     && /PlexCleaner/PlexCleaner --version
#15 0.222 .NET SDK (reflecting any global.json):
#15 0.222  Version:   6.0.111
#15 0.222  Commit:    b3bb659a9d
#15 0.222 
#15 0.222 Runtime Environment:
#15 0.224  OS Name:     ubuntu
#15 0.224  OS Version:  22.04
#15 0.227  OS Platform: Linux
#15 0.251  RID:         ubuntu.22.04-x64
#15 0.251  Base Path:   /usr/lib/dotnet/sdk/6.0.111/
#15 0.254 
#15 0.254 global.json file:
#15 0.254   Not found
#15 0.254 
#15 0.254 Host:
#15 0.254   Version:      6.0.11
#15 0.254   Architecture: x64
#15 0.254   Commit:       943474ca16
#15 0.254 
#15 0.254 .NET SDKs installed:
#15 0.254   6.0.111 [/usr/lib/dotnet/sdk]
#15 0.254 
#15 0.254 .NET runtimes installed:
#15 0.254   Microsoft.AspNetCore.App 6.0.11 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
#15 0.254   Microsoft.NETCore.App 6.0.11 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
#15 0.254 
#15 0.254 Download .NET:
#15 0.254   https://aka.ms/dotnet-download
#15 0.254 
#15 0.254 Learn about .NET Runtimes and SDKs:
#15 0.254   https://aka.ms/dotnet/runtimes-sdk-info
#15 0.262 You must install .NET to run this application.
#15 0.262 
#15 0.262 App: /PlexCleaner/PlexCleaner
#15 0.262 Architecture: x64
#15 0.262 App host version: 6.0.11
#15 0.262 .NET location: Not found
#15 0.262 
#15 0.262 Learn about runtime installation:
#15 0.262 https://aka.ms/dotnet/app-launch-failed
#15 0.262 
#15 0.262 Download the .NET runtime:
#15 0.262 https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.22.04-x64&apphost_version=6.0.11
#15 ERROR: process "/bin/sh -c dotnet --info     && /PlexCleaner/PlexCleaner --version" did not complete successfully: exit code: 131

Full error: https://github.com/ptr727/PlexCleaner/actions/runs/3622494725/jobs/6107272543

Reproduction Steps

Install .NET 6 on ubuntu:latest. Compile .NET core app in github actions step, copy .NET app to docker ditnet --info works. Run .NET app, complains no .NET found?

Expected behavior

Work as before.

Actual behavior

.NET location: Not found

Regression?

Yes, this worked in previous ubuntu:latest release, no code changes, github actions build just started failing.

Known Workarounds

No response

Configuration

https://github.com/ptr727/PlexCleaner/actions/runs/3616398576

Other information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 24 (17 by maintainers)

Commits related to this issue

Most upvoted comments

Hi all,

Thanks a lot Michael for the mention! We detected that DOTNET_ROOT was not properly updated when upgrading from previous versions to latest 6.0.111 (we did a change in the install layout as some of you could notice), affecting only to amd64 architectures:

https://bugs.launchpad.net/ubuntu/+source/dotnet6/+bug/1997746

We were monitoring any possible issues related to this, but we didn’t get any on Launchpad so we couldn’t estimate if this was causing a real impact or not. @ptr727 or anyone else affected, whenever you face an issue with the package, feel free to file a issue about dotnet package in ubuntu at https://bugs.launchpad.net/ubuntu/+source/dotnet6/+filebug … thankyou!. I’ll track this to the above bug already opened. Anyway, happy to help here, of course!

The fix is prepared for next version .112 next week, sorry for the inconvenience.

The issue arises in the file /etc/profile.d/dotnet.sh, where the DOTNET_ROOT variable is set:

# Set location for AppHost lookup
[ -z "$DOTNET_ROOT" ] && export DOTNET_ROOT=/usr/lib/dotnet

There are a couple of workarounds in the meantime (I already saw some of you applying it, thanks!):

  • the DOTNET_ROOT can be exported manually
  • eliminate the condition in the above file to force the export of the variable (sourcing the file again).
  • set it in some json files for configuring the solution in the sln folder (*.runtimeconfig.json )
  • call the executable directly prepending the DOTNET_ROOT variable with the correct folder (in this case DOTNET_ROOT=/usr/lib/dotnet, i.e. DOTNET_ROOT=/usr/lib/dotnet MyApp).

We didn’t notice the missing location files! Thanks @agocke for the reporting here and @Daan4 for the workaround. I already filed a bug for that:

https://bugs.launchpad.net/ubuntu/+source/dotnet6/+bug/1999266

I’ll update this issue when the fix would be released. Thanks in advance for your patience.

DOTNET_ROOT=/usr/lib/dotnet solved it for me. I was setting DOTNET_ROOT to something else in my bashrc.

Thanks for the update, @mirespace! I’m going to close this issue since the fix has been released.

Hi all! Happy New year btw.

(OFYI) Sorry for the delay in commenting here: the fixes were released this week with version 6.0.113 (maybe some of you noticed them also in the 112 version that was in proposed pocket in December). I hope this help, and please, let me know if something else needs to be changed for you.

@masto Thanks for bringing up the zsh user experience… would you mind submitting a bug at https://bugs.launchpad.net/ubuntu/+source/dotnet6/+filebug ? I will mark it as Wishlist at first, but it will help us to be aware of it. We will work on it as soon as possible when time and resources allow.

@mirespace Just to give a little more context where this matters:

If you use dotnet directly, you probably won’t notice much difference. In these cases the runtime is always next to the dotnet launcher so there’s extra to find.

The scenario that’s broken is what we call the “apphost” scenario, where a native exe is bundled with the user application. In that case the apphost needs to launch the runtime, but doesn’t necessarily know where to look. The behavior is defined as either

  1. the default location in /usr/share
  2. the location as specified in /etc/dotnet/install_location

The fixes for this would generally be to either use the default install location, or place the install_location file in the expected /etc/dotnet location. No real preference on either choice.

I experienced the same issue on ubuntu 22.04 going from 6.0.9 to 6.0.11. Resolved it by doing mv /lib/dotnet/install_location /etc/dotnet/install_location