Merge lp:~jamesodhunt/ubuntu/vivid/ubuntu-core-config/bug-1418966 into lp:ubuntu/vivid/ubuntu-core-config

Proposed by James Hunt on 2015-02-27
Status: Merged
Merged at revision: 14
Proposed branch: lp:~jamesodhunt/ubuntu/vivid/ubuntu-core-config/bug-1418966
Merge into: lp:ubuntu/vivid/ubuntu-core-config
Diff against target: 53 lines (+26/-0)
4 files modified
debian/changelog (+6/-0)
debian/install (+1/-0)
debian/links (+1/-0)
lib/systemd/system/snappy-set-hostname.service (+18/-0)
To merge this branch: bzr merge lp:~jamesodhunt/ubuntu/vivid/ubuntu-core-config/bug-1418966
Reviewer Review Type Date Requested Status
Martin Pitt 2015-02-27 Approve on 2015-03-31
Review via email: mp+251288@code.launchpad.net

Description of the change

* Ensure the chosen hostname is applied, not the default (LP: #1418966).

To post a comment you must log in.
James Hunt (jamesodhunt) wrote :

Note that our current approach with snappy is to minimise the amount of work done in the initramfs, since if the initramfs breaks, the system is effectively dead.

Therefore, this MP sets the hostname in userland via systemd. However, there is the chance that *iff* a service starts very early in boot (before the 'writable' partition gets mounted), it will see the hostname as "localhost.localdomain".

James Hunt (jamesodhunt) wrote :

We prolly need pitti/lool to comment on the approach here.

Note that the approach is wider than just this bug, it's more about whether snappy as a whole should minimise the amount of work done in the initramfs. Currently, we favour minimising the complexity of the initramfs to minimise the risk of system failure. The cost of doing this is that we end up with awkward issues such as this.

A compromise may be to mount "writable" r/o in the initramfs, set the hostname, then unmount to have systemd perform the fsck+mount r/w later.

Martin Pitt (pitti) wrote :

I suggested that unit, so my review is kind of self-referential. But for the record, this looks ok to me under the assumption that we don't want to do the mounts in initramfs.

review: Approve
11. By James Hunt on 2015-03-31

* Add /etc/network/interfaces.d to writable paths (LP: #1405795).
* etc/cloud/cloud.cfg.d/10_snappy.cfg: disable apt_configure.
  That was incorrectly enabled previously.
* add missing etc/profile.d/snappy-bin-path.sh
* etc/system-image/config.d/20_snappy.conf
  - fix config location for s-i 3.0
* etc/cloud/cloud.cfg.d/10_snappy.cfg: add snappy cloud-init config

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-03-31 12:12:20 +0000
3+++ debian/changelog 2015-03-31 13:16:59 +0000
4@@ -1,3 +1,9 @@
5+ubuntu-core-config (0.6.9) UNRELEASED; urgency=medium
6+
7+ * Ensure the chosen hostname is applied, not the default (LP: #1418966).
8+
9+ -- James Hunt <james.hunt@ubuntu.com> Tue, 31 Mar 2015 14:12:14 +0100
10+
11 ubuntu-core-config (0.6.8) vivid; urgency=low
12
13 [ James Hunt ]
14
15=== modified file 'debian/install'
16--- debian/install 2015-02-23 08:40:20 +0000
17+++ debian/install 2015-03-31 13:16:59 +0000
18@@ -1,2 +1,3 @@
19 etc
20+lib
21 snappy-extrausers /usr/share/pam-configs/
22
23=== added file 'debian/links'
24--- debian/links 1970-01-01 00:00:00 +0000
25+++ debian/links 2015-03-31 13:16:59 +0000
26@@ -0,0 +1,1 @@
27+/lib/systemd/system/snappy-set-hostname.service /lib/systemd/system/sysinit.target.requires/snappy-set-hostname.service
28
29=== added directory 'lib'
30=== added directory 'lib/systemd'
31=== added directory 'lib/systemd/system'
32=== added file 'lib/systemd/system/snappy-set-hostname.service'
33--- lib/systemd/system/snappy-set-hostname.service 1970-01-01 00:00:00 +0000
34+++ lib/systemd/system/snappy-set-hostname.service 2015-03-31 13:16:59 +0000
35@@ -0,0 +1,18 @@
36+# Set the true hostname.
37+#
38+# systemd has already set the hostname when this unit executes (based on
39+# the original /etc/hostname).
40+#
41+# However, since that file is on the read-only rootfs and the real
42+# hostname is on the writable partition (/etc/writable bind-mount), it
43+# is necessary to reset the hostname as soon as the true hostname file
44+# is available.
45+
46+[Unit]
47+Description=Set the hostname to the value stored on the writable partition
48+After=etc-writable.mount
49+DefaultDependencies=no
50+
51+[Service]
52+Type=oneshot
53+ExecStart=/bin/hostname -F /etc/hostname

Subscribers

People subscribed via source and target branches

to all changes: