Solved vscode (and go) on FreeBSD

Virgin FreeBSD install to include xfce, login as user, open terminal, can't use pkg to install go/vscode (not enough privileges). su to increase privs. pkg install both apps (they install as root:wheel), exit back to user. mkdir ~/go/subdirs. exit terminal back to xfce desktop, create a launcher for vscode, launch vscode & install go extension. simple 'hello, world' program, go build to make binary.

Now here is the trouble. I try to debug the binary using dlv (which was installed by vscode as user:user) and it fails with this message:
Code:
"could not launch process: fork/exec /usr/home/user/go/src/hello/hello: operation not permitted"
Looks like a permissions problem, right? But as above, the owner of dlv is user:user and the permissions allow execution for anyone. I even changed all the ownerships of vscode (and links to code-oss) to user:user. Same 'operation not permitted' error when invoking dlv.

If I subvert the "don't log in as root" rule, and run vscode as root, it debugs without problems but vscode complains about being used as root and other problems surface.

I've stared at this for a couple of days and I'm stumped. Any ideas?

(I have lots of experience with vscode on Windows)
 
Looks like a permissions problem, right?
Not necessarily.

I even changed all the ownerships of vscode
That's actually completely irrelevant even if it was a permission issue.

If I subvert the "don't log in as root" rule, and run vscode as root, it debugs without problems but vscode complains about being used as root and other problems surface.
Did you enable a bunch of those security sysctl(8) during the install? I'm going to bet it's one of them that's blocking debug access for regular users. Specifically this one:
Code:
# sysctl -d  security.bsd.unprivileged_proc_debug
security.bsd.unprivileged_proc_debug: Unprivileged processes may use process debugging facilities
 
Hah!

I didn't set any hardening during the install, but the default value of

Code:
security.bsd.unprivileged_proc_debug = 0

So I changed it to = 1 and PRESTO, now it works.

Thank you so much, SirDice!

I can't see how to mark this as solved, so please feel free to do so.
 
Back
Top