question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support remote alpine containers (and other linux-musl based-OSs)

See original GitHub issue

Issue Description

I’m unable to run or debug C# xUnit tests directly in VSCode with Remote to WSL/Alpine. I am however able to run those test on the WSL command line with dotnet test. This seems to be a problem with Omnisharp’s C# extension to VSCode.

Steps to Reproduce

  • On Windows, with WSL installed and an Alpine Linux distribution.
  • VSCode has the “Remote- WSL” extension.
  • VSCode has the “C#” extension installed locally, and installed in WSL/Alpine (the server part)
  • In VSCode open a Remote WSL folder that contains an xUnit test.
  • Then open a specific *.cs unit test file.

Expected Behavior

The *.cs file should soon be decorated with “Run Test” and “Debug Test” around each unit test, allowing them to be run or debugged directly from VSCode.

Actual Behavior

The unit test do not contain “Run Test” or “Debug Test” decorations.

The same *cs file loaded with VSCode on a local folder instead of a remote WSL folder, shows those links. These links are only missing when running on Remote WSL.

Logs

The logs show that Omnisharp fails to load ld-linux-x86-64.so.2. An internet search showed this may be due to not having libc6-compat installed, but in my case that package is installed:

> apk info libc6-compat
libc6-compat-1.1.22-r3 description:
compatibility libraries for glibc

libc6-compat-1.1.22-r3 webpage:
http://www.musl-libc.org/

libc6-compat-1.1.22-r3 installed size:
12288

> apk info -L libc6-compat
libc6-compat-1.1.22-r3 contains:
lib/libm.so.6
lib/libc.so.6
lib/libcrypt.so.1
lib/librt.so.1
lib/libutil.so.1
lib/libpthread.so.0
lib64/ld-linux-x86-64.so.2

Double checking ld-linux-x86-64.so is actually installed

>ls -l /lib64/ld-linux-x86-64.so.2 
lrwxrwxrwx    1 root     root            26 Feb 28 19:27 /lib64/ld-linux-x86-64.so.2 -> /lib/libc.musl-x86_64.so.1

>ls -l /lib/libc.musl-x86_64.so.1
lrwxrwxrwx    1 root     root            19 Aug 20  2019 /lib/libc.musl-x86_64.so.1 -> ld-musl-x86_64.so.1

>ls -l /lib/ld-musl-x86_64.so.1
-rwxr-xr-x    1 root     root        580144 Aug  7  2019 /lib/ld-musl-x86_64.so.1

OmniSharp log

Starting OmniSharp server at 3/5/2020, 7:59:42 PM Target: /home/username/path/file.sln

OmniSharp server started. Path: /home/username/.vscode-server/extensions/ms-dotnettools.csharp-1.21.13/.omnisharp/1.34.13/run PID: 264

Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /home/username/.vscode-server/extensions/ms-dotnettools.csharp-1.21.13/.omnisharp/1.34.13/bin/mono)

C# log

nstalling C# dependencies... Platform: linux, x86_64, name=alpine, version=3.10.2

Downloading package ‘OmniSharp for Linux (x64)’ (43753 KB)… Done! Validating download… Integrity Check succeeded. Installing package ‘OmniSharp for Linux (x64)’

Downloading package ‘.NET Core Debugger (linux / x64)’ (54207 KB)… Done! Validating download… Integrity Check succeeded. Installing package ‘.NET Core Debugger (linux / x64)’

Downloading package ‘Razor Language Server (Linux / x64)’ (52181 KB)… Done! Installing package ‘Razor Language Server (Linux / x64)’

Finished

Environment information

VSCode version: 1.42.1 C# Extension: 1.21.13

Mono Information OmniSharp using built-in mono
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.102 Commit: 573d158fea

Runtime Environment: OS Name: alpine OS Version: 3.10 OS Platform: Linux RID: alpine.3.10-x64 Base Path: /usr/local/dotnet/sdk/3.1.102/

Host (useful for support): Version: 3.1.2 Commit: 916b5cba26

.NET Core SDKs installed: 3.1.102 [/usr/local/dotnet/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.2 [/usr/local/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.2 [/usr/local/dotnet/shared/Microsoft.NETCore.App]

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

Visual Studio Code Extensions
Extension Author Version
csharp ms-dotnettools 1.21.13
Go ms-vscode 0.13.1

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
rickardpcommented, Aug 21, 2020

I fixed the Mono bug blocking this a while back https://github.com/mono/mono/issues/7167

I think it should be possible to create an Alpine version of OmniSharp now. It is possible to work around this by baking mono into the Alpine dev image and setting “omnisharp.useGlobalMono”: “always”, but I think this should be properly supported by OmniSharp, given how useful Alpine is for developing microservices in c#

0reactions
filipwcommented, May 9, 2022

The next version of OmniSharp server will have a .NET 6 build specifically for musl-based distros like Alpine https://github.com/OmniSharp/omnisharp-roslyn/pull/2395

Read more comments on GitHub >

github_iconTop Results From Across the Web

alpine - Official Image | Docker Hub
A minimal Docker image based on Alpine Linux with a complete package index and only 5 MB in size! ... Supported tags and...
Read more >
Remote Development with Linux - Visual Studio Code
Linux Prerequisites for VS Code Remote - SSH, Dev Containers, and WSL ... libc is implemented in Alpine Linux ( musl ) and...
Read more >
node.js - linux-x64 binaries cannot be used on the linuxmusl ...
The trick is to install run npm install sharp in the final container - in my case it was Alpine linux that is...
Read more >
Install .NET on Alpine - Microsoft Learn
When an Alpine version falls out of support, .NET is no longer supported with that version. Install the SDK (which includes the runtime)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found