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

autoinstall: Don't use snap env when invoking early and late commands #1811

Conversation

Chris-Peterson444
Copy link
Collaborator

LP #2032961: We are not cleaning the environment provided to subprocesses correctly. When trying to invoke a program that should run outside of the snap context, the LD_LIBRARY_PATH variable is pointing to the linker on the snap, which causes errors like:

curl: /lib/x86_64-linux-gnu/libc.so/6: version `GLIBC_2.33` not found (required by /snap/subiquity/x1/usr/lib/x86_64-linux-gnu/libpsl.so.5)

We had a similar issue solved in #1300. This fix similarly uses orig_environ to clean the environment before running commands in the respective command controllers.

I would especially appreciate some input if the license header on the new test file looks correct. It's an exact copy and paste from one of the other new tests files from this year, but I just want to be sure.

Copy link
Member

@ogayot ogayot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from the code standpoint, thanks!

I am concerned about breaking the ability to run curtin in-target [...] in late-commands though. I think we need to think about what it means for autoinstall users who are going to take a new subiquity snap.

subiquity/server/controllers/cmdlist.py Outdated Show resolved Hide resolved
subiquity/server/controllers/tests/test_cmdlist.py Outdated Show resolved Hide resolved
subiquitycore/tests/mocks.py Show resolved Hide resolved
@Chris-Peterson444 Chris-Peterson444 force-pushed the lp-2032961-clean-environment-commands branch from a0a7bba to 7261d6c Compare October 2, 2023 21:49
subiquitycore/utils.py Outdated Show resolved Hide resolved
subiquity/server/controllers/cmdlist.py Outdated Show resolved Hide resolved
subiquity/server/controllers/tests/test_cmdlist.py Outdated Show resolved Hide resolved
@Chris-Peterson444 Chris-Peterson444 force-pushed the lp-2032961-clean-environment-commands branch 2 times, most recently from 10100ba to 196667b Compare October 2, 2023 23:39
@Chris-Peterson444 Chris-Peterson444 force-pushed the lp-2032961-clean-environment-commands branch 2 times, most recently from b470bcb to fa20e09 Compare October 3, 2023 03:18
@Chris-Peterson444 Chris-Peterson444 force-pushed the lp-2032961-clean-environment-commands branch from fa20e09 to 0d03eea Compare October 3, 2023 16:15
@dbungert
Copy link
Collaborator

dbungert commented Oct 3, 2023

I believe the requested changes from @ogayot are resolved - if that's in error let's fix that later, as he's not available right now to comment further.

@Chris-Peterson444 - one last check - have you tried this in a VM and confirmed that doing curtin in-target does the right thing?

@Chris-Peterson444
Copy link
Collaborator Author

I tested in a VM with curl but I haven't tested curtin in-target. I'll try that now.

@Chris-Peterson444
Copy link
Collaborator Author

I tried curtin in-target -- touch /etc/test-file-here and I can verify it shows up under /target/etc/test-file-here

@Chris-Peterson444 Chris-Peterson444 force-pushed the lp-2032961-clean-environment-commands branch from 0d03eea to 8f28063 Compare October 3, 2023 17:09
@dbungert dbungert merged commit 85af88e into canonical:main Oct 3, 2023
11 checks passed
@dbungert dbungert mentioned this pull request Oct 5, 2023
Chris-Peterson444 added a commit to Chris-Peterson444/subiquity that referenced this pull request Oct 25, 2023
…032961-clean-environment-commands"

This reverts commit 85af88e, reversing
changes made to 143d8e3.
Chris-Peterson444 added a commit to Chris-Peterson444/subiquity that referenced this pull request Oct 25, 2023
Revert "Merge pull request canonical#1811 from Chris-Peterson444/lp-2032961-clean-environment-commands"
This reverts commit 85af88e, reversing
changes made to 143d8e3. The fix
proposed in this patch caused more issues than it fixed. We will have
to revisit this in a more nuanced way in the future. In the meantime
users can make use of `env` directly to strip/modify the subcommand
environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants