Skip to content
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

integrated terminal unexpected result running command w #8799

Closed
itzsimpl opened this issue May 30, 2023 · 9 comments
Closed

integrated terminal unexpected result running command w #8799

itzsimpl opened this issue May 30, 2023 · 9 comments
Assignees

Comments

@itzsimpl
Copy link

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.78.2, b3e4e68a0bc097f0ae7907b217c1119af9e03435
  • OS Version Remote: ubuntu 20.04
  • OS Version Host: Ventura 13.4

Steps to Reproduce:

  1. Establish a remote session to ubuntu 20.04
  2. open integrated terminal
  3. execute command w
  4. nothing shows up

Expected Behaviour:

  1. logged in user listed

Alternatives:

  1. Any other way to determine if a user is currently logged in / actively using the remote system via vscode?
@Tyriar
Copy link
Member

Tyriar commented Aug 3, 2023

Can you try enabling trace logging mode (F1 > Set Log Level > Trace) and pasting in the content from the "Terminal" channel in the Output panel? This will tell us what the shell process is telling the terminal to do which will identify whether it's an issue with rendering or the process telling us the wrong thing.

/label "info-needed"

@vscodenpa vscodenpa added the info-needed Issue requires more information from poster label Aug 3, 2023
@itzsimpl
Copy link
Author

itzsimpl commented Aug 3, 2023

This is the output that I see in vscode's Terminal window

ubuntu@srv:~$ w
 23:08:24 up 56 days, 11:16,  0 users,  load average: 0.85, 0.94, 1.26
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
ubuntu@srv:~$ 

and the log that I see in the Output tab (with trace logging enabled)

2023-08-04 01:08:23.854 [debug] [1691104] sending data "w" [[119]]
2023-08-04 01:08:24.076 [debug] [1691104] parsing data "w" [[119]]
2023-08-04 01:08:24.487 [debug] [1691104] sending data "
" [[13]]
2023-08-04 01:08:24.768 [debug] [1691104] parsing data "
�]633;C��]633;E;w;0f96ac45-2f40-4cb1-9ea1-168f3ad43f20�" [[13,10,27,93,54,51,51,59,67,7,27,93,54,51,51,59,69,59,119,59,48,102,57,54,97,99,52,53,45,50,102,52,48,45,52,99,98,49,45,57,101,97,49,45,49,54,56,102,51,97,100,52,51,102,50,48,7]]
2023-08-04 01:08:24.769 [debug] [1691104] CommandDetectionCapability#handleCommandExecuted [0,1]
2023-08-04 01:08:24.769 [debug] [1691104] CommandDetectionCapability#setCommandLine ["w",true]
2023-08-04 01:08:24.775 [debug] [1691104] parsing data " 23:08:24 up 56 days, 11:16,  0 users,  load average: 0.85, 0.94, 1.26
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
�]633;D;0��]633;P;Cwd=/home/ubuntu��]633;A��]0;ubuntu@srv: ~��[01;32mubuntu@srv�[00m:�[01;34m~�[00m$ �]633;B�" [[32,50,51,58,48,56,58,50,52,32,117,112,32,53,54,32,100,97,121,115,44,32,49,49,58,49,54,44,32,32,48,32,117,115,101,114,115,44,32,32,108,111,97,100,32,97,118,101,114,97,103,101,58,32,48,46,56,53,44,32,48,46,57,52,44,32,49,46,50,54,13,10,85,83,69,82,32,32,32,32,32,84,84,89,32,32,32,32,32,32,70,82,79,77,32,32,32,32,32,32,32,32,32,32,32,32,32,76,79,71,73,78,64,32,32,32,73,68,76,69,32,32,32,74,67,80,85,32,32,32,80,67,80,85,32,87,72,65,84,13,10,27,93,54,51,51,59,68,59,48,7,27,93,54,51,51,59,80,59,67,119,100,61,47,104,111,109,101,47,117,98,117,110,116,117,7,27,93,54,51,51,59,65,7,27,93,48,59,117,98,117,110,116,117,64,108,112,116,45,100,58,32,126,7,27,91,48,49,59,51,50,109,117,98,117,110,116,117,64,108,112,116,45,100,27,91,48,48,109,58,27,91,48,49,59,51,52,109,126,27,91,48,48,109,36,32,27,93,54,51,51,59,66,7]]
2023-08-04 01:08:24.775 [debug] [1691104] CommandDetectionCapability#handleCommandFinished [0,3,"w",{"commandExecutedMarker":{"line":1,"isDisposed":false,"_disposables":[{"_listeners":[null],"_disposed":false},{},{},{},{}],"_id":10,"_onDispose":{"_listeners":[null],"_disposed":false}},"commandExecutedX":0,"command":"w","isTrusted":true,"commandFinishedMarker":{"line":3,"isDisposed":false,"_disposables":[{"_listeners":[null],"_disposed":false},{},{},{},{}],"_id":11,"_onDispose":{"_listeners":[null],"_disposed":false}},"promptStartMarker":{"line":0,"isDisposed":false,"_disposables":[{"_listeners":[null],"_disposed":false},{},{},{},{}],"_id":7,"_onDispose":{"_listeners":[null],"_disposed":false}},"commandStartMarker":{"line":0,"isDisposed":false,"_disposables":[{"_listeners":[null,null],"_disposed":false},{},{},{},{}],"_id":8,"_onDispose":{"_listeners":[null,null],"_disposed":false}},"commandStartX":16}]
2023-08-04 01:08:24.776 [debug] [1691104] CommandDetectionCapability#onCommandFinished [{"command":"w","isTrusted":true,"marker":{"line":0,"isDisposed":false,"_disposables":[{"_listeners":[null,null],"_disposed":false},{},{},{},{}],"_id":8,"_onDispose":{"_listeners":[null,null],"_disposed":false}},"endMarker":{"line":3,"isDisposed":false,"_disposables":[{"_listeners":[null],"_disposed":false},{},{},{},{}],"_id":11,"_onDispose":{"_listeners":[null],"_disposed":false}},"executedMarker":{"line":1,"isDisposed":false,"_disposables":[{"_listeners":[null],"_disposed":false},{},{},{},{}],"_id":10,"_onDispose":{"_listeners":[null],"_disposed":false}},"timestamp":1691104104775,"cwd":"/home/ubuntu","exitCode":0}]
2023-08-04 01:08:24.778 [debug] [1691104] CommandDetectionCapability#handlePromptStart [0,3]
2023-08-04 01:08:24.779 [debug] [1691104] CommandDetectionCapability#handleCommandStart [16,3]
2023-08-04 01:08:25.992 [trace] [1691104] terminalMultiLineLinkDetector#detect text ["ubuntu@srv:~$ "]
2023-08-04 01:08:25.992 [trace] [1691104] terminalLocalLinkDetector#detect text ["ubuntu@srv:~$ "]
2023-08-04 01:08:25.992 [trace] [1691104] terminalLocalLinkDetector#detect parsedLinks [[]]
2023-08-04 01:08:26.008 [trace] [1691104] terminalMultiLineLinkDetector#detect text ["USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT"]
2023-08-04 01:08:26.008 [trace] [1691104] terminalLocalLinkDetector#detect text ["USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT"]
2023-08-04 01:08:26.009 [trace] [1691104] terminalLocalLinkDetector#detect parsedLinks [[]]
2023-08-04 01:08:26.025 [trace] [1691104] terminalMultiLineLinkDetector#detect text [" 23:08:24 up 56 days, 11:16,  0 users,  load average: 0.85, 0.94, 1.26"]
2023-08-04 01:08:26.026 [trace] [1691104] terminalMultiLineLinkDetector#detect candidate ["23:08"]
2023-08-04 01:08:26.026 [trace] [1691104] terminalLocalLinkDetector#detect text [" 23:08:24 up 56 days, 11:16,  0 users,  load average: 0.85, 0.94, 1.26"]
2023-08-04 01:08:26.026 [trace] [1691104] terminalLocalLinkDetector#detect parsedLinks [[{"path":{"index":1,"text":"23:08"},"suffix":{"row":24,"suffix":{"index":6,"text":":24"}}},{"path":{"index":10,"text":"up"},"suffix":{"row":56,"suffix":{"index":12,"text":" 56"}}},{"path":{"index":16,"text":"days,"},"suffix":{"row":11,"col":16,"suffix":{"index":21,"text":" 11:16"}}},{"path":{"index":45,"text":"average:"},"suffix":{"row":0,"suffix":{"index":53,"text":" 0"}}},{"path":{"index":54,"text":"0.85,"},"suffix":{"row":0,"suffix":{"index":59,"text":" 0"}}},{"path":{"index":60,"text":"0.94,"},"suffix":{"row":1,"suffix":{"index":65,"text":" 1"}}}]]
2023-08-04 01:08:26.027 [trace] [1691104] terminalLinkHelpers#updateLinkWithRelativeCwd cwd ["/home/ubuntu"]
2023-08-04 01:08:26.027 [trace] [1691104] terminalLocalLinkDetector#detect linkCandidates [["/home/ubuntu/23:08"]]
2023-08-04 01:08:26.092 [trace] [1691104] terminalMultiLineLinkDetector#detect text ["ubuntu@srv:~$ w"]
2023-08-04 01:08:26.092 [trace] [1691104] terminalLocalLinkDetector#detect text ["ubuntu@srv:~$ w"]
2023-08-04 01:08:26.093 [trace] [1691104] terminalLocalLinkDetector#detect parsedLinks [[]]
2023-08-04 01:08:26.194 [trace] [1691104] terminalLinkHelpers#updateLinkWithRelativeCwd cwd ["/home/ubuntu"]
2023-08-04 01:08:26.195 [trace] [1691104] terminalLocalLinkDetector#detect linkCandidates [["/home/ubuntu/up"]]
2023-08-04 01:08:26.286 [trace] [1691104] terminalLinkHelpers#updateLinkWithRelativeCwd cwd ["/home/ubuntu"]
2023-08-04 01:08:26.286 [trace] [1691104] terminalLocalLinkDetector#detect linkCandidates [["/home/ubuntu/days,"]]
2023-08-04 01:08:26.378 [trace] [1691104] terminalLinkHelpers#updateLinkWithRelativeCwd cwd ["/home/ubuntu"]
2023-08-04 01:08:26.378 [trace] [1691104] terminalLocalLinkDetector#detect linkCandidates [["/home/ubuntu/average:"]]
2023-08-04 01:08:26.476 [trace] [1691104] terminalLinkHelpers#updateLinkWithRelativeCwd cwd ["/home/ubuntu"]
2023-08-04 01:08:26.476 [trace] [1691104] terminalLocalLinkDetector#detect linkCandidates [["/home/ubuntu/0.85,"]]
2023-08-04 01:08:26.576 [trace] [1691104] terminalLinkHelpers#updateLinkWithRelativeCwd cwd ["/home/ubuntu"]
2023-08-04 01:08:26.576 [trace] [1691104] terminalLocalLinkDetector#detect linkCandidates [["/home/ubuntu/0.94,"]]

If I then connect to the server via a separate ssh session, tis session is visible, but the session established by vscode's terminal window is invisible

ubuntu@srv:~$ w
 23:12:57 up 56 days, 11:20,  1 user,  load average: 0.59, 0.78, 1.11
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
ubuntu   pts/1    ....   23:12    1.00s  0.09s  0.04s w

This (separete) session is then visible also in the vscode Terminal window, so I guess it is not a rendering issue.

@Tyriar
Copy link
Member

Tyriar commented Aug 4, 2023

Does changing gpu acceleration help? https://code.visualstudio.com/docs/terminal/appearance#_gpu-acceleration

@itzsimpl
Copy link
Author

itzsimpl commented Aug 4, 2023

I have switched gpu acceleration off and there is no change. Shouldn't already the Remote-SSH connection be visible, i.e. if one connects to a remote sever using Remote-SSH, without then opening a terminal window.

@Tyriar
Copy link
Member

Tyriar commented Aug 4, 2023

@roblourens do you know anything about the terminal being blank in remote-ssh?

@yume-chan
Copy link

I think OP doesn't mean the terminal is blank, but the w command doesn't output connected users.

This is the output that I see in vscode's Terminal window

ubuntu@srv:~$ w
 23:08:24 up 56 days, 11:16,  0 users,  load average: 0.85, 0.94, 1.26
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
ubuntu@srv:~$ 

Maybe that's because Code creates the ssh connection with -T argument (disable pseudo-terminal allocation).

@Tyriar
Copy link
Member

Tyriar commented Aug 4, 2023

Oh thanks, I didn't know w was a command. This is a remote-ssh question then.

@Tyriar Tyriar removed the info-needed Issue requires more information from poster label Aug 4, 2023
@Tyriar Tyriar transferred this issue from microsoft/vscode Aug 4, 2023
@Tyriar Tyriar assigned roblourens and unassigned Tyriar Aug 4, 2023
@itzsimpl
Copy link
Author

itzsimpl commented Aug 13, 2023

Any news on this?

A little background on what is the use case; we have a multi-user system, where multiple users use the vscode Remote SSH feature to access it. For mainatance of the system it would be very valuable to know when, and which, users are actively using the system (e.g. via the w command), so as to prevent any dataloss caused by upgrading and rebooting the system while in use.

Another related thing is that when Remote SSH creates the ssh session the output is logged in the OUTPUT pane (View > Output). One common approach for providing important messages to SSH users is via the Banner feature in sshd_config. However, since the SSH session that vscode Remote SSH creates is logged in solely in the OUTPUT pane, most users who access the system via vscode Remote SSH and focus on the Terminal window, will miss it, which defies the banner's notification function altogether.

Any chance of passing this information to every Terminal session that the user opens? Or any other way of pushing a server side notification to the users? I would like to have some means to discover active users, and the ability to notify the active users that the system is about to be rebooted/shutdown to avoid data loss.

@roblourens
Copy link
Member

I think we need to revisit the -T parameter, although it was required for some configurations, I have an issue to investigate that here: #7558

@github-actions github-actions bot locked and limited conversation to collaborators Oct 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants