Merge ~paelzer/ubuntu/+source/chrony:merge-disco-3.4 into ubuntu/+source/chrony:debian/sid

Proposed by Christian Ehrhardt 
Status: Merged
Merge reported by: Christian Ehrhardt 
Merged at revision: 7985b12f4b9631af536d163775cfcf54585f46ac
Proposed branch: ~paelzer/ubuntu/+source/chrony:merge-disco-3.4
Merge into: ubuntu/+source/chrony:debian/sid
Diff against target: 516 lines (+374/-5)
11 files modified
debian/README.container (+60/-0)
debian/changelog (+193/-0)
debian/chrony.conf (+18/-1)
debian/chrony.default (+4/-0)
debian/chrony.service (+2/-2)
debian/chronyd-starter.sh (+70/-0)
debian/control (+4/-1)
debian/docs (+1/-0)
debian/install (+1/-0)
debian/links (+5/-0)
debian/postrm (+16/-1)
Reviewer Review Type Date Requested Status
Andreas Hasenack Approve
Canonical Server Pending
git-ubuntu developers Pending
Review via email: mp+358631@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Pushed merge tags for review
 * [new tag] lp1802886/deconstruct/3.3-2ubuntu2 -> lp1802886/deconstruct/3.3-2ubuntu2
 * [new tag] lp1802886/logical/3.3-2ubuntu2 -> lp1802886/logical/3.3-2ubuntu2
 * [new tag] lp1802886/new/debian -> lp1802886/new/debian
 * [new tag] lp1802886/old/debian -> lp1802886/old/debian
 * [new tag] lp1802886/old/ubuntu -> lp1802886/old/ubuntu
 * [new tag] lp1802886/reconstruct/3.3-2ubuntu2 -> lp1802886/reconstruct/3.3-2ubuntu2

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Tests on the Bileto ticket fail for Disco not being fully available yet :-/
I'd appreciate a review still as it looks rather normal this time (no huge changes).

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

The pidfile is actually configured - I missed that.
I need to rework it a bit.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Ok, fortunately I just needed to drop two commits to clean that up

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Bileto should work with disco shortly:
<ahasenack> looks like all we need is one package in that ppa built for disco
<xnox> ahasenack, that is fixable.
<xnox> ahasenack, not built =) _copied_
* xnox does that

You might want to upload a ~ppa2 or something to trigger a new run.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Some changelog entries under "remaining changes" have incorrect indentation, namely:
      - debian/chrony.service: allow the service to run without CAP_SYS_TIME
      - debian/control: add new dependency libcap2-bin for capsh (usually
        installed anyway, but make them explicit to be sure).
      - debian/chrony.default: new option SYNC_IN_CONTAINER to not fall back
        (Default off).
      - debian/chronyd-starter.sh: wrapper to handle special cases in containers
        and if CAP_SYS_TIME is missing. Effectively allows to run NTP server in
        containers on a default installation and avoid failing to sync time (or
        if allowed to sync, avoid multiple containers to fight over it by
        accident).
      - debian/install: make chronyd-starter.sh available on install.
      - debian/docs, debian/README.container: provide documentation about the
        handling of this case.

and

      - d/links: link dispatcher script to networkd-dispatcher events routable
        and off
      - d/control: set Recommends to networkd-dispatcher
      - d/p/lp-1718227-nm-dispatcher-for-networkd.patch

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

commit 9a45945013355c5fad351a36cfc0ee17a8ac5882
Author: Christian Ehrhardt <email address hidden>
Date: Thu Mar 15 09:31:48 2018 +0100

    - debian/chronyd-starter.sh: wrapper to handle special cases in containers

That also touched debian/chrony.service.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

In my comment about the indentation of d/changelog, the second "hunk" that starts with "- d/links:...", is correct as it is, indented below "Notify chrony ...". My mistake.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

And I just realized that everything in the first "hunk" of that comment is also related to the parent line, so indentation is also correct. Sorry.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Sorry about the confusing review.

