From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 88793138330 for ; Wed, 24 Aug 2016 06:52:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1616921C139; Wed, 24 Aug 2016 06:52:18 +0000 (UTC) Received: from mail-oi0-f49.google.com (mail-oi0-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0EFCD21C07E for ; Wed, 24 Aug 2016 06:52:16 +0000 (UTC) Received: by mail-oi0-f49.google.com with SMTP id l203so10646489oib.1 for ; Tue, 23 Aug 2016 23:52:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gaikai-com.20150623.gappssmtp.com; s=20150623; h=from:in-reply-to:references:mime-version:date:message-id:subject:to; bh=VnH7ThVyzPr+55TkOlsT8LfzDzuPKhNYNI2qEUEzRK4=; b=DfTKzv9mYhXo93KoG4RZRrpZrDmUGqzMy6mcsTk1sncXLEXrwYFqF+SeFGFAV9dwEW 1PzC8T0tVUn6GydxCiFNjkbjqyS9rmjHFBDUcKNTQpnsAajiE1PHAGPxtxO5PqGf+66K S04QD9JJJPp2cJXfIyXpnm+bzvyhTa+qg/MRI9V3kLd+XbOsZcaHKVWe/hf/Hwy/TPGF yhE8FjjFIREBmQlbr/9QWNJoLc3h+tB51p3XkBjdJR1E/9Mr9MomjPhzpbxOeQh4nIND GSD3wu9aArEWjzqjuWKCNyFwFuyyBqvxtMTly9FQ/p0hYm7ZyoCh6WIDiRQx63VWdMa0 kIUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to; bh=VnH7ThVyzPr+55TkOlsT8LfzDzuPKhNYNI2qEUEzRK4=; b=BEYrtEYZmkC9Y1Gatk3eDVm01FycszFG+uipg6AaaMNQfJ49TzS649Lp14LSpSOobV a/6nI9PRwKm0MsD1ag0Q558RpH4p/CF7u2OrbzaHjrBKu06qcEnc1JPydS/PnuLMmLRA YX2ce2FwVmHdGEJEh9Rq37swZy3u+tHVK+BE+vAmriH0Iie92vBe9vuiKNnrFTGkMH+z rzuMwRhKfYFVp24kx12/miRLYEuQX0lM5bRlc6ZCzWMbnpT2qHlmIgEOWiAnilQRkn/r fsFFWDab4gzMttr67ix7UqkvRCTduMU+ML3nA5E30r4PMzOF3YTXadaQQsWqNy37WvQw unsQ== X-Gm-Message-State: AEkoouvc4jjH74UhuQm7L6y9f3QezRzTWR5v4pyWdccHPyeUd1W2/cHUITVsPzkuYFeZSyoqUXbhFjxUb1kplev1 X-Received: by 10.157.46.101 with SMTP id c34mr1295771otd.147.1472021536168; Tue, 23 Aug 2016 23:52:16 -0700 (PDT) Received: from 1058052472880 named unknown by gmailapi.google.com with HTTPREST; Tue, 23 Aug 2016 23:52:15 -0700 From: Christian Kniep In-Reply-To: <20160823212218.GA21784@whubbs1.gaikai.biz> References: <20160822155808.GA16219@whubbs1.gaikai.biz> <1471894124.32381.0.camel@gentoo.org> <20160822220925.GB18116@whubbs1.gaikai.biz> <20160823195746.GA21460@whubbs1.gaikai.biz> <20160823212218.GA21784@whubbs1.gaikai.biz> X-Mailer: Airmail (382) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Date: Tue, 23 Aug 2016 23:52:15 -0700 Message-ID: Subject: Re: [gentoo-dev] rfc: /etc/hostname on gentoo To: William Hubbs , gentoo-dev@lists.gentoo.org Content-Type: multipart/alternative; boundary=001a113b0070c3f147053acbb882 X-Archives-Salt: ac6f10f6-2be0-4f95-94af-06b3cd49878b X-Archives-Hash: 499bf362cc0a80a2d5ac72e5cb18534a --001a113b0070c3f147053acbb882 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hey there, as for the /etc/hostname when sharing /etc/ as a volume=E2=80=A6 This ain= =E2=80=99t a problem as /etc/hostname is taken care of by the docker-engine (in previous versions they used it to discover other hosts). As you can see in the snippet below, /etc/hostname is local, while it is possible to create a file test in /etc/, which is also present in the container I mounted the volumes from. $ docker run -d -v /etc/ --name host1 ubuntu tail -f /dev/null 3f90929cc4b761096b600d5e2b02c61ec2e26ba74167a71b2da73d28d2274dba $ docker run -ti --volumes-from host1 --name host2 ubuntu bash root@dd0167aec38e:/# cat /etc/hostname dd0167aec38e root@dd0167aec38e:/# echo "huhu" > /etc/test root@dd0167aec38e:/# exit $ docker exec host1 cat /etc/test To me the /etc/hostname problem is just to make Gentoo play nice among other distros. As described below, this is (IMHO) a sound solution to propagate the underlying hostname to the containers. Cheers Christian On 23 August 2016 at 23:22:44, William Hubbs (williamh@gentoo.org) wrote: On Tue, Aug 23, 2016 at 04:25:30PM -0400, Rich Freeman wrote: > On Tue, Aug 23, 2016 at 3:57 PM, William Hubbs wrote: > > > > I am planning to change the logic in /etc/init.d/hostname so that if > > /etc/hostname exists, the first word out of that file will be used as > > the hostname rather than any setting in /etc/conf.d/hostname. If you > > don't want /etc/hostname, just don't create it and the settings from > > /etc/conf.d/hostname will still be used. > > > > Keep in mind that this is potentially problematic for a few reasons: > > 1. The hostname could change after openrc is done setting it. If it > does, a program that reads /etc/hostname won't get the real hostname. This is also true for /etc/conf.d/hostname, so I don't see the problem here. > 2. You could have a situation where multiple containers use the same > /etc. Obviously in this situation you wouldn't want to store the > hostname anywhere in /etc unless you wanted them to all have the same > hostname. It would be better to obtain it from dhcp, or to have it > set before init is run during initialization. /etc/init.d/hostname doesn't run inside containers, so this is not relevant. > The main danger is people not thinking of all the scenarios. I'm not > quite sure why we even need /etc/hostname now given these issues and > the fact that we've apparently gotten along for a long time without > it. Have we ever gotten around to making /etc/mtab a symlink yet? I > know it wasn't for a long time. It seems like we are moving away from > container support when we should be moving towards it if anything... Container support is controlled by the keyword line in dependencies. OpenRC can detect most containers, so if you put the proper keywords on that line and RC_SYS is set correctly or the container is autodetected properly, openrc will not run the scripts that it shouldn't run in the container. Yes, /etc/mtab is a symlink by default now; that was taken care of a while back. William --001a113b0070c3f147053acbb882 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hey there,

as for the /etc/hostname when sharing /etc/ as= a volume=E2=80=A6 This ain=E2=80=99t a problem as /etc/hostname is taken c= are of by the docker-engine (in previous versions they used it to discover = other hosts).

As you can see in the snippet below, /etc/hostname is local= , while it is possible to create a file test in /etc/, which is also present in the container I mounted the volumes from.

$ docker run -d -v /etc/ --name host1 ubuntu tail -f /dev/null
3f90929cc4b761096b600d5e2b02c61ec2e26ba74167a71b2da73d28d2274dba
$ docker run -ti --volumes-from host1 --name host2 ubuntu bash
root@dd0167aec38e:/# cat /etc/hostname
dd0167aec38e
root@dd0167aec38e:/# echo "huhu" > /etc/test
root@dd0167aec38e:/# exit
$ docker exec host1 cat /etc/test

To me the /etc/hostname problem is just to make Gentoo play= nice among other distros. As described below, this is (IMHO) a sound solution to propagate the underl= ying hostname to the containers.

Cheers Christian


On 23 August 2016 at 23= :22:44, William Hubbs (williamh@gent= oo.org) wrote:

<= div>
On Tue, Aug 23, 2016 at 04:25:30PM -0400, Rich Freeman = wrote:
> On Tue, Aug 23, 2016 at 3:57 PM, William Hubbs <williamh@gentoo.org> wrote:
> >
> > I am planning to change the logic in /etc/init.d/hostname so = that if
> > /etc/hostname exists, the first word out of that file will be= used as
> > the hostname rather than any setting in /etc/conf.d/hostname.= If you
> > don't want /etc/hostname, just don't create it and th= e settings from
> > /etc/conf.d/hostname will still be used.
> >
> =20
> Keep in mind that this is potentially problematic for a few reason= s:
> =20
> 1. The hostname could change after openrc is done setting it. If= it
> does, a program that reads /etc/hostname won't get the real ho= stname.
=20
This is also true for /etc/conf.d/hostname, so I don't see the pro= blem
here.

> 2. You could have a situation where multiple containers use the s= ame
> /etc. Obviously in this situation you wouldn't want to store = the
> hostname anywhere in /etc unless you wanted them to all have the s= ame
> hostname. It would be better to obtain it from dhcp, or to have i= t
> set before init is run during initialization.


/etc/init.d/hostname doesn't run inside = containers, so this is not
relevant.

> The main danger is people not thinking of all the scenarios. I= 9;m not
> quite sure why we even need /etc/hostname now given these issues a= nd
> the fact that we've apparently gotten along for a long time wi= thout
> it. Have we ever gotten around to making /etc/mtab a symlink yet?= I
> know it wasn't for a long time. It seems like we are moving a= way from
> container support when we should be moving towards it if anything.= ..

Container support is controlled by the keyword line in dependencies.
OpenRC can detect most containers, so if you put the proper keywords on
that line and RC_SYS is set correctly or the container is autodetected
properly, openrc will not run the scripts that it shouldn't run in = the
container.

Yes, /etc/mtab is a symlink by default now; that was taken care of a
while back.

William

--001a113b0070c3f147053acbb882--