microsoft / live-share

Real-time collaborative development from the comfort of your favorite tools
http://aka.ms/vsls
Creative Commons Attribution 4.0 International
2.28k stars 253 forks source link

Live Share not working in alpine remote container #4328

Closed josh-stevens closed 2 years ago

josh-stevens commented 3 years ago

Describe what happened:

Live Share is unresponsive when used from a remote dev container based on alpine.

What was your system configuration? Product and Version [VS/VSCode]: Version: 1.57.1 (user setup) OS Version[macOS/Windows]: Windows, WSL2 + custom Docker image based on trafex/alpine-nginx-php7:1.5.0 Live Share Extension Version: v1.0.4419

Steps to Reproduce / Scenario:

  1. Try to open or join a Live Share session from a remote dev container based on trafex/alpine-nginx-php7:1.5.0 (I will post more info from the Docker file if needed. Lots of build dependencies are probably required).

  2. Nothing happens.

Logs

So the first error I get from the extension host is that I'm missing libhostfxr.so along with directions on how to get the .NET runtime for alpine. I added some stuff to install .NET runtime to the Dockerfile and now I get this error:

The application to execute does not exist: '/home/www/.vscode-server/extensions/ms-vsliveshare.vsliveshare-1.0.4419/dotnet_modules/vsls-agent.dll'
    at ChildProcess.<anonymous> (/home/www/.vscode-server/extensions/ms-vsliveshare.vsliveshare-1.0.4419/out/prod/extension-prod.js:194642:32)
    at ChildProcess.emit (events.js:327:22)
    at maybeClose (internal/child_process.js:1048:16)
    at Socket.<anonymous> (internal/child_process.js:439:11)
    at Socket.emit (events.js:315:20)
    at Pipe.<anonymous> (net.js:673:12)

I can verify that vsls-agent and vsls-agent.dll both exist. Any help? Happy to provide more info if needed. This is a bit of a dead end for me.

josh-stevens commented 3 years ago

I tried this again on a vanilla alpine:latest container and I run into the same issue as above.

Running this on a vanilla ubuntu:latest container, I run into the missing libhostfxr.so again, but after installing the .NET runtime, Live Share works. The big difference is that on ubuntu, I'm able to pull down a .deb installer. On alpine, I'm pulling aspnetcore-runtime-5.0.7-linux-musl-x64.tar.gz and unpacking that to /usr/share/dotnet which might not be correct

alyssajotice commented 3 years ago

Hey @josh-stevens, this issue seems to be related to missing dependencies. Alpine has three necessary dependencies for Live Share to work properly

I just set up a remote container based on Alpine v3.13 and initially had the same behavior you did. This behavior is consistent with what we see when we have Live Share installed and before we run the script to install Linux dependencies in remote scenarios. We have information here about installing Linux dependencies. This script will install all of the dependencies: https://raw.githubusercontent.com/MicrosoftDocs/live-share/master/scripts/linux-prereqs.sh. Depending on your setup, you may need to change the first line to #!/bin/sh. Unfortunately, the script is not currently working for me because of the following message:

ERROR: unable to select packages:
  libssl1.0 (no such package):
    required by: world[libssl1.0]
(!) .NET Core dependency install failed!

I see you installed a dotnet runtime and were able to unpack that, but I'm not sure if that includes the three packages needed for Live Share. Can you try to install these dependencies and see if that helps? In the meantime, I will try to find a different version of openssl that we can use that is available for Alpine Linux.

Might be related to #4176

alyssajotice commented 3 years ago

Update: the script is working with version 1.1 and I made this PR: https://github.com/MicrosoftDocs/live-share/pull/4363. Now I am reproducing your bug where Live Share is unresponsive.

josh-stevens commented 3 years ago

In our setup, we added the linux dependencies and also removed named volumes we had that were for vscode-server and vscode-extensions and now we've got it working 🎉

Xenoha commented 3 years ago

@alyssajotice

I'm having an issue with live share within containers as well. Getting the following output in the extensions host shell.

[2021-07-23 22:19:04.182] [exthost] [error] Error: Agent terminated with exit code: 0 and signal null: /bin/sh: /root/.vscode-server/extensions/ms-vsliveshare.vsliveshare-1.0.4583/dotnet_modules/vsls-agent: not found at ChildProcess.<anonymous> (/root/.vscode-server/extensions/ms-vsliveshare.vsliveshare-1.0.4583/out/prod/extension-prod.js:195227:32) at ChildProcess.emit (events.js:327:22) at maybeClose (internal/child_process.js:1048:16) at Socket.<anonymous> (internal/child_process.js:439:11) at Socket.emit (events.js:315:20) at Pipe.<anonymous> (net.js:673:12)

Setup is using your updated script on a node:lts-alpine:3.12 image

alyssajotice commented 3 years ago

Hey @Xenoha, I am still not able to Join/Share from my Alpine WSL, even after trying the above suggestion to delete the vscode-server and vscode-extensions folder. On my machine, I am also having trouble getting dotnet installed properly. I think there is another dependency missing but I'm not sure what it is. I filed the above issue to get more info. Thanks for being patient while I look into this.

alyssajotice commented 3 years ago

Hey @josh-stevens, was there anything else you did to get Live Share working? I am repro-ing this issue https://github.com/MicrosoftDocs/live-share/issues/3164 and still can't get the vsls-agent to start.

alyssajotice commented 3 years ago

Closing due to inactivity.

Xenoha commented 3 years ago

@alyssajotice

Don't close. I'm still waiting. You asked a specific question to @josh-stevens not me.

alyssajotice commented 3 years ago

@Xenoha I'll reopen. Please try the following:

You can navigate to the vsls-agent executable by finding it in the .vscode-server/extensions/ms-vsliveshare.{VERSION}/dotnet_modules folder. When I recently installed Live Share in an Ubuntu Docker container, it was in my root folder. Try running the executable.

When I tried to run this on Alpine, I got the following output: Error loading shared library ld-linux-x86-64.so.2: No such file or directory. I ran the following linking command to fix it: ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2. After fixing this, I got the following message: "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/install_location]." To fix this, I ran the following commands:

export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$HOME/.dotnet

You'll need to double check that this is the correct path to your dotnet executable. After this, I was able to run the executable. Let me know if this helps. If you run the executable, your extension may automatically connect to the agent and you should be able to share.

On my machine, my agent is not connecting properly but I am able to get it to start up, which is the first error to address in your scenario.

Xenoha commented 3 years ago

@alyssajotice does it matter that my container isn't using dotnet and dotnet isn't installed on my computer?

I'm not able to run live share on a node:lts-alpine3.12 base container on the Linux: Ubuntu 20.04.2 LTS OS.

alyssajotice commented 3 years ago

Please install dotnet. Live Share should install it for you, but perhaps that isn't working properly for you. Here are docs to download it: https://docs.microsoft.com/en-us/dotnet/core/install/linux-alpine

Xenoha commented 3 years ago

@alyssajotice

I cannot execute the file at the path provided above. The error provided when I type ./vsls-agent in the path .vscode-server/extensions/ms-vsliveshare.{VERSION}/dotnet_modules is: "no such file or directory: ./vsls-agent"

The funny this is that the file does exist at that path and has the correct execution/read rights. ""

alyssajotice commented 3 years ago

This behavior occurs when there is a dynamic linking error which could be caused by a missing dependency. Please try to install the dependency libc6-compat. This may help with the dynamic linking problem.

Can you also please check that each of these dotnet dependencies is installed? https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#dependencies. Then, can you make sure you have all of the Live Share dependencies installed? https://docs.microsoft.com/en-us/visualstudio/liveshare/reference/linux#detailed-library-requirements. Please read through this documentation to ensure you've done everything there.

If all of those things work, then please try to run the command > Live Share: Repair Installation. Also, please try to remove the .vscode-server and .vscode-extensions folders and reinstall Live Share and dependencies.

To make sure you have dotnet, run the command dotnet -version and make sure it works and is part of the path.

DrEngi commented 3 years ago

I'm encountering a similar issue. I installed dotnet according to the Alpine Linux installation docs, and I can manually run vsls-agent, which looks like its running successfully, but still the "Share" and "Join" buttons perform no action when clicked, and the VS code Window Log reports [error] command 'liveshare.startFromWelcomeContent' not found: Error: command 'liveshare.startFromWelcomeContent' not found.

When building the container, I can see the status updates from Live Share saying its downloading and installing dependencies, but after the installing status disappears, I see nothing else from Live Share.

dotnet --version reports 3.1.412, repairing my live share installation does not resolve the problem.

mrsufgi commented 3 years ago

I've been digging into this issue for the past few days. I had the same issue, clicking Share/Join no action + no contacts (= not working properly)

For more context, this only occurs when my docker-compose.yml uses a mounted volume for extensions:

      # Extensions
      # https://code.visualstudio.com/docs/remote/containers-advanced#_avoiding-extension-reinstalls-on-container-rebuild
      - vscode-extensions:/home/vscode/.vscode-server/extensions
      - vscode-extensions-insiders:/home/vscode/.vscode-server-insiders/extensions

After checking the logs I found libhostfxr.so was missing so I ran > Live Share: Repair Installation and it fixed it for me. Unfortunatly its not enough as I didn't want my teammates to rebuild and rerun this command everytime. so I dugged in and found that Repair is actually installing dotnet 3.1.4 into /home/${USERNAME}/.vscode-server/data/User/globalStorage/ms-vsliveshare.vsliveshare/dotnet-3.1.14

As a temporary fix I added those steps to my dockerfile. (the vsls was already there just adding it for reference)

# Install requirements for live sessions
RUN wget -O ~/vsls-reqs https://aka.ms/vsls-linux-prereq-script && \
    chmod +x ~/vsls-reqs && ~/vsls-reqs

# Fix dotnet for live sessions
RUN wget -O ~/dotnet-install.sh https://dot.net/v1/dotnet-install.sh && \
    chmod +x ~/dotnet-install.sh && ~/dotnet-install.sh -c 3.1 -i /home/${USERNAME}/.vscode-server/data/User/globalStorage/ms-vsliveshare.vsliveshare/dotnet-3.1.14 && \
    chown -R $USERNAME /home/${USERNAME}/.vscode-server/

You can also download 3.1.4 using and extract it to: https://download.visualstudio.microsoft.com/download/pr/4e5f17fa-fa56-40bc-bf3d-fd6abc91d0ad/08bd80f3751c0ac602dd41dc2534265e/dotnet-runtime-3.1.14-linux-x64.tar.gz (found it in live share code/settings)

Hope it helps it finally works!! <3

alyssajotice commented 3 years ago

@Xenoha and @DrEngi, can you try the steps provided by @mrsufgi and let me know if it works?

Xenoha commented 3 years ago

Hello @alyssajotice ,

I was forced to move away from alpine to ubuntu due to this issue and with that move, I don't have the old state or new updates.

Something should be posted in the live share extension about not being compatible with alpine. The extension should be all that is required if there are Microsoft installation requirements involved here. I'm glad @mrsufgi found a work-around, but that's what it is a work-around and not a fix.

DrEngi commented 3 years ago

Hey @alyssajotice, this did not resolve my issue. Same thing is happening.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically in 2 days.

bbedward commented 2 years ago

The steps from @mrsufgi do not work on an M1 mac, due to that there is no arm64 binary for .net 3.1 (there is only an x86_64 one)

derekbekoe commented 2 years ago

We’ve made improvements in this area since this issue was filed. Very recently, we removed the dependency on vsls-agent and the linux pre-reqs. We believe this may have improved your experience and are closing this issue. If this issue still persists for you, please comment on the issue and let us know. Thank you.