I guess my only comment is about that d/chronyd-starter.sh wrapper commit which forgot to mention chrony.service. I see that in under paelzer/lp1802886/logical/3.3-2ubuntu2 too:

commit bb17fdf9967601d436a73bf93f9b3e72fa67696a
Author: Christian Ehrhardt <email address hidden>
Date: Thu Mar 15 09:31:48 2018 +0100

    - debian/chronyd-starter.sh: wrapper to handle special cases in containers

    Signed-off-by: Christian Ehrhardt <email address hidden>

No big deal, though.

Logical, drops, and added change are good. delta carried forward as expected. Would be cool to see a new dep8 run after bileto was fixed today to work with disco (hopefully).

review: Approve
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

The indents are meant that way.
It is not meant to me misread as you did only to then realize it is right.
That means my CL is bad, so I replaced the - with a + to make clear that it is intentionally an extra level.
Thanks for the catch

Updated the commit message on 9a4594 (changelog was ok)

I'll use the fixed thing for a new bileto upload.
If it works fine, otherwise I might go on still.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Tests are good now: https://bileto.ubuntu.com/excuses/3512/disco.html

So we are complete, I'll upload

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/README.container b/debian/README.container
0new file mode 1006440new file mode 100644
index 0000000..16f2618
--- /dev/null
+++ b/debian/README.container
@@ -0,0 +1,60 @@
1Chrony in Containers
2--------------------
3
4Currently in in 99.9+% of the cases syncing the local clock in a container
5is wrong. Most of the time it will be unable to do so, because it is lacking
6CAP_SYS_TIME. Or worse, if the CAP_SYS_TIME privilege is granted, multiple
7containers could fight over the system's time, because the Linux kernel does
8not provide time namespaces (yet).
9
10There are two things a user installing chrony usually wants:
111. synchronize my time (NTP client)
122. serve NTP (NTP server)
13
14In a container the first makes (usually) no sense, so by default we enable -x
15there (as it would only crash otherwise).
16This will disable the control of the system clock.
17See `man chronyd` for more details on the -x option.
18
19Formerly, the check for Condition=CAP_SYS_TIME in the systemd service avoided
20the crash of the NTP client portion, but that means the server use case will
21not work by default in containers. It is still not recommended to use a
22container as an NTP server, but if the host clock is synchronised via NTP,
23adding the -x option to chronyd instances running in containers will allow
24them to function as NTP servers which do not adjust the system clock.
25The Condition=CAP_SYS_TIME check was a silent, no-log-entry stealing away
26leaving users often unclear what happened - especially if they were more after
27the NTP server than the NTP client.
28
29One could argue that someone who installs chrony expects the system time to be
30synchronised, so it should fail if it is not able to do so. On the other hand
31it could be argued that someone who installs chrony expects time to be served
32over the network via NTP.
33We can't know which expectation is applicable, so we assume that time should
34be synchronised unless chronyd is running in a container (or is without
35CAP_SYS_TIME in any other environment).
36
37To make things worse recent container implementations will offer CAP_SYS_TIME
38to the container. Since from the container's point of view, this capability is
39available for the container's user namespace. Just later on adjtimex and similar
40are actually evaluated against the host kernel where they will fail. Due to
41that without further precaution running chrony in Ubuntu in the future will
42likely have the service start (as Condition=CAP_SYS_TIME will be true) but
43then immediately fail.
44This will depend on the environment e.g. versions and types of containers and
45thereby feel just 'unreliable' from users point of view.
46Furthermore it will affect upgrades as the service has to be restarted for a
47package upgrade to be considered complete.
48
49Due to all of that Ubuntu decided (LP: #1589780) to default to -x (do not
50set the system clock) in containers.
51
52If one really wants to (try to) sync time in a container or CAP_SYS_TIME-less
53environment set SYNC_IN_CONTAINER="yes" in /etc/default/chrony to disable
54this special handling.
55
56It is important to mention that as soon as upstream provides a way to provide
57a default config working in those cases Ubuntu intends to use that and drop
58the current workaround.
59
60 -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Fri, 16 Mar 2018 12:25:44 +0100
diff --git a/debian/changelog b/debian/changelog
index 513307a..2ea28a0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,45 @@
1chrony (3.4-1ubuntu1) disco; urgency=medium
2
3 * Merge with Debian unstable (LP: #1802886). Remaining changes:
4 - d/chrony.conf: use ubuntu ntp pool and server (LP 1744664)
5 - Set -x as default if unable to set time (e.g. in containers) (LP: 1589780)
6 Chrony is a single service which acts as both NTP client (i.e. syncing the
7 local clock) and NTP server (i.e. providing NTP services to the network),
8 and that is both desired and expected in the vast majority of cases.
9 But in containers syncing the local clock is usually impossible, but this
10 shall not break the providing of NTP services to the network.
11 To some extent this makes chrony's default config more similar to 'ntpd',
12 which complained in syslog but still provided NTP server service in those
13 cases.
14 - debian/chrony.service: allow the service to run without CAP_SYS_TIME
15 - debian/control: add new dependency libcap2-bin for capsh (usually
16 installed anyway, but make them explicit to be sure).
17 - debian/chrony.default: new option SYNC_IN_CONTAINER to not fall back
18 (Default off).
19 - debian/chronyd-starter.sh: wrapper to handle special cases in containers
20 and if CAP_SYS_TIME is missing. Effectively allows to run NTP server in
21 containers on a default installation and avoid failing to sync time (or
22 if allowed to sync, avoid multiple containers to fight over it by
23 accident).
24 - debian/install: make chronyd-starter.sh available on install.
25 - debian/docs, debian/README.container: provide documentation about the
26 handling of this case.
27 - d/postrm: re-establish systemd-timesyncd on removal (LP: 1764357)
28 - Notify chrony to update sources in response to systemd-networkd
29 events (LP: 1718227)
30 - d/links: link dispatcher script to networkd-dispatcher events routable
31 and off
32 - d/control: set Recommends to networkd-dispatcher
33 * Dropped Changes (upstream):
34 - d/p/lp-1718227-nm-dispatcher-for-networkd.patch
35 - d/p/lp-1787366-fall-back-to-urandom.patch: avoid hangs when starting
36 the service on newer kernels by falling back to urandom. (LP: 1787366)
37 * Added Changes:
38 - d/postrm: respect policy-rc.d when restoring systemd-timesyncd
39 (LP: #1771994)
40
41 -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Mon, 12 Nov 2018 11:39:08 +0100
42
1chrony (3.4-1) unstable; urgency=medium43chrony (3.4-1) unstable; urgency=medium
244
3 * Import upstream version 3.4:45 * Import upstream version 3.4:
@@ -74,6 +116,66 @@ chrony (3.3-3) unstable; urgency=medium
74116
75 -- Vincent Blut <vincent.debian@free.fr> Sat, 18 Aug 2018 16:23:19 +0200117 -- Vincent Blut <vincent.debian@free.fr> Sat, 18 Aug 2018 16:23:19 +0200
76118
119chrony (3.3-2ubuntu2) cosmic; urgency=medium
120
121 * - d/p/lp-1787366-fall-back-to-urandom.patch: avoid hangs when starting
122 the service on newer kernels by falling back to urandom.
123 (LP: #1787366, Closes: #906276)
124
125 -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Thu, 16 Aug 2018 11:48:38 +0200
126
127chrony (3.3-2ubuntu1) cosmic; urgency=medium
128
129 * Merge with Debian unstable (LP: #1771061). Remaining changes:
130 - d/chrony.conf: use ubuntu ntp pool and server (LP 1744664)
131 - Set -x as default if unable to set time (e.g. in containers) (LP: 1589780)
132 Chrony is a single service which acts as both NTP client (i.e. syncing the
133 local clock) and NTP server (i.e. providing NTP services to the network),
134 and that is both desired and expected in the vast majority of cases.
135 But in containers syncing the local clock is usually impossible, but this
136 shall not break the providing of NTP services to the network.
137 To some extent this makes chrony's default config more similar to 'ntpd',
138 which complained in syslog but still provided NTP server service in those
139 cases.
140 - debian/chrony.service: allow the service to run without CAP_SYS_TIME
141 - debian/control: add new dependency libcap2-bin for capsh (usually
142 installed anyway, but make them explicit to be sure).
143 - debian/chrony.default: new option SYNC_IN_CONTAINER to not fall back
144 (Default off).
145 - debian/chronyd-starter.sh: wrapper to handle special cases in containers
146 and if CAP_SYS_TIME is missing. Effectively allows to run NTP server in
147 containers on a default installation and avoid failing to sync time (or
148 if allowed to sync, avoid multiple containers to fight over it by
149 accident).
150 - debian/install: make chronyd-starter.sh available on install.
151 - debian/docs, debian/README.container: provide documentation about the
152 handling of this case.
153 - d/postrm: re-establish systemd-timesyncd on removal (LP: 1764357)
154 - Notify chrony to update sources in response to systemd-networkd
155 events (LP: 1718227)
156 - d/links: link dispatcher script to networkd-dispatcher events routable
157 and off
158 - d/control: set Recommends to networkd-dispatcher
159 - d/p/lp-1718227-nm-dispatcher-for-networkd.patch
160 * Dropped changes
161 - debian/usr.sbin.chronyd: ensure RTC/GPS usage isn't blocked by apparmor
162 (LP: 1751241) (in Debian now)
163 - debian/usr.sbin.chronyd: add cap net_admin for hwtimestamp (LP: 1761327)
164 (in Debian now)
165 - d/p/lp1589780-sys_linux-don-t-keep-CAP_SYS_TIME-with-x-option.patch:
166 When dropping the root privileges, don't try to keep the CAP_SYS_TIME
167 capability if the -x option was enabled. This allows chronyd to be
168 started without the capability (e.g. in containers) and also drop the
169 root privileges (This is upstream now).
170 - d/p/lp-1718227-ignore-non-up-down-events-in-nm-dispatcher.patch (This is
171 upstream now).
172 - d/control: switch to nss instead of tomcrypt (Debian switched to nettle
173 which is in main, so we can drop this)
174 * Added changes
175 - debian/README.container: fix typos
176
177 -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Mon, 14 May 2018 09:06:01 +0200
178
77chrony (3.3-2) unstable; urgency=medium179chrony (3.3-2) unstable; urgency=medium
78180
79 * debian/chrony.service:181 * debian/chrony.service:
@@ -129,6 +231,76 @@ chrony (3.2-5) unstable; urgency=medium
129231
130 -- Vincent Blut <vincent.debian@free.fr> Wed, 28 Feb 2018 17:31:08 +0100232 -- Vincent Blut <vincent.debian@free.fr> Wed, 28 Feb 2018 17:31:08 +0100
131233
234chrony (3.2-4ubuntu4) bionic; urgency=medium
235
236 * d/postrm: re-establish systemd-timesyncd on removal (LP: #1764357)
237 * Notify chrony to update sources in response to systemd-networkd
238 events (LP: #1718227)
239 - d/links: link dispatcher script to networkd-dispatcher events routable
240 and off
241 - d/control: set Recommends to networkd-dispatcher
242 - d/p/lp-1718227-ignore-non-up-down-events-in-nm-dispatcher.patch
243 - d/p/lp-1718227-nm-dispatcher-for-networkd.patch
244
245 -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Mon, 16 Apr 2018 17:04:06 +0200
246
247chrony (3.2-4ubuntu3) bionic; urgency=medium
248
249 * debian/usr.sbin.chronyd: add cap net_admin for hwtimestamp (LP: #1761327)
250
251 -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Thu, 05 Apr 2018 09:38:10 +0200
252
253chrony (3.2-4ubuntu2) bionic; urgency=medium
254
255 * Set -x as default if unable to set time (e.g. in containers) (LP: #1589780)
256 Chrony is a single service which acts as both NTP client (i.e. syncing the
257 local clock) and NTP server (i.e. providing NTP services to the network),
258 and that is both desired and expected in the vast majority of cases.
259 But in containers syncing the local clock is usually impossible, but this
260 shall not break the providing of NTP services to the network.
261 To some extent this makes chrony's default config more similar to 'ntpd',
262 which complained in syslog but still provided NTP server service in those
263 cases.
264 - d/p/lp1589780-sys_linux-don-t-keep-CAP_SYS_TIME-with-x-option.patch:
265 When dropping the root privileges, don't try to keep the CAP_SYS_TIME
266 capability if the -x option was enabled. This allows chronyd to be
267 started without the capability (e.g. in containers) and also drop the
268 root privileges.
269 - debian/chrony.service: allow the service to run without CAP_SYS_TIME
270 - debian/control: add new dependency libcap2-bin for capsh (usually
271 installed anyway, but make them explicit to be sure).
272 - debian/chrony.default: new option SYNC_IN_CONTAINER to not fall back
273 (Default off).
274 - debian/chronyd-starter.sh: wrapper to handle special cases in containers
275 and if CAP_SYS_TIME is missing. Effectively allows to run NTP server in
276 containers on a default installation and avoid failing to sync time (or
277 if allowed to sync, avoid multiple containers to fight over it by
278 accident).
279 - debian/install: make chronyd-starter.sh available on install.
280 - debian/docs, debian/README.container: provide documentation about the
281 handling of this case.
282 * debian/chrony.conf: update default chrony.conf to not violate the policy
283 of pool.ntp.org (to use no more than four of their servers) and to provide
284 more ipv6 capable sources by default (LP: #1754358)
285
286 -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Fri, 16 Mar 2018 12:25:44 +0100
287
288chrony (3.2-4ubuntu1) bionic; urgency=medium
289
290 * Merge with Debian unstable. Remaining changes:
291 - d/control: switch to nss instead of tomcrypt (nss is in main)
292 - d/chrony.conf: use ubuntu ntp pool and server (LP 1744664)
293 * Dropped changes (in Debian)
294 - d/chrony.default, d/chrony.service: support /etc/default/chrony
295 DAEMON_OPTS in systemd environment (LP: 1746081)
296 - d/chrony.service: properly start after networking (LP: 1746458)
297 - d/usr.sbin.chronyd: allow to create /run/chrony on demand (LP: 1746444)
298 * Added Changes:
299 - debian/usr.sbin.chronyd: ensure RTC/GPS usage isn't blocked by apparmor
300 (LP: #1751241, Closes: #891201)
301
302 -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Mon, 26 Feb 2018 14:44:54 +0100
303
132chrony (3.2-4) unstable; urgency=medium304chrony (3.2-4) unstable; urgency=medium
133305
134 * debian/changelog:306 * debian/changelog:
@@ -195,6 +367,27 @@ chrony (3.2-3) unstable; urgency=medium
195367
196 -- Vincent Blut <vincent.debian@free.fr> Wed, 07 Feb 2018 21:27:09 +0100368 -- Vincent Blut <vincent.debian@free.fr> Wed, 07 Feb 2018 21:27:09 +0100
197369
370chrony (3.2-2ubuntu3) bionic; urgency=medium
371
372 * Revert the changes of (LP 1746458) as in the follow on discussion
373 it became clear that we want it to start early (for example for an
374 early offset from drift file). iIf needed chrony will later on pick
375 up that servers are online via retries (augmented by hooks on network
376 events).
377
378 -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Thu, 08 Feb 2018 10:52:30 +0100
379
380chrony (3.2-2ubuntu2) bionic; urgency=medium
381
382 * d/control: use to nss instead of tomcrypt (in main) (LP: #1744072)
383 * d/chrony.conf: use ubuntu ntp pool and server (LP: #1744664)
384 * d/chrony.default, d/chrony.service: support /etc/default/chrony
385 DAEMON_OPTS in systemd environment (LP: #1746081)
386 * d/chrony.service: properly start after networking (LP: #1746458)
387 * d/usr.sbin.chronyd: allow to create /run/chrony on demand (LP: #1746444)
388
389 -- Christian Ehrhardt <christian.ehrhardt@canonical.com> Fri, 19 Jan 2018 09:45:38 +0100
390
198chrony (3.2-2) unstable; urgency=medium391chrony (3.2-2) unstable; urgency=medium
199392
200 * Initial AppArmor profile for chronyd. Thanks to Jamie393 * Initial AppArmor profile for chronyd. Thanks to Jamie
diff --git a/debian/chrony.conf b/debian/chrony.conf
index 6c19767..d5a0b37 100644
--- a/debian/chrony.conf
+++ b/debian/chrony.conf
@@ -1,6 +1,23 @@
1# Welcome to the chrony configuration file. See chrony.conf(5) for more1# Welcome to the chrony configuration file. See chrony.conf(5) for more
2# information about usuable directives.2# information about usuable directives.
3pool 2.debian.pool.ntp.org iburst3
4# This will use (up to):
5# - 4 sources from ntp.ubuntu.com which some are ipv6 enabled
6# - 2 sources from 2.ubuntu.pool.ntp.org which is ipv6 enabled as well
7# - 1 source from [01].ubuntu.pool.ntp.org each (ipv4 only atm)
8# This means by default, up to 6 dual-stack and up to 2 additional IPv4-only
9# sources will be used.
10# At the same time it retains some protection against one of the entries being
11# down (compare to just using one of the lines). See (LP: #1754358) for the
12# discussion.
13#
14# About using servers from the NTP Pool Project in general see (LP: #104525).
15# Approved by Ubuntu Technical Board on 2011-02-08.
16# See http://www.pool.ntp.org/join.html for more information.
17pool ntp.ubuntu.com iburst maxsources 4
18pool 0.ubuntu.pool.ntp.org iburst maxsources 1
19pool 1.ubuntu.pool.ntp.org iburst maxsources 1
20pool 2.ubuntu.pool.ntp.org iburst maxsources 2
421
5# This directive specify the location of the file containing ID/key pairs for22# This directive specify the location of the file containing ID/key pairs for
6# NTP authentication.23# NTP authentication.
diff --git a/debian/chrony.default b/debian/chrony.default
index ae79e8a..b523f60 100644
--- a/debian/chrony.default
+++ b/debian/chrony.default
@@ -4,3 +4,7 @@
44
5# Options to pass to chrony.5# Options to pass to chrony.
6DAEMON_OPTS=""6DAEMON_OPTS=""
7
8# Sync systecm clock in containers or without CAP_SYS_TIME (likely to fail)
9# See /usr/share/doc/chrony/README.container for details.
10SYNC_IN_CONTAINER="no"
diff --git a/debian/chrony.service b/debian/chrony.service
index 3e4451a..bb01a79 100644
--- a/debian/chrony.service
+++ b/debian/chrony.service
@@ -3,13 +3,13 @@ Description=chrony, an NTP client/server
3Documentation=man:chronyd(8) man:chronyc(1) man:chrony.conf(5)3Documentation=man:chronyd(8) man:chronyc(1) man:chrony.conf(5)
4Conflicts=systemd-timesyncd.service openntpd.service ntp.service ntpsec.service4Conflicts=systemd-timesyncd.service openntpd.service ntp.service ntpsec.service
5After=network.target5After=network.target
6ConditionCapability=CAP_SYS_TIME
76
8[Service]7[Service]
9Type=forking8Type=forking
10PIDFile=/run/chronyd.pid9PIDFile=/run/chronyd.pid
11EnvironmentFile=-/etc/default/chrony10EnvironmentFile=-/etc/default/chrony
12ExecStart=/usr/sbin/chronyd $DAEMON_OPTS11# Starter takes care of special cases mostly for containers
12ExecStart=/usr/lib/systemd/scripts/chronyd-starter.sh $DAEMON_OPTS
13ExecStartPost=-/usr/lib/chrony/chrony-helper update-daemon13ExecStartPost=-/usr/lib/chrony/chrony-helper update-daemon
14PrivateTmp=yes14PrivateTmp=yes
15ProtectHome=yes15ProtectHome=yes
diff --git a/debian/chronyd-starter.sh b/debian/chronyd-starter.sh
16new file mode 10075516new file mode 100755
index 0000000..c175db5
--- /dev/null
+++ b/debian/chronyd-starter.sh
@@ -0,0 +1,70 @@
1#!/bin/sh
2set -ue
3
4CONF="/etc/default/chrony"
5DOC="/usr/share/doc/chrony/README.container"
6CAP="cap_sys_time"
7CMD="/usr/sbin/chronyd"
8# Take any args passed, use none if nothing was specified
9EFFECTIVE_DAEMON_OPTS=${@:-""}
10
11if [ -f "${CONF}" ]; then
12 . "${CONF}"
13else
14 echo "<4>Warning: ${CONF} is missing"
15fi
16# take from conffile if available, default to no otherwise
17EFFECTIVE_SYNC_IN_CONTAINER=${SYNC_IN_CONTAINER:-"no"}
18
19if [ ! -x "${CMD}" ]; then
20 echo "<3>Error: ${CMD} not executable"
21 # ugly, but works around https://github.com/systemd/systemd/issues/2913
22 sleep 0.1
23 exit 1
24fi
25
26# Check if -x is already set manually, don't process further if that is the case
27X_SET=0
28while getopts ":x" opt; do
29 case $opt in
30 x)
31 X_SET=1
32 ;;
33 esac
34done
35
36if [ ${X_SET} -ne 1 ]; then
37 # Assume it is not in a container
38 IS_CONTAINER=0
39 if [ -x /usr/bin/systemd-detect-virt ]; then
40 if /usr/bin/systemd-detect-virt --quiet --container; then
41 IS_CONTAINER=1
42 fi
43 fi
44
45
46 # Assume it has the cap
47 HAS_CAP=1
48 CAPSH="/sbin/capsh"
49 if [ -x "${CAPSH}" ]; then
50 ${CAPSH} --print | grep -q "^Current.*${CAP}" || HAS_CAP=0
51 fi
52
53 if [ ${HAS_CAP} -eq 0 ]; then
54 echo "<4>Warning: Missing ${CAP}, syncing the system clock will fail"
55 fi
56 if [ ${IS_CONTAINER} -eq 1 ]; then
57 echo "<4>Warning: Running in a container, likely impossible and unintended to sync system clock"
58 fi
59
60 if [ ${HAS_CAP} -eq 0 -o ${IS_CONTAINER} -eq 1 ]; then
61 if [ "${EFFECTIVE_SYNC_IN_CONTAINER}" != "yes" ]; then
62 echo "<5>Adding -x as fallback disabling control of the system clock, see ${DOC} to override this behavior"
63 EFFECTIVE_DAEMON_OPTS="${EFFECTIVE_DAEMON_OPTS} -x"
64 else
65 echo "<5>Not falling back to disable control of the system clock, see ${DOC} to change this behavior"
66 fi
67 fi
68fi
69
70${CMD} ${EFFECTIVE_DAEMON_OPTS}
diff --git a/debian/control b/debian/control
index a35df2d..c740cc9 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,8 @@
1Source: chrony1Source: chrony
2Section: net2Section: net
3Priority: optional3Priority: optional
4Maintainer: Vincent Blut <vincent.debian@free.fr>4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
5XSBC-Original-Maintainer: Vincent Blut <vincent.debian@free.fr>
5Uploaders: Joachim Wiedorn <joodebian@joonet.de>6Uploaders: Joachim Wiedorn <joodebian@joonet.de>
6Standards-Version: 4.2.17Standards-Version: 4.2.1
7Build-Depends: asciidoctor (>= 1.5.3-1~),8Build-Depends: asciidoctor (>= 1.5.3-1~),
@@ -24,9 +25,11 @@ Architecture: linux-any
24Depends: adduser,25Depends: adduser,
25 iproute2 [linux-any],26 iproute2 [linux-any],
26 lsb-base,27 lsb-base,
28 libcap2-bin,
27 ucf,29 ucf,
28 ${misc:Depends},30 ${misc:Depends},
29 ${shlibs:Depends}31 ${shlibs:Depends}
32Recommends: networkd-dispatcher (>= 1.7-0ubuntu3)
30Suggests: dnsutils33Suggests: dnsutils
31Conflicts: ntp,34Conflicts: ntp,
32 time-daemon35 time-daemon
diff --git a/debian/docs b/debian/docs
index e12f653..3bfc9dc 100644
--- a/debian/docs
+++ b/debian/docs
@@ -1,3 +1,4 @@
1FAQ1FAQ
2NEWS2NEWS
3README3README
4debian/README.container
diff --git a/debian/install b/debian/install
index db2e305..abaa2f3 100644
--- a/debian/install
+++ b/debian/install
@@ -2,3 +2,4 @@ debian/chrony-dnssrv@.* lib/systemd/system
2debian/chrony-helper usr/lib/chrony2debian/chrony-helper usr/lib/chrony
3debian/chrony.conf usr/share/chrony3debian/chrony.conf usr/share/chrony
4debian/usr.sbin.chronyd etc/apparmor.d4debian/usr.sbin.chronyd etc/apparmor.d
5debian/chronyd-starter.sh usr/lib/systemd/scripts/
diff --git a/debian/links b/debian/links
5new file mode 1006446new file mode 100644
index 0000000..71e2c52
--- /dev/null
+++ b/debian/links
@@ -0,0 +1,5 @@
1# Update sources in response to systemd-networkd events (LP: #1718227).
2# This is reusing the NetworkManager dispatch script which has no hard
3# dependency to NetworkManager (not using any of its arguments)
4etc/NetworkManager/dispatcher.d/20-chrony usr/lib/networkd-dispatcher/routable.d/chrony
5etc/NetworkManager/dispatcher.d/20-chrony usr/lib/networkd-dispatcher/off.d/chrony
diff --git a/debian/postrm b/debian/postrm
index ed3bac1..a5fd9ba 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -7,6 +7,15 @@ set -e
77
8# targets: purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear8# targets: purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear
99
10restore_timesyncd() {
11 # on next reboot it would start, but that would leave time
12 # unsynchronized until then. So as the Conflicts in the service file kill
13 # systemd-timesyncd re-establish it if it is enabled
14 if [ "$(systemctl is-enabled systemd-timesyncd 2>/dev/null)" = "enabled" ] ; then
15 deb-systemd-invoke start systemd-timesyncd
16 fi
17}
18
10case "$1" in19case "$1" in
11 purge)20 purge)
12 rm -f /var/lib/chrony/*21 rm -f /var/lib/chrony/*
@@ -30,9 +39,15 @@ case "$1" in
30 then39 then
31 deluser --quiet --system _chrony > /dev/null 2>&1 || true40 deluser --quiet --system _chrony > /dev/null 2>&1 || true
32 fi41 fi
42
43 restore_timesyncd
44 ;;
45
46 remove)
47 restore_timesyncd
33 ;;48 ;;
3449
35 remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)50 upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
3651
37 ;;52 ;;
3853

Subscribers

People subscribed via source and target branches