Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apphost does not respect DOTNET_ROOT #28271

Closed
mspielberg opened this issue Sep 30, 2022 · 1 comment
Closed

apphost does not respect DOTNET_ROOT #28271

mspielberg opened this issue Sep 30, 2022 · 1 comment
Labels
Area-CLI untriaged Request triage from a team member

Comments

@mspielberg
Copy link

Describe the bug

Attempting to run an .NET Core app with the runtime installed to a non-default directory fails to find libhostfxr.so, as in #9304 / #12359. Unlike in those issues, the problem persists even with DOTNET_ROOT correctly set. Moving the installation to the default /usr/share/dotnet location resolves the error, so this seems to be a problem of the environment variable not being respected.

To Reproduce

❯ dotnet tool install ilspycmd --prerelease -g
You can invoke the tool using the following command: ilspycmd
Tool 'ilspycmd' (version '8.0.0.7106-preview2') was successfully installed.
❯ dotnet tool list -g
Package Id      Version                  Commands
-------------------------------------------------
ilspycmd        8.0.0.7106-preview2      ilspycmd
❯ dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.3 [/home/orion/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.3 [/home/orion/dotnet/shared/Microsoft.NETCore.App]
❯ export DOTNET_ROOT=/home/orion/dotnet
❯ echo $DOTNET_ROOT
/home/orion/dotnet
❯ ls -l $DOTNET_ROOT
total 188
-rw-r--r--    1 orion    orion         1116 Feb 23  2022 LICENSE.txt
-rw-r--r--    1 orion    orion        78479 Feb 23  2022 ThirdPartyNotices.txt
-rwxr-xr-x    1 orion    orion        76136 Feb 23  2022 dotnet
drwxr-sr-x    3 orion    orion         4096 Feb 24  2022 host
drwxr-sr-x    2 orion    orion         4096 Sep 29 23:45 metadata
drwxr-sr-x    6 orion    orion         4096 Feb 24  2022 packs
drwxr-sr-x    3 orion    orion         4096 Feb 24  2022 sdk
drwxr-sr-x    3 orion    orion         4096 Feb 24  2022 sdk-manifests
drwxr-sr-x    4 orion    orion         4096 Feb 24  2022 shared
drwxr-sr-x    3 orion    orion         4096 Feb 24  2022 templates
❯ ilspycmd
A fatal error occurred. The required library libhostfxr.so could not be found.
If this is a self-contained application, that library should exist in [/home/orion/.dotnet/tools/.store/ilspycmd/8.0.0.7106-preview2/ilspycmd/8.0.0.7106-preview2/tools/net6.0/any/].
If this is a framework-dependent application, install the runtime in the global location [/usr/share/dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet].

The .NET runtime can be found at:
  - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=alpine.3.15-x64&apphost_version=6.0.3
❯ sudo mv $DOTNET_ROOT /usr/share/dotnet
❯ ilspycmd
The Assembly file name(s) field is required.
Specify --help for a list of available options and commands.

Exceptions (if any)

(See error message above.)

Further technical details

  • Include the output of dotnet --info
❯ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.201
 Commit:    ef40e6aa06

Runtime Environment:
 OS Name:     alpine
 OS Version:  3.15
 OS Platform: Linux
 RID:         alpine.3.15-x64
 Base Path:   /home/orion/dotnet/sdk/6.0.201/

Host (useful for support):
  Version: 6.0.3
  Commit:  c24d9a9c91

.NET SDKs installed:
  6.0.201 [/home/orion/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.3 [/home/orion/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.3 [/home/orion/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
  • Note that updating to runtime 6.0.9 did not affect the issue at all:
❯ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.401
 Commit:    0906eae6f8

Runtime Environment:
 OS Name:     alpine
 OS Version:  3.15
 OS Platform: Linux
 RID:         alpine.3.15-x64
 Base Path:   /home/orion/dotnet/sdk/6.0.401/

global.json file:
  Not found

Host:
  Version:      6.0.9
  Architecture: x64
  Commit:       163a63591c

.NET SDKs installed:
  6.0.401 [/home/orion/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.9 [/home/orion/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.9 [/home/orion/dotnet/shared/Microsoft.NETCore.App]

Download .NET:
  https://aka.ms/dotnet-download

Learn about .NET Runtimes and SDKs:
  https://aka.ms/dotnet/runtimes-sdk-info
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-CLI untriaged Request triage from a team member labels Sep 30, 2022
@mspielberg
Copy link
Author

Apologies. I discovered a forgotten shell alias defined that was changing the value of DOTNET_ROOT to an incorrect value. I discovered this by using COREHOST_TRACE=1, which may help other troubleshoot similar issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CLI untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

1 participant