Hi Lorentz,
On 9/2/21 13:48, Lorenz wrote:
> Few months ago I sent a patch for needrestart, and there is a function
> (line 66) there to detect if it's running in a container; i'm not sure
> that is something that was not already mentioned and discarded here,
> but maybe it's worth checking.
I see..., it's written in perl and verifies the existence of
/proc/1/environ:
if (-r "/proc/1/environ") {
# check if we are inside of a container (fallback)
local $/;
open(HENV, '<', '/proc/1/environ');
$is_container = scalar(grep {/^container=/;} unpack("(Z*)*", <HENV>));
close(HENV)
}
In fact, there are several methods for detecting whether or not we are
within a container depending on the type of the container (for instance,
docker creates a |.dockerenv|||file in the root directory of the hosted
system),
and some of the scripts available on the web evaluate each possibility
separately for increased robustness. I think that VM are where things
get more complicated. I have some vague ideas for that,
being one of them related to the ram memory, but i still didn't spend
time on that.
> Il giorno dom 3 gen 2021 alle ore 10:41 aitor <aitor_czr@???
> <mailto:aitor_czr@gnuinos.org>> ha scritto:
>
> I don't know. But, as far as i know, this question arises from the
> developers of runit.
>
>
> Side question: where/who are the developers of runit?
The original author of runit seems to be Gerrit Pape:
http://smarden.org/runit/ <
http://smarden.org/runit/>
but other people like Dmitry Bogatov or Britney might be involved
somehow in the project, at least as debian package mantainers.
And Lorenzo Puliti, maybe?
> I'm planning extensive development for the next cycle
> (Debian/Bookworm) so we probably should coordinate at least to make
> sure that we don't step on each other foot
>
> Regards,
> Lorenzo
Quoting Svante Signell:
/> I'm trying to solve the problem of detecting if you are within a
container, like
> docker or LXC when running the eudev init script. If true udevd
should not be
> cstarted. The current version of eudev (3.2.9-4) has a buggy check for
> containers, and people running runit as init have problems, see #392./
Maybe i misunderstood him and made up my mind that developers of runit
were beyond this issue, while Svante was clearly referring to the users.
Whatever the case, i also would like to know about a possible mailing
list and we would meet each other there for sure :)
Cheers,
Aitor.