Gentoo Archives: gentoo-dev

From: Rich Freeman <rich0@g.o>
To: gentoo-dev <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] rfc: /etc/hostname on gentoo
Date: Mon, 22 Aug 2016 17:32:42
Message-Id: CAGfcS_m85zzQpU-ZVoiCB45-qUs9-ohoOt+h2bGtbT1HNRsW+w@mail.gmail.com
In Reply to: Re: [gentoo-dev] rfc: /etc/hostname on gentoo by William Hubbs
1 On Mon, Aug 22, 2016 at 1:03 PM, William Hubbs <williamh@g.o> wrote:
2 >
3 > I'm not sure about putting this in /run for a couple of reasons:
4 >
5 > The contents of this file is a setting, like /etc/conf.d/hostname, which
6 > will be set by the user.
7
8 There is no reason a script can't populate /run with the right thing.
9 For example, with systemd you can set up a static networking config
10 with a static DNS, and it will populate a resolv.conf in /run with
11 whatever it parsed out of your networkd configuration. Or you can
12 tell it to use dhcp in which case it populates /run with whatever the
13 dhcp server gives it.
14
15 The idea is that only one tool has to worry about where to get the
16 right network settings from, and everything else can just read them in
17 whatever format they prefer from wherever it is preferred.
18
19 However, it isn't the only way to accomplish this goal. You could
20 just keep writing to /etc. That does break in situations where you
21 want /etc to be read-only, etc.
22
23 >
24 > The other reason is, I don't know enough about containers to know if
25 > they will have a separate /run from the host.
26 >
27
28 Typically containers will have their own /run. Containers were one of
29 the big reasons to not store hostnames in /etc, since then you can
30 share a single image across many containers, with a static /etc, and
31 the dynamic stuff all goes in /run. Containers are also one of the
32 reasons for ditching /etc/mtab.
33
34 --
35 Rich