-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
debug: can't debug as root #1424
Comments
@RoryShively Thanks for the report. Can you please check if you still see the problem if you remove all |
@hyangah Good suggestion. I updated the script and output above to reflect the changes I made when deleting echo command. Still not working |
Just added some more details. I'm on ubuntu 20.04 Disabled firewall using |
Thanks @RoryShively We are currently actively working on a new version of debug adapter written in Go and integrated in dlv. (see overview and info Are you interested in trying it to see if you have a better luck? I got it working with the following step
dlv-sudo.sh
launch.json
FYI: to kill the orphaned |
@hyangah Perfect!!!!! This worked for me. Thanks, even though theres many issues raised around this topic I haden't come across this particular solution |
Glad to hear that it's working for you. if you find issues, please report them - dlv dap is still experimental and we do appreciate your feedback! Duplicate of #558 |
@hyangah this config works in terms of launching dlv-dap as root, but VSCode doesn't seem to detect the DAP server starting / isn't able to connect to it automatically. So, when setting up launch.json, settings.json, and dlv-sudo.sh as per the above, I can run and step through debugging in delve w/ dlv-dap adapter when DEBUG_AS_ROOT is false, but when setting DEBUG_AS_ROOT to true, I get a timeout error: "timed out while waiting for DAP server to start" However, running root 9599 0.2 0.0 1292932 13920 ? Sl 18:11 0:00 sudo /usr/local/go/bin/dlv-dap --only-same-user=false dap --listen=127.0.0.1:39991 --log-dest=3 (is it weird that there are two processes launching?) |
Same problem here |
Same here too. Linux Mint 20, Golang 1.16.5, vscode 1.57.0 Timed out waiting for DAP server to start. Two processes running (as root). |
Same here. macOS 11.6, Golang 1.17.1, VScode 1.60.2. Anyone found a solution for this? |
I'm using Golang 1.16.3 and vscode 1.62.2, I met the similar issue of |
I'm just catching up to everybody. Same thing here. not sure what else to try I've been banging away at this for hours. any other thoughts? I tried the legacy adapter setting, no change. restarting vscode between just in case... |
got my answer here for anybody else looking: |
Still not working Launch.json :
My settings.json
|
for what it's worth these are the notes I have on getting it to work... 3/6/2022 from here: in /etc/sudoers, add go to the end of the secure path.... Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/local/go/bin" if you get this: create a /etc/sudoers.d/dlv... root@kmod3:/etc/sudoers.d# cat dlv nixo ALL=(root)NOPASSWD:/home/nixo/go/bin/dlv obviously some of this is crap, but whatever, it works. so basically it has to be the legacy non-dap debugger. you have to run the script dlv-sudo.sh in global settings (you get there by settings->preferences-> search for "debug"
and the bit in the launch.config that makes it go for this launch configuration... "program": "${file}", also go ctrl-shift-p go install tools, just select everything again and reinstall everything for good mesaure |
Change https://go.dev/cl/406295 mentions this issue: |
Fixes #124 Fixes #558 Updates #1424 Change-Id: Ic2a32657c30e4a8ca238239c2200f870cf949732 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/406295 Reviewed-by: Suzy Mueller <suzmue@golang.org>
Please find the instruction in Please find instructions in https://github.com/golang/vscode-go/wiki/debugging#debugging-a-program-as-root |
Im trying to use a solution found in another issue found at microsoft/vscode-go#2889
My software versions
I used the solution found in the issue referenced above. My files are
settings.json
launch.json
dlv-sudo.sh
I also updated my
/etc/sudoers
file to allow my user to be able to startdlv
without entering a password and ranchmod +x dlv-sudo.sh
so everything should work correctly.I verified
dlv-sudo.sh
works by runningDEBUG_AS_ROOT=true dlv-sudo.sh
and was able to run dlv on the command line, the main difference is that vscode will rundlv
in headless mode whereas on the commandline it does notMy result running debug in vscode:
After this point it hangs indefinitely never starting or allowing me to play the debuger, step over, etc... I can only restart or stop the debugger
ps aux
shows these processes running, which will persist even after I stop the debuggerDebugging will work if I dont add the
go.alternateTools
setting insettings.json
but not usefull for me since I need to run my program as rootIve seen previous threads that seemed to fix the issue for others like the one I linked at the top of this issue but something has changed or doesn't work in my environment.
Is this a possible bug with vscode with newer versions of go and dlv or am I setting things up incorrectly on my side?
The text was updated successfully, but these errors were encountered: