loft-sh / devpod

Codespaces but open-source, client-only and unopinionated: Works with any IDE and lets you use any cloud, kubernetes or just localhost docker.
https://devpod.sh
Mozilla Public License 2.0
8.64k stars 319 forks source link

Error running devpod with fish: 'fatal didn't receive a result back from agent' #1235

Open atlasfoo opened 2 weeks ago

atlasfoo commented 2 weeks ago

What happened?

Downloaded Devpod binaries at official site in .tar.gz format for Manjaro Linux, trying to run a sample devcontainer with local docker provider and it failed immediately. Starting the same devcontainer from vscode works fine.

Stack trace

21:22:22 info Workspace vscode-remote-try-dotnet already exists
21:22:22 debug Acquire workspace lock...
21:22:22 debug Acquired workspace lock...
21:22:22 info Creating devcontainer...
21:22:22 debug Inject and run command: '/usr/local/bin/devpod' helper ssh-server --stdio --debug
21:22:22 debug Attempting to create SSH client
21:22:22 debug Execute command locally
21:22:23 debug SSH client created
21:22:23 debug SSH session created
21:22:23 info Execute SSH server command: fish -c '/usr/local/bin/devpod' agent workspace up --workspace-info '****' --debug
21:22:23 info Use /home/user/.devpod/agent/contexts/default/workspaces/vscode-remote-try-dotnet as workspace dir
21:22:23 debug Connection to SSH Server closed
21:22:23 debug Done executing ssh server helper command
21:22:23 debug Done creating devcontainer
21:22:23 fatal didn't receive a result back from agent

No docker image was downloaded neither a container was created. Docker is accessible for both my user and root.

Local Environment:

DevPod Provider:

pascalbreuninger commented 2 weeks ago

Hi @atlasfoo, thanks for reporting this issue. Could you try to set you default shell to a non-fish one and try again to see if this is the problem please?

atlasfoo commented 2 weeks ago

Yep, doing that worked fine.

I've changed my default shell to zsh (using chsh because logging into zsh was not enough) and it worked fine. I could even boot into the container using vscode.

Is there an issue with fish shell?

pascalbreuninger commented 2 weeks ago

Perfect, at least there’s a possible remedy. I’ll leave this ticket open for now in case someone wants to take a stab at it. we’ve had problem with fish before, I can't remember why specifically though

atlasfoo commented 1 week ago

I found the problem. It was my custom configuration that I had in my config.fish file where I configured a custom prompt and stuff like that.

It seems that when you have customizations in the file, they run every time a fish -c command is called, so this processes somewhat get on the way of devpod agent workspace up, that is the process that was failing before.

The solution was to move the customizations inside the if status is-interactive case.

From this

if status is-interactive
    # Commands to run in interactive sessions can go here
end
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

# customizations

to this

if status is-interactive
    # Commands to run in interactive sessions can go here
    eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

    # customizations
end

Doing that change the command succeeds when using fish.

devpod up . --debug
20:26:02 info Workspace vscode-remote-try-dotnet already exists
20:26:02 debug Acquire workspace lock...
20:26:02 debug Acquired workspace lock...
20:26:02 info Creating devcontainer...
20:26:02 debug Inject and run command: '/usr/local/bin/devpod' helper ssh-server --stdio --debug
20:26:02 debug Attempting to create SSH client
20:26:02 debug Execute command locally
20:26:02 debug SSH client created
20:26:02 debug SSH session created
20:26:02 info Execute SSH server command: fish -c '/usr/local/bin/devpod' agent workspace up --workspace-info '****' --debug
20:26:02 info Use /home/atlasfoo/.devpod/agent/contexts/default/workspaces/vscode-remote-try-dotnet as workspace dir
20:26:02 debug Created logger
20:26:02 debug Received ping from agent
20:26:02 debug Credentials server started on port 15978...
20:26:03 debug Incoming client connection at /
20:26:03 debug Credentials server started...
20:26:03 debug Workspace Folder already exists /home/atlasfoo/repos/vscode-remote-try-dotnet
20:26:03 debug Workspace exists, skip downloading
20:26:03 debug Using docker command 'docker'
20:26:04 debug execute inject script
20:26:04 debug Received line after pong: done
20:26:04 debug done injecting
20:26:04 debug done inject
20:26:04 debug Done InjectAgentAndExecute
20:26:04 debug Injected into container
20:26:04 debug done exec
20:26:04 info Setup container...
20:26:04 debug Attempting to create SSH client
20:26:04 debug Inject and run command: '/usr/local/bin/devpod' helper ssh-server --stdio --debug
20:26:04 debug SSH client created
20:26:04 debug SSH session created
20:26:04 info Execute SSH server command: bash -c '/usr/local/bin/devpod' agent container setup --setup-info '***' --container-workspace-info '***' --chown-workspace --inject-git-credentials --debug
20:26:04 debug Created logger
20:26:04 debug Received ping from agent
20:26:04 debug Start setting up container...
20:26:04 debug Credentials server started on port 13913...
20:26:05 debug Incoming client connection at /
20:26:05 debug Credentials server started...
20:26:05 debug Patch etc environment & profile...
20:26:05 debug Run lifecycle hooks commands...
20:26:05 debug running user env probe with shell "bash", probe "loginInteractiveShell", user "vscode" and command "cat /proc/self/environ"
20:26:05 debug Done setting up environment
20:26:05 debug Unset setup system credential helper
20:26:05 error unset system credential helper exit status 5
20:26:05 debug Connection to SSH Server closed
20:26:05 debug Done setting up container
20:26:05 debug Done executing ssh server helper command
20:26:05 debug Connection to SSH Server closed
20:26:05 debug Done executing ssh server helper command
20:26:05 debug Done creating devcontainer

So that was it. I´d like to contribute with this annotation in the docs if you like.

Thanks 💪🏼

pascalbreuninger commented 1 week ago

@atlasfoo very cool, thanks for digging in!

I´d like to contribute with this annotation in the docs if you like.

That'd be fantastic! What do you think of a dedicated "linux troubleshooting" page here? Well strictly speaking other OSs could also use the fish shell but I bet the chances are 95% fish users are on linux