Howto::VScode: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 25: | Line 25: | ||
== Troubleshooting == | == Troubleshooting == | ||
* It is common to run into issues with vscode and remote SSH | * It is common to run into issues with vscode and remote SSH | ||
* The first step to identifying the problem is to determine if the problem is with VS Code and it's server component or an SSH connectivity problem | |||
** You can do this by opening a command prompt and run the command <code>ssh <username>@rlogin.cs.vt.edu</code> replace <username> with your CS username | |||
** If you can successfully connect this way, then the problem is likely a configuration issue with VS Code | |||
** If this does not work, then the problem is likely SSH. | |||
=== Troubleshooting VS Code === | |||
* First try resetting the remote side by issuing the VS code command (ctrl-shift-p): "Remote-SSH: Kill VS Code Server on Host..." | * First try resetting the remote side by issuing the VS code command (ctrl-shift-p): "Remote-SSH: Kill VS Code Server on Host..." | ||
* Make sure you are running the latest version of "Remote -SSH" extension (ctrl-shift-x) and that it is reloaded | |||
* Check the extension settings by hitting (ctrl-shift-x) and click on the "gear" icon under "Remote - SSH" and select "Extension Settings" | |||
** Common settings: | |||
** Make sure that "Remote Platform" is set to linux for rlogin.cs.vt.edu | |||
** Make sure that "Config File" is set to a valid value, this is generally left blank | |||
** Make sure that "Path" is set to a valid value, this is generally left blank which means it will use the Windows SSH client | |||
* Lastly, you can try using SSH to connect rlogin.cs.vt.edu and manually remove the VS Code server directory by running the command <code>rm -rf ~/.vscode-server</code> | |||
* If you still are unable to connect VS Code to rlogin.cs.vt.edu, then [[Contact Techstaff]] Sometimes a VS Code server component will get stuck and need to be killed | |||
=== Troubleshooting SSH === | |||
* If you get an error such as "''not recognized as an internal or external command...''" then make sure you have the Windows SSH client installed | |||
* If you get an error such as "''Permission denied, please try again''" then make sure you are using your CS username and that it is all lowercase. You can test your CS password online at https://admin.cs.vt.edu and reset the password at https://admin.cs.vt.edu/reset/ | |||
* If SSH seems to accept your password but hangs for a while and then times out, then you there might be an issue with your bash init scripts (.bashrc and .bash_profile). Try connecting again and hit <ctrl>-c while it hangs to break the loop. This should let you in so that you can fix your bash init scripts. | |||
* If you still are unable to SSH into rlogin.cs.vt.edu, then [[Contact Techstaff]] |
Revision as of 11:23, 1 April 2022
Introduction
Visual Studio Code (vscode) is an increasing popular way of developing software on rlogin.cs.vt.edu. With the appropriate plugin, it will allow you directly edit your files on rlogin.cs.vt.edu and make it easy to get a terminal to run and test your code. These instructions are geared toward the Windows version of vscode, but should be easily adaptable to other operation systems. These instruction also assume that you already have the latest version of vscode installed locally.
Plugin installation and configuration
- Make sure you also have an SSH client: https://code.visualstudio.com/docs/remote/troubleshooting#_installing-a-supported-ssh-client
- Click on the "Gear" icon and select "Extensions" OR push <ctr>-<shift>-x
- Search for "Remote - SSH"
- Click the "Install" button
- This should give you a small green button (bottom left) with "><" icon
- Click on the green button and select "Connect to host..."
- Select "+ Add New SSH Host..."
- Type in "<username>@rlogin.cs.vt.edu -A" change <username> to your CS username
- It should give you a dialog saying the host was added and a button to "Connect"
- When you first connect it will ask you what platform the host is, select "Linux"
- It will also likely ask for your password unless you already have a SSH key set up
- Once connected, the green button should update with "SSH: rlogin.cs.vt.edu" letting you know you are connected remotely
Set up SSH key authentication
- Setting up a public/private key will save you from having to enter your password so many times while using vscode
- While inside VS Code, hit <ctrl>-o to open a file, open the local file: "c:\Users\<username>\.ssh\id_rsa.pub" If this file does not exist, then you can run "ssh-keygen" from the command to generate the file
- Copy the whole contents of this file
- Use VS code to edit the remote file: ~/.ssh/authorized_keys (if this is your first time, then you might have to create it as a new text file)
- Alternately, you use the command line to SSH into rlogin.cs.vt.edu and edit the file directly using the command `nano ~/.ssh/authorized_keys`
Troubleshooting
- It is common to run into issues with vscode and remote SSH
- The first step to identifying the problem is to determine if the problem is with VS Code and it's server component or an SSH connectivity problem
- You can do this by opening a command prompt and run the command
ssh <username>@rlogin.cs.vt.edu
replace <username> with your CS username - If you can successfully connect this way, then the problem is likely a configuration issue with VS Code
- If this does not work, then the problem is likely SSH.
- You can do this by opening a command prompt and run the command
Troubleshooting VS Code
- First try resetting the remote side by issuing the VS code command (ctrl-shift-p): "Remote-SSH: Kill VS Code Server on Host..."
- Make sure you are running the latest version of "Remote -SSH" extension (ctrl-shift-x) and that it is reloaded
- Check the extension settings by hitting (ctrl-shift-x) and click on the "gear" icon under "Remote - SSH" and select "Extension Settings"
- Common settings:
- Make sure that "Remote Platform" is set to linux for rlogin.cs.vt.edu
- Make sure that "Config File" is set to a valid value, this is generally left blank
- Make sure that "Path" is set to a valid value, this is generally left blank which means it will use the Windows SSH client
- Lastly, you can try using SSH to connect rlogin.cs.vt.edu and manually remove the VS Code server directory by running the command
rm -rf ~/.vscode-server
- If you still are unable to connect VS Code to rlogin.cs.vt.edu, then Contact Techstaff Sometimes a VS Code server component will get stuck and need to be killed
Troubleshooting SSH
- If you get an error such as "not recognized as an internal or external command..." then make sure you have the Windows SSH client installed
- If you get an error such as "Permission denied, please try again" then make sure you are using your CS username and that it is all lowercase. You can test your CS password online at https://admin.cs.vt.edu and reset the password at https://admin.cs.vt.edu/reset/
- If SSH seems to accept your password but hangs for a while and then times out, then you there might be an issue with your bash init scripts (.bashrc and .bash_profile). Try connecting again and hit <ctrl>-c while it hangs to break the loop. This should let you in so that you can fix your bash init scripts.
- If you still are unable to SSH into rlogin.cs.vt.edu, then Contact Techstaff