runtime: "Failed to initialize CoreCLR, HRESULT: 0x80004005" when $TMPDIR is not writeable/nonexistent

Steps to reproduce

sudo apt-get install dotnet-sdk-2.1.300-rc1-008673
dotnet --version

sudo dotnet --version

Expected behavior

dotnet --version
2.1.300-rc1-008673

sudo dotnet --version
2.1.300-rc1-008673

Actual behavior

dotnet --version
Failed to initialize CoreCLR, HRESULT: 0x80004005

sudo dotnet --version
2.1.300-rc1-008673

Environment data

dotnet --info
Failed to initialize CoreCLR, HRESULT: 0x80004005

Host (useful for support):
  Version: 2.1.0-rc1
  Commit:  eb9bc92051

.NET Core SDKs installed:
  2.1.300-rc1-008673 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0-rc1-final [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0-rc1-final [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.0-rc1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:        16.04
Codename:       xenial

uname -a
Linux BSS-IMM 4.4.0-17134-Microsoft dotnet/core-setup#48-Microsoft Fri Apr 27 18:06:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 33 (18 by maintainers)

Commits related to this issue

Most upvoted comments

By default, $TMPDIR is empty on WSL (at least in the default profile used by bash in Ubuntu 18.04.1), so dotnet should default to /tmp, which is on a lxfs volume – thus supporting pipes, FIFOs, and other Unixy things.

Setting $TMPDIR to anything under a drvfs will make dotnet fail with a less than helpful error message (drvfs merely proxies Windows volumes to the WSL world, so I don’t think this will be supported even under WSL2 – don’t quote me on that, I haven’t tested it).

Maybe this should be fixed in the documentation instead?

Ah that is it. I have the following.

dotnet --version
Failed to initialize CoreCLR, HRESULT: 0x80004005

echo $TMPDIR
/mnt/c/Users/jrillema/AppData/Local/Temp

export TMPDIR=/tmp
dotnet --version
2.1.300-rc1-008673

If I change it to /tmp it works! Nice catch @jkotas and thanks for the feedback. I tried this with not opting out of the COMPlus_EnableDiagnostics and it is still working.

Not sure how we should handle that or how to document it. I guess the ownership of the issue is with WSL team? I will update their issue to indicate why this showed up now with .NET Core SDK.

Thanks everybody for your help on this one!

@jkotas another case where I wish customers had something better than Failed to initialize CoreCLR, HRESULT: 0x80004005 Even if it’s just a code indicating what phase it failed in that they can search for.