Description
I recently encountered that PowerShell on Mariner fails when DOTNET_ROOT is set. I created GitHub issue to resolve this error.
After discussion with the PowerShell community, it was discovered that access to /etc/dotnet/install_location is restricted for non-root users on Mariner, which may be the cause of why PowerShell is not looking for the dotnet runtime in the standard location /usr/share/dotnet.
When DOTNET_ROOT is not set it works just fine. So I would expect the same behavior when DOTNET_ROOT is set.
Reproduction Steps
# tdnf install powershell
echo $DOTNET_ROOT
dotnet --list-runtimes
pwsh -c "echo Hello"
mkdir -p /tmp/hostedtoolcache/dotnet
export DOTNET_ROOT=/tmp/hostedtoolcache/dotnet
dotnet --list-runtimes
pwsh -c "echo Hello"
Expected behavior
Ubuntu
Microsoft.AspNetCore.App 7.0.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Hello
Microsoft.AspNetCore.App 7.0.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 7.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Hello
Actual behavior
Mariner
Microsoft.AspNetCore.App 6.0.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Hello
Microsoft.AspNetCore.App 6.0.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
You must install .NET to run this application.
App: /opt/microsoft/powershell/7/pwsh
Architecture: x64
App host version: 7.0.3
.NET location: Not found
Learn about runtime installation:
https://aka.ms/dotnet/app-launch-failed
Download the .NET runtime:
https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=mariner.2.0-x64&apphost_version=7.0.3
Regression?
No response
Known Workarounds
It works if I create etc/dotnet folder with user permissions
sudo mkdir -m 755 /etc/dotnet
pwsh -c "echo Hello"
UPD: IT DOENS'T WORK
Configuration
- Dotnet runtime: Microsoft.NETCore.App 7.0.3
- Mariner/Ubuntu
Other information
No response
Description
I recently encountered that PowerShell on Mariner fails when
DOTNET_ROOTis set. I created GitHub issue to resolve this error.After discussion with the PowerShell community, it was discovered that access to
/etc/dotnet/install_locationis restricted for non-root users on Mariner, which may be the cause of why PowerShell is not looking for the dotnet runtime in the standard location/usr/share/dotnet.When
DOTNET_ROOTis not set it works just fine. So I would expect the same behavior whenDOTNET_ROOTis set.Reproduction Steps
Expected behavior
Ubuntu
Actual behavior
Mariner
Regression?
No response
Known Workarounds
It works if I create
etc/dotnetfolder with user permissionssudo mkdir -m 755 /etc/dotnet pwsh -c "echo Hello"UPD: IT DOENS'T WORK
Configuration
Other information
No response