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.

Inconsistent Environment on Linux

See original GitHub issue

Describe the bug The runner’s environment is populated with the contents of the .env file but ignores the operating system’s standard /etc/environment file. This leads to the situation that commands – depending on how they are invoked – see a different environment. This is most apparent with sudo.

To Reproduce Steps to reproduce the behavior:

  1. echo 'ENV_TEST=true' >>/etc/environment while building the runner
  2. Run env; sudo env within an action executed with the runner that has the /etc/environment line
  3. Notice that ENV_TEST is only available in sudo’s env

🔥 It is possible that this is an issue with https://github.com/actions-runner-controller/actions-runner-controller and not this project, I am here to find this out. 😉

Expected behavior I would expect that every command’s environment is prepopulated with the values from /etc/environment since that is the operating system’s standard. I guess it could also make sense to argue in another direction, but then no program should ever see the values from /etc/environment; this is definitely going to be significantly harder to achieve than sourcing /etc/environment before .env in LoadAndSetEnv so that .env overwrites anything in /etc/environment.

Note that the separation between /etc/environment and .env would also allow setting environment variables for all users and the runner user separately.

Runner Version and Platform

All Linux versions are affected, and I am specifically coming from https://github.com/actions-runner-controller/actions-runner-controller/issues/1135.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Fleshgrindercommented, Feb 28, 2022

I test my idea from above and it works as expected. I am not yet entirely sure if it should be exec env -- or exec env -i -- but that is something for ARC. Thanks again everyone, and I might come back to your offer @ethomson. 😉

1reaction
ruvceskistefancommented, Feb 21, 2022

Hi @Fleshgrinder, Thanks for filing this issue! We are investigating the bug you described, so we will get back to you as soon as we have more informations.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The environment is inconsistent, please check the package ...
It is likely that your environment was inconsistent for some time but the upgrade to conda made it visible. The best option it...
Read more >
The environment is inconsistent, please check the package ...
Inconsistency is when the packages you actually have don't match the dependency requirements for those same packages. For example, with ...
Read more >
The environment is inconsistent, please check the package ...
A step-by-step guide on how to solve the Anaconda error "The environment is inconsistent, please check the package plan carefully".
Read more >
Conda environment inconsistent - Technical Help
On a clean install of QR 2.5.0, I noticed that the conda environment is inconsistent out of the box. When attempting to install...
Read more >
Inconsistent environment even after fresh install
After struggling with seemingly unresolvable package inconsistency issues and the apparent inability of conda update to ever do anything but ...
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