Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The preceding line is supposed to catch this case... is it not doing that? What happens to the
container
variable?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.
if I'm reading it correctly, L32 just checks to see if the
container
environment variable is set.This doesn't happen (anymore) in recent versions of LXD, though my quick investigation suggests it was once set within containers.EDITED to correct misconception.
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.
(hydrogen is a container.)
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.
Are you 100% sure this is not an LXD VM? When/why did they change this?
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.
I am still seeing this in their docs: "The initial environment of PID1 is blank except for container=lxc which can be used by the init system to detect the runtime."
https://linuxcontainers.org/lxd/docs/latest/container-environment/#pid1
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.
Further evidence that this is not making it from runit (PID1) to the run script:
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.
Found the issue with some help from gurus:
/etc/runit/1
setsVIRTUALIZATION
- this is confirmed. Then/etc/runit/2
callssvrundir
but it blanks the environment out before running it. This is whysvrundir
can't findVIRTUALIZATION
.So, I think the quickest and most correct thing to do is pass
VIRTUALIZATION
into thesvrundir
call in/etc/runit/2
.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.
Hmm
VIRTUALIZATION
is sort of a terrible name IMO. Not sure if we want to export it. See #45.Indeed this file is really only supposed to set the variable for the "core services" / scripts. Exporting the
container
variable verbatim may be another option. OrIS_CONTAINER=1
as in #45.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.
I'm happy to bikeshed the name, but I'd really like to get this fix in soon-ish if possible since it's blocking void-linux/void-packages#41273. See #102 for a first cut. We can easily change it there so that
VIRTUALIZATION
only appears inrunit/1
.This was a heck of a rabbit-hole! Thank you for all your help and patience.
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.
Also - I think that if we (you) decide to adopt the changes in #45, then there should be a consistent way of checking for this variable. Right now we're assigning a numeric value to it, but all the checks I've seen are checking for non-zero length. That is,
VIRTUALIZATION=0
will evaluate to true in most of the checks. This is probably not what we want, especially if we're calling itIS_CONTAINER
which directly implies a boolean.