Coreclr fails to load Lttng while running in wsl
For prior investigation refer to https://github.com/dotnet/coreclr/issues/4132
If running in an environment where lttng does not work, CoreCLR fails to load, with an error message like this:
libust[14067/14068]: Error: Error opening shm /lttng-ust-wait-5 (in get_wait_shm() at lttng-ust-comm.c:886) libust[14067/14068]: Error: Error opening shm /lttng-ust-wait-5 (in get_wait_shm() at lttng-ust-comm.c:886) libust[14067/14069]: Error: Error opening shm /lttng-ust-wait-5-0 (in get_wait_shm() at lttng-ust-comm.c:886) libust[14067/14069]: Error: Error opening shm /lttng-ust-wait-5-0 (in get_wait_shm() at lttng-ust-comm.c:886) coreclr_initialize failed - status: 0x80004005
This currently happens in the "Ubuntu on Windows" environment in the latest Windows 10 preview, for example.
Steps to reproduce:
- Follow Ubuntu sterps in http://dotnet.github.io/getting-started/ or
- Build Coreclr repo and try to run a hello world https://github.com/dotnet/coreclr/blob/master/Documentation/building/linux-instructions.md
cc: @mjsabby @bitcrazed
Thanks for the report. We're working on getting CoreCLR up and running.
Followed up with Rama and was able to run through the steps above on a recent internal build. Without the fix for https://github.com/dotnet/coreclr/issues/4048 I had to use execstack to modify the binary, but I think that fix is coming soon as well.
I just followed the instructions at http://dotnet.github.io/getting-started/#/linux and when I got to the dotnet new command I got the following:
Failed to load /usr/share/dotnet/bin/libcoreclr.so, error: /usr/share/dotnet/bin/libcoreclr.so: cannot enable executable stack as shared object requires: Invalid argument
Failed to bind to coreclr
Not sure if this is is related to this issue or not.
You'll need a newer build of coreclr with the fix for the issue @stehufntdev mentioned. Doesn't look like the commit got in for rc2, but it should be there for the first release, and if you build your own version, I think the MyGet feed is also an option.
BTW I just tried CoreCLR on insider build 14342. .NET Core can load coreclr fine as long as libcoreclr.so is not inside /mnt/c.
I'm on build 14352 and I'm still getting
Failed to load /usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0-rc2-3002702/libcoreclr.so, error: /usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0-rc2-3002702/libcoreclr.so: cannot enable executable stack as shared object requires: Invalid argument
Failed to bind to CoreCLR at [/usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0-rc2-3002702]
I followed the instructions at https://www.microsoft.com/net/core#ubuntu to install .Net Core and when I run dotnet new I get that error.
I found libcoreclr.so at /mnt/c/Users/Leep/AppData/Local/lxss/rootfs/usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0-rc2-3002702/libcoreclr.so which reflects the fact that it's in /usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0-rc2-3002702/ in the Ubuntu filesystem. I tried mv'ing it to libcoreclr.so.copy and dotnet new still gave that same error.
@TigerLeep I'm using the 1.0.0-preview2-002959. https://github.com/dotnet/cli#installers-and-binaries
Just updated to 1607 build 14376 and now the 1.0.0-preview2-003121 with Microsoft.NETCore.App 1.0.0 and now I'm not getting any compilation errors and kan execute hello world without issue :+1:

Previous build that did not work for me.
Thanks for confirming! Locally we hit some issues due to missing support for restartable system calls, but that did not impact all scenarios. Closing since this is resolved.
Looks like the apt feed is still at beta?
% apt list dotnet
Listing... Done
dotnet/trusty,now 1.0.0.001793-1 amd64 [installed]
% dotnet --version
Failed to load /usr/share/dotnet/bin/libcoreclr.so, error: /usr/share/dotnet/bin/libcoreclr.so: cannot enable executable stack as shared object requires: Invalid argument
Failed to bind to coreclr
% sudo execstack -c /usr/share/dotnet/bin/libcoreclr.so
% dotnet --version
.NET Command Line Tools (1.0.0-beta-001793)
Product Information:
Version: 1.0.0-beta-001793
Commit Sha: 42a0eec967
Runtime Environment:
OS Name: ubuntu
OS Version: 14.04
OS Platform: Linux
Runtime Id: ubuntu.14.04-x64
@simonbuchan did you follow instructions here
I get below when I do the same
.NET Command Line Tools (1.0.0-preview2-003121)
Product Information:
Version: 1.0.0-preview2-003121
Commit SHA-1 hash: 1e9d529bc5
Runtime Environment:
OS Name: ubuntu
OS Version: 14.04
OS Platform: Linux
RID: ubuntu.14.04-x64
See so you've done
sudo apt-get update && sudo apt-get dist-upgrade
So your Ubuntu is up to date too.
Also last resort if you get in a bad state is to start a administrator command prompt
lxrun /uninstall /full
Disclaimer this will totally remove Ubuntu and re-download it next time you start Bash.
You'll be asked to enter a user name and password.
Then do the
sudo apt-get update
sudo apt-get dist-upgrade
And after that follow instructions on https://www.microsoft.com/net/core#Ubuntu
@devlead Yes those work, I was referring to the fact that the dotnet package is an old version which reproduces this issue, which is confusing with the announcement of .Net core being released.
dotnet-dev-1.0.0-preview2-003121 (and ...-preview3-003174) doesn't have this issue, instead I get weird build failures:
code 0 % mkdir core-test
code 0 % cd core-test
core-test 0 % dotnet --version
1.0.0-preview3-003174
core-test 0 % dotnet new
Created new C# project in /home/simon/code/core-test.
core-test 0 % dotnet restore
log : Restoring packages for /home/simon/code/core-test/project.json...
log : Writing lock file to disk. Path: /home/simon/code/core-test/project.lock.json
log : /home/simon/code/core-test/project.json
log : Restore completed in 1316ms.
core-test 0 % dotnet build
Project core-test (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
Compiling core-test for .NETCoreApp,Version=v1.0
Success
/usr/share/dotnet/dotnet compile-csc @/home/simon/code/core-test/obj/Debug/netcoreapp1.0/dotnet-compile.rsp returned Exit Code 1
Compilation failed.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:00.1168730
core-test 1 %
But that's a different issue, probably on dotnet
@simonbuchan ah, yes confusing with tooling still preview2 and framework RTM agree ;) tried the 1.0.0-preview3-003171 available on latest and got same error as you do with 003174, so something's broken with later versions.
dotnet --verbose build
vebose log
Launch host: /usr/share/dotnet/dotnet, app: /usr/share/dotnet/sdk/1.0.0-preview3-003171/dotnet.dll, argc: 2, args: --verbose,build,/usr/share/dotnet/sdk/1.0.0-preview3-003171/csc.dll,
Directory core breadcrumbs [] was not specified or found
Fallback directory core breadcrumbs at [/opt/corebreadcrumbs] was not found
--- Begin breadcrumb write
Breadcrumb store was not obtained... skipping write.
Telemetry is: Disabled
Project test (.NETCoreApp,Version=v1.0) will be compiled because expected outputs are missing
/home/matkar/test/bin/Debug/netcoreapp1.0/test.dll
/home/matkar/test/bin/Debug/netcoreapp1.0/test.pdb
/home/matkar/test/bin/Debug/netcoreapp1.0/test.deps.json
/home/matkar/test/bin/Debug/netcoreapp1.0/test.runtimeconfig.json
Compiling test for .NETCoreApp,Version=v1.0
Success
Running /usr/share/dotnet/dotnet /usr/share/dotnet/sdk/1.0.0-preview3-003171/csc.dll -noconfig @/home/matkar/test/obj/Debug/netcoreapp1.0/dotnet-compile-csc.rsp
/usr/share/dotnet/dotnet compile-csc @/home/matkar/test/obj/Debug/netcoreapp1.0/dotnet-compile.rsp returned Exit Code 1
Compilation failed.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:00.1197850
--- End breadcrumb write 0
If I may afford one small side note - enabling telemetry will help Microsoft to refine and improve the product and we are all winning. :-)