-
Notifications
You must be signed in to change notification settings - Fork 304
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
sudo/root ports are not discovered #4654
Comments
Based on the logs, VS Code's port discovery simply isn't finding these ports:
@Chuxel How are you starting the process that you expect to see on the other two ports? |
@alexr00 All three are started as a result of an ENTRYPOINT in the image. So they're effectively happening at OS start. This is essentially what gets invoked that triggers all three: 2222 is SSH, 5901 is VNC (which it is catching), and 6080 is a web server running the noVNC web client (which under the hood connects to 5901). For 6080, I'd guess this would be:
For 2222, I'd guess this would be:
As I mentioned, 5901 is caught correctly as the following:
|
Thanks for all the details. I'm not familiar with how docker starts up containers, so these details made investigation much easier. Findings for 6080:
But for 364, I get a I had some trouble finding the process for the other missing port, but I assume it's the same deal. Looking at the ENTRYPOINT script (/usr/local/share/desktop-init.sh) I see this:
which looks to me as though the command that results in something listening on 6080 is running as Since we can't read the command line from the proc filesystem from for commands run with |
@alexr00 They are run as root rather than via sudo since this all happens before VS Code connects. This allows them to access system resources that a normal user can't. They're effectively daemons. The sudoIf is there in the event that someone has set the default user to something other than root... which is not the case in this image. Generally though this is a scenario we'll see. Doesn't a "permission denied" in this case confirm its presence? We could show it active even if we can't show the process that started it. The text could say "System process" or "Process running as root" in this case |
I'll have to play around with how I can get the appropriate information. I say I got a "permission denied", but that was just from my testing. Getting all the ports doesn't result in "permission denied", but matching the port with a pid does. In my testing, I skipped the step where the port is associated with a pid by doing some manual coming through processes and visual pattern matching. I might be able to come up with a heuristic (ex. run |
@Chuxel after doing some research, I found a way to get a bit better at finding the running process when the process is running as root. The heuristic is:
I think this will work most of the time, but I'm not a linux expert, so if someone knows of a reason this will be a problem I'm all ears. There is one major drawback, and that's that the command line must include the port number for this to work at all. In your example with this repo it only works for port 6080, since that one is part of a command line. Port 2222 will not be caught by this. I'm going to close this as the change improves things. If I find a better way, of course I will update. But I think this might be as good as its going to get. |
Sounds good! Thanks for looking into it! |
From @Chuxel:
There are three ports that are forwarded via forwardPorts in devcontainer.json. All three are valid and active.
Oddly two also do not say there are any running processes when in fact there is.
The text was updated successfully, but these errors were encountered: