-1

I boot up ubuntu using Vagrant to compile some C code, now i like to debug this code using Visual Studio Code.
How can i setup some kind of remote debug where the compiler and source code and all on the Ubuntu VM
And I only using VSCode from windows?
PS.
This used to work very well with windows WSL linux .
But now i like to achieve the same result with Ubuntu using Vagrant ( using Virtual Box ). Can it be done? UPDATE I tried as suggested but I'm getting error :

my virtual box config from vscode :

Host 127.0.0.1:2222
  HostName 127.0.0.1:2222
  IdentityFile c:/HashiCorp/ubuntu-20.04/.vagrant/machines/default/virtualbox/private_key
  User vagrant

The error :

[13:27:45.945] "install" terminal command done
[13:27:45.945] Install terminal quit with output: The process tried to write to a nonexistent pipe.
[13:27:45.945] Received install output: The process tried to write to a nonexistent pipe.
[13:27:45.950] Resolver error: Error: The process tried to write to a nonexistent pipe
    at Function.Offline (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:64330)
    at c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:59961
    at Object.t.handleInstallOutput (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:60339)
    at I (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:311112)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
    at async c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:309029
    at async Object.t.withShowDetailsEvent (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:403706)
    at async Object.t.resolve (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:312426)
    at async c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:127:110280
[13:27:45.954] ------
user63898
  • 29,839
  • 85
  • 272
  • 514
  • Is OpenSSH for Windows [installed](https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse) (or a "compatible" SSH client that takes the same arguments)? Can you ssh successfully from PowerShell or cmd into the the VM using that client? – NotTheDr01ds Jan 14 '21 at 17:49
  • Also, check out [this answer](https://stackoverflow.com/a/60336057/11810933) for a resolution to an error very similar to the one you have. – NotTheDr01ds Jan 14 '21 at 17:52

1 Answers1

0

Yes, as long as you have SSH configured in the VM, you can use the Remote - SSH extension as I detailed in this answer.

NotTheDr01ds
  • 15,620
  • 5
  • 44
  • 70