-
Notifications
You must be signed in to change notification settings - Fork 33
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
snapcraft: Fix *_ORIG variables #842
snapcraft: Fix *_ORIG variables #842
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does APPORT_DATA_DIR need to be set?
b89052b
to
f2e9926
Compare
I didn't run into that issue in particular this time around but we might as well. @d-loose will this affect any of the apport reporting u-d-b does, if any? |
I also want to mention on the LD_LIBRARY_PATH issue that I was able to reproduce the problem with no changes to the snapcraft yaml and just building the snap locally. My bet right now is that the variable exists empty in the launchpad build environment, purposefully or not, where my local builder doesn't. So to call this fully resolved I'd like to download the version that the launchpad builder generates and test with that. |
It currently doesn't do any apport reporting, due to the problems described in #770. Instead, we added a custom error message with instructions for the user to manually run |
Which snapcraft version did you use for your local build? There is a known issue with snaps built using snapcraft 8.x (which is why snapcraft is pinned to |
Ahh, I was using So using the version from
Note the doubling of the I got to thinking that maybe the ubuntu-server app's environment variables are set in the context of ubuntu-desktop-bootstrap's already being set, but removing the
|
Actually I just found a bug report in the wild with the APPORT_DATA_DIR issue. Let's definitely fix that: https://bugs.launchpad.net/ubuntu/+source/subiquity/+bug/2083067 |
d8427dd
to
3e7e86c
Compare
So I did a bunch of testing and I still can't figure out exactly why or how $PATH is set to include the /snap paths by the time the subiquity-server environment variables are defined. Instead of doing some hacking in subiquity to fix this, I have a renewed proposal:
[0] https://snapcraft.io/docs/environment-variables#heading--path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks a lot! I've tested this with snapcraft 7.5.6 and 8.4.1 - the snap builds without errors in both cases and works in the live session.
@seb128 I'd appreciate it if you could have a quick look as well :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me, thanks for the work Chris!
Add APPORT_DATA_DIR{,_ORIG} to the subiquity-server environment definition. Missing this variable will cause automatic error reporting to fail in subiquity. See LP: #2076233.
Remove the LD_LIBRARY_PATH_ORIG variable from subiquity-server environment definition. Having this variable set but not LD_LIBRARY_PATH will cause subiquity to crash. Currently not observed on snapcraft 7.x/stable due to a snapcraft bug.
Ensure subiquity-server and ubuntu-desktop-bootstrap apps have PATH_ORIG, PYTHON_ORIG, and PYTHONPATH_ORIG environment variables. Lacking these causes usage of subiquity's system_scripts to fail to find the python outside of the snap. This will result in blocking installs since suiquity relies on cloud-init scripts to validate user data. A special note on PATH_ORIG: For some unknown reason - potentially a snapcraft bug - when setting environment variables in the subiquity-server environment, the PATH variable has already been modified to include paths with a SNAP prefix. This means we can't set PATH_ORIG to PATH like we do in subiquity. Instead we use the documented default of PATH for classic confinement snaps in [0] as the value for PATH_ORIG to ensure we get only paths to outside of the snap. [0] https://snapcraft.io/docs/environment-variables#heading--path
3e7e86c
to
b389222
Compare
32dff17
into
canonical:snap/ubuntu-desktop-bootstrap/main
Ensure subiquity-server and ubuntu-desktop-bootstrap apps have PATH_ORIG, PYTHON_ORIG, and PYTHONPATH_ORIG environment variables. Lacking these causes usage of subiquity's system_scripts to fail to find the right python outside of the snap. This is currently causing installs to fail on daily desktop-builds.
Also remove LD_LIBRARY_PATH_ORIG since it's not needed anymore.
The rational for removing LD_LIBRARY_PATH is mostly that we don't need it. However, after injecting a new snap to test these changes I found subiquity struggling to replace LD_LIBRARY_PATH_ORIG because LD_LIBRARY_PATH wasn't set. LD_LIBRARY_PATH_ORIG is empty, which means the control flow in the environment cleaner function executes this line which cause a
KeyError
because LD_LIBRARY_PATH is unset (trying to delete a non-existent key). Strangely this error isn't present in an unmodified ISO. This leads me to believe that the way I'm building the snap is slightly different than the launchpad setup. (I can download the snap and inject it without encountering the issue.) Regardless, we can remove LD_LIBRARY_PATH_ORIG because we're always going to remove it from the cleaned environment anyways.LP: #2082851