Terminal does not load user paths or env variables
See original GitHub issuecode-serverversion:1.32.0-245- OS Version: Ubuntu 18.04
Description
Custom binary paths are not loading from the users .profile or /etc/profile on ubuntu. For example, I have go installed on the ubuntu machine. In my ~/.profile, I have the path to export PATH=$GOPATH/bin:$GOROOT/bin:$PATH. On a standard ssh terminal the go binary loads. The terminal in VSCode does not load any custom paths. I have to run source ~/.profile. This has to be done on each load of a new terminal.
Steps to Reproduce
go– OutputCommand 'go' not found,source ~/.profilego version– Output:go version go1.12 linux/amd64
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Integrated terminal does not load PATH environment variable ...
Click on Environment Variables and search for the Path variable in the user environment variable (not the system). If none exist add a...
Read more >Windows open command window here doesn't load env ...
When environment variables are added or changed, currently open Command windows must be closed and re-opened to see the changes.
Read more >Environment Variables in Windows/macOS/Linux
Environment variables are global system variables accessible by all the processes/users running under the Operating System (OS), such as Windows, macOS and ...
Read more >How do I set or change the PATH system variable? - Java
In the section System Variables find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist,...
Read more >about Environment Variables - PowerShell | Microsoft Learn
Environment variables, unlike other types of variables in PowerShell, are always stored as a string and can't be empty.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Sorry to comment on such an old thread, but it’s the closest I’ve found to a solution for myself. @bketelsen, could you expand on how someone using code-server as a system service could modify the daemon to use the user’s environment?
Context: My instance of code-server is secured via an identity-aware proxy, so I’m not worried about the security risk. The values in my
$PATHare different between the terminal in code-server and the one I get from an SSH session.systemd doesn’t get your environment. You need to use the Environment or EnvironmentFile directives to set environment variables. Quick (probably foolish) hack would be to
env > myenvthen addEnvironmentFile=/path/to/myenvwhich would get the currently set environment variables. Beware, that might be a security risk.