question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Terminal does not load user paths or env variables

See original GitHub issue
  • code-server version: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

  1. go – Output Command 'go' not found,
  2. source ~/.profile
  3. go version – Output: go version go1.12 linux/amd64

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
alexfornutocommented, Aug 9, 2021

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 $PATH are different between the terminal in code-server and the one I get from an SSH session.

1reaction
bketelsencommented, Mar 14, 2019

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 > myenv then add EnvironmentFile=/path/to/myenv which would get the currently set environment variables. Beware, that might be a security risk.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found