* [PATCH 1/1] services: ntpd: Make large clock adjustments if necessary. @ 2016-10-12 23:21 Leo Famulari 2016-10-13 5:06 ` John Darrington 0 siblings, 1 reply; 6+ messages in thread From: Leo Famulari @ 2016-10-12 23:21 UTC (permalink / raw) To: guix-devel If the system clock is more than 1000 seconds off, ntpd will exit without adjusting the clock. Reported by reepca on #guix. * gnu/services/networking.scm (ntp-shepherd-service): Pass '-g' when starting the NTP daemon. --- gnu/services/networking.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 7495179..5261e38 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -296,7 +296,7 @@ restrict -6 ::1\n")) (requirement '(user-processes networking)) (start #~(make-forkexec-constructor (list (string-append #$ntp "/bin/ntpd") "-n" - "-c" #$ntpd.conf "-u" "ntpd"))) + "-c" #$ntpd.conf "-u" "ntpd" "-g"))) (stop #~(make-kill-destructor)))))))) (define %ntp-accounts -- 2.10.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] services: ntpd: Make large clock adjustments if necessary. 2016-10-12 23:21 [PATCH 1/1] services: ntpd: Make large clock adjustments if necessary Leo Famulari @ 2016-10-13 5:06 ` John Darrington 2016-10-13 14:12 ` Leo Famulari 0 siblings, 1 reply; 6+ messages in thread From: John Darrington @ 2016-10-13 5:06 UTC (permalink / raw) To: Leo Famulari; +Cc: guix-devel [-- Attachment #1: Type: text/plain, Size: 1874 bytes --] I think that this should be a configuration item in the service, so that the user can decide whether to have it or not. I don't think we should force it on the user. Some applications break if the clock makes large jumps. The ntpd authors decided that the default behaviour is not to make large jumps so I think we should respect that unless there is a good reason to do otherwise. So I think this should be configurable in /etc/config.scm and the default should be not to use -g J' On Wed, Oct 12, 2016 at 07:21:07PM -0400, Leo Famulari wrote: If the system clock is more than 1000 seconds off, ntpd will exit without adjusting the clock. Reported by reepca on #guix. * gnu/services/networking.scm (ntp-shepherd-service): Pass '-g' when starting the NTP daemon. --- gnu/services/networking.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 7495179..5261e38 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -296,7 +296,7 @@ restrict -6 ::1\n")) (requirement '(user-processes networking)) (start #~(make-forkexec-constructor (list (string-append #$ntp "/bin/ntpd") "-n" - "-c" #$ntpd.conf "-u" "ntpd"))) + "-c" #$ntpd.conf "-u" "ntpd" "-g"))) (stop #~(make-kill-destructor)))))))) (define %ntp-accounts -- 2.10.1 -- Avoid eavesdropping. Send strong encrypted email. PGP Public key ID: 1024D/2DE827B3 fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://sks-keyservers.net or any PGP keyserver for public key. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 181 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] services: ntpd: Make large clock adjustments if necessary. 2016-10-13 5:06 ` John Darrington @ 2016-10-13 14:12 ` Leo Famulari 2016-10-19 20:49 ` Ludovic Courtès 0 siblings, 1 reply; 6+ messages in thread From: Leo Famulari @ 2016-10-13 14:12 UTC (permalink / raw) To: John Darrington; +Cc: guix-devel [-- Attachment #1: Type: text/plain, Size: 942 bytes --] On Thu, Oct 13, 2016 at 07:06:50AM +0200, John Darrington wrote: > I think that this should be a configuration item in the service, so that the > user can decide whether to have it or not. I don't think we should force it > on the user. Some applications break if the clock makes large jumps. I agree. This is really something that the system administrator should evaluate and fix on a case-by-case basis. > The ntpd authors decided that the default behaviour is not to make large jumps > so I think we should respect that unless there is a good reason to do otherwise. > So I think this should be configurable in /etc/config.scm and the default should > be not to use -g For me, I have to do this so rarely (and never on the machines I currently use) that I am fine with having to run `ntpd -g ...` by hand. So, if we want to make this configurable in the OS configuration, volunteers are welcome to work on it :) [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] services: ntpd: Make large clock adjustments if necessary. 2016-10-13 14:12 ` Leo Famulari @ 2016-10-19 20:49 ` Ludovic Courtès 2016-10-19 21:39 ` Leo Famulari 0 siblings, 1 reply; 6+ messages in thread From: Ludovic Courtès @ 2016-10-19 20:49 UTC (permalink / raw) To: Leo Famulari; +Cc: guix-devel [-- Attachment #1: Type: text/plain, Size: 1123 bytes --] Leo Famulari <leo@famulari.name> skribis: > On Thu, Oct 13, 2016 at 07:06:50AM +0200, John Darrington wrote: >> I think that this should be a configuration item in the service, so that the >> user can decide whether to have it or not. I don't think we should force it >> on the user. Some applications break if the clock makes large jumps. > > I agree. This is really something that the system administrator should > evaluate and fix on a case-by-case basis. I agree too! And I think it’s good idea to have defaults that match upstream’s defaults. >> The ntpd authors decided that the default behaviour is not to make large jumps >> so I think we should respect that unless there is a good reason to do otherwise. >> So I think this should be configurable in /etc/config.scm and the default should >> be not to use -g > > For me, I have to do this so rarely (and never on the machines I > currently use) that I am fine with having to run `ntpd -g ...` by hand. > > So, if we want to make this configurable in the OS configuration, > volunteers are welcome to work on it :) Like this? [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: Type: text/x-patch, Size: 2132 bytes --] diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm index 7495179..ce281c5 100644 --- a/gnu/services/networking.scm +++ b/gnu/services/networking.scm @@ -265,11 +265,13 @@ Protocol (DHCP) client, on all the non-loopback network interfaces." ntp-configuration? (ntp ntp-configuration-ntp (default ntp)) - (servers ntp-configuration-servers)) + (servers ntp-configuration-servers) + (allow-large-adjustment? ntp-allow-large-adjustment? + (default #f))) (define ntp-shepherd-service (match-lambda - (($ <ntp-configuration> ntp servers) + (($ <ntp-configuration> ntp servers allow-large-adjustment?) (let () ;; TODO: Add authentication support. (define config @@ -296,7 +298,10 @@ restrict -6 ::1\n")) (requirement '(user-processes networking)) (start #~(make-forkexec-constructor (list (string-append #$ntp "/bin/ntpd") "-n" - "-c" #$ntpd.conf "-u" "ntpd"))) + "-c" #$ntpd.conf "-u" "ntpd" + #$@(if allow-large-adjustment? + '("-g") + '())))) (stop #~(make-kill-destructor)))))))) (define %ntp-accounts @@ -331,10 +336,13 @@ restrict -6 ::1\n")) ntp-service-activation))))) (define* (ntp-service #:key (ntp ntp) - (servers %ntp-servers)) + (servers %ntp-servers) + allow-large-adjustment?) "Return a service that runs the daemon from @var{ntp}, the @uref{http://www.ntp.org, Network Time Protocol package}. The daemon will -keep the system clock synchronized with that of @var{servers}." +keep the system clock synchronized with that of @var{servers}. +@var{allow-large-adjustment?} determines whether @command{ntpd} is allowed to +make an initial adjustment of more than 1,000 seconds." (service ntp-service-type (ntp-configuration (ntp ntp) (servers servers)))) [-- Attachment #3: Type: text/plain, Size: 87 bytes --] If that’s fine with you, I’ll commit it with a doc update. Thanks, Ludo’. ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] services: ntpd: Make large clock adjustments if necessary. 2016-10-19 20:49 ` Ludovic Courtès @ 2016-10-19 21:39 ` Leo Famulari 2016-10-20 19:44 ` Ludovic Courtès 0 siblings, 1 reply; 6+ messages in thread From: Leo Famulari @ 2016-10-19 21:39 UTC (permalink / raw) To: Ludovic Courtès; +Cc: guix-devel On Wed, Oct 19, 2016 at 10:49:32PM +0200, Ludovic Courtès wrote: > diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm > index 7495179..ce281c5 100644 > --- a/gnu/services/networking.scm > +++ b/gnu/services/networking.scm > @@ -265,11 +265,13 @@ Protocol (DHCP) client, on all the non-loopback network interfaces." > ntp-configuration? > (ntp ntp-configuration-ntp > (default ntp)) > - (servers ntp-configuration-servers)) > + (servers ntp-configuration-servers) > + (allow-large-adjustment? ntp-allow-large-adjustment? > + (default #f))) > > (define ntp-shepherd-service > (match-lambda > - (($ <ntp-configuration> ntp servers) > + (($ <ntp-configuration> ntp servers allow-large-adjustment?) > (let () > ;; TODO: Add authentication support. > (define config > @@ -296,7 +298,10 @@ restrict -6 ::1\n")) > (requirement '(user-processes networking)) > (start #~(make-forkexec-constructor > (list (string-append #$ntp "/bin/ntpd") "-n" > - "-c" #$ntpd.conf "-u" "ntpd"))) > + "-c" #$ntpd.conf "-u" "ntpd" > + #$@(if allow-large-adjustment? > + '("-g") > + '())))) > (stop #~(make-kill-destructor)))))))) > > (define %ntp-accounts > @@ -331,10 +336,13 @@ restrict -6 ::1\n")) > ntp-service-activation))))) > > (define* (ntp-service #:key (ntp ntp) > - (servers %ntp-servers)) > + (servers %ntp-servers) > + allow-large-adjustment?) > "Return a service that runs the daemon from @var{ntp}, the > @uref{http://www.ntp.org, Network Time Protocol package}. The daemon will > -keep the system clock synchronized with that of @var{servers}." > +keep the system clock synchronized with that of @var{servers}. > +@var{allow-large-adjustment?} determines whether @command{ntpd} is allowed to > +make an initial adjustment of more than 1,000 seconds." > (service ntp-service-type > (ntp-configuration (ntp ntp) (servers servers)))) > > > If that’s fine with you, I’ll commit it with a doc update. It looks good to me! Once we can run GuixSD on armhf or aarch64, I bet we will have lots of users with hardware lacking a battery-backed real time clock, and they will appreciate this option. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/1] services: ntpd: Make large clock adjustments if necessary. 2016-10-19 21:39 ` Leo Famulari @ 2016-10-20 19:44 ` Ludovic Courtès 0 siblings, 0 replies; 6+ messages in thread From: Ludovic Courtès @ 2016-10-20 19:44 UTC (permalink / raw) To: Leo Famulari; +Cc: guix-devel Leo Famulari <leo@famulari.name> skribis: > On Wed, Oct 19, 2016 at 10:49:32PM +0200, Ludovic Courtès wrote: >> diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm >> index 7495179..ce281c5 100644 >> --- a/gnu/services/networking.scm >> +++ b/gnu/services/networking.scm >> @@ -265,11 +265,13 @@ Protocol (DHCP) client, on all the non-loopback network interfaces." >> ntp-configuration? >> (ntp ntp-configuration-ntp >> (default ntp)) >> - (servers ntp-configuration-servers)) >> + (servers ntp-configuration-servers) >> + (allow-large-adjustment? ntp-allow-large-adjustment? >> + (default #f))) >> >> (define ntp-shepherd-service >> (match-lambda >> - (($ <ntp-configuration> ntp servers) >> + (($ <ntp-configuration> ntp servers allow-large-adjustment?) >> (let () >> ;; TODO: Add authentication support. >> (define config >> @@ -296,7 +298,10 @@ restrict -6 ::1\n")) >> (requirement '(user-processes networking)) >> (start #~(make-forkexec-constructor >> (list (string-append #$ntp "/bin/ntpd") "-n" >> - "-c" #$ntpd.conf "-u" "ntpd"))) >> + "-c" #$ntpd.conf "-u" "ntpd" >> + #$@(if allow-large-adjustment? >> + '("-g") >> + '())))) >> (stop #~(make-kill-destructor)))))))) >> >> (define %ntp-accounts >> @@ -331,10 +336,13 @@ restrict -6 ::1\n")) >> ntp-service-activation))))) >> >> (define* (ntp-service #:key (ntp ntp) >> - (servers %ntp-servers)) >> + (servers %ntp-servers) >> + allow-large-adjustment?) >> "Return a service that runs the daemon from @var{ntp}, the >> @uref{http://www.ntp.org, Network Time Protocol package}. The daemon will >> -keep the system clock synchronized with that of @var{servers}." >> +keep the system clock synchronized with that of @var{servers}. >> +@var{allow-large-adjustment?} determines whether @command{ntpd} is allowed to >> +make an initial adjustment of more than 1,000 seconds." >> (service ntp-service-type >> (ntp-configuration (ntp ntp) (servers servers)))) >> > >> >> If that’s fine with you, I’ll commit it with a doc update. > > It looks good to me! Once we can run GuixSD on armhf or aarch64, I bet > we will have lots of users with hardware lacking a battery-backed real > time clock, and they will appreciate this option. Good point. Pushed as dc0322b51111d12e1d97e2cc456100c44dd31bb6. Ludo’. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-10-20 19:44 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-10-12 23:21 [PATCH 1/1] services: ntpd: Make large clock adjustments if necessary Leo Famulari 2016-10-13 5:06 ` John Darrington 2016-10-13 14:12 ` Leo Famulari 2016-10-19 20:49 ` Ludovic Courtès 2016-10-19 21:39 ` Leo Famulari 2016-10-20 19:44 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/guix.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).