Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: GentooForum.de. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

18.06.2014, 17:46

systemd und Uhrzeit

Hallo,
nachdem ich mehrmals mit timedatectl set-time "2014-***" die Uhrzeit neu gesetzt habe würde ich das gern automatisieren. Wie kann ich beim Systemstart und dem Einsatz von systemd meine Uhrzeit mit einem Zeitserver abgleichen?
MfG

2

18.06.2014, 18:11

Hallo,

wie wäre es wenn Du einen ntp Dienst installierst?

Alternativ, kannst Du versuchen die Datei /etc/conf.d/hwclock zu editieren und clock_systohc="YES" aktivierst.


Viele Grüße

Andreas

3

18.06.2014, 18:32

ntp habe ich schon ausprobiert.
openntpd
ntp
Bin aber damit nicht klar gekommen.
Ich habe jetzt

Quellcode

1
emerge --ask ntp

Die config habe ich nicht verändert

Quellcode

1
2
3
4
5
6
7
8
server 0.gentoo.pool.ntp.org
server 1.gentoo.pool.ntp.org
server 2.gentoo.pool.ntp.org
server 3.gentoo.pool.ntp.org
driftfile       /var/lib/ntp/ntp.drift
restrict default nomodify nopeer noquery limited kod
restrict 127.0.0.1
restrict [::1]


Quellcode

1
ntpdate pool.ntp.org
Das funktioniert.

Quellcode

1
timedatectl set-ntp true

Mal sehen, ob das auf Dauer funktioniert.
Danke

4

18.06.2014, 20:03

Ich hoffe Du hast es auch unter systemd aktivier?

Sonnst funktioniert es nicht.

Viele Grüße

5

18.06.2014, 20:22

Da ich mich mit systemd nicht ausḱenne nutze ich die Einstellungen unter kde systemsettings. Dort finde ich ntpd.service inactive. Wenn ich auf Start klicke kommt

Quellcode

1
2
Unable to authenticate/execute the action: code 7
Unit ntpd.service failed to load: No such file or directory.

Quellcode

1
2
systemctl start ntpd.service
Failed to start ntpd.service: Unit ntpd.service failed to load: No such file or directory.

Ich habe gerade das gefunden

Quellcode

1
systemctl enable ntpd

Jetzt kann ich den Dienst auch starten.

6

18.06.2014, 21:30

Hallo,

also wenn ich Dich richtig verstehe läuft es jetzt, richtig?

Gruß

7

20.06.2014, 04:54

Hi, ich klink mich mal hier mit rein, vllt. kann man ja etwas helfen:

Zitat

Da ich mich mit systemd nicht ausḱenne nutze ich die Einstellungen unter kde systemsettings. Dort finde ich ntpd.service inactive. Wenn ich auf Start klicke kommt...


Oooohhhohhhhhoooohhh! Lass! Mach nicht mit KDE oderso... Das hat (als einer der wenigen Dinge in KDE) bei mir auch NIE funktioniert!

Hier schau mal:

Zitat

cat /etc/ntp.conf
# NOTES:
# DHCP clients can append or replace NTP configuration files.
# You should consult your DHCP client documentation about its
# default behaviour and how to change it.

# Name of the servers ntpd should sync with
# Please respect the access policy as stated by the responsible person.
#server ntp.example.tld iburst

# Common pool for random people
#server pool.ntp.org

# Pools for Gentoo users
#server 0.gentoo.pool.ntp.org
#server 1.gentoo.pool.ntp.org
#server 2.gentoo.pool.ntp.org
#server 3.gentoo.pool.ntp.org

# Hetzner-Online-AG
server ntp.hetzner.de iburst
server ntp1.hetzner.de iburst
server ntp2.hetzner.de iburst
server ntp3.hetzner.de iburst
server ntp.hetzner.com iburst
server ntp1.hetzner.com iburst
server ntp2.hetzner.com iburst
server ntp3.hetzner.com iburst
server ntp.hetzner.net iburst
server ntp1.hetzner.net iburst
server ntp2.hetzner.net iburst
server ntp3.hetzner.net iburst

##
# A list of available servers can be found here:
# http://www.pool.ntp.org/
# http://www.pool.ntp.org/#use
# A good way to get servers for your machine is:
# netselect -s 3 pool.ntp.org
##

# you should not need to modify the following paths
driftfile /var/lib/ntp/ntp.drift

#server ntplocal.example.com prefer
#server timeserver.example.org

# Warning: Using default NTP settings will leave your NTP
# server accessible to all hosts on the Internet.

# If you want to deny all machines (including your own)
# from accessing the NTP server, uncomment:
#restrict default ignore

# Restrictions
restrict ntp.hetzner.de nomodify notrap nopeer noquery
restrict ntp1.hetzner.de nomodify notrap nopeer noquery
restrict ntp2.hetzner.de nomodify notrap nopeer noquery
restrict ntp3.hetzner.de nomodify notrap nopeer noquery
restrict ntp.hetzner.com nomodify notrap nopeer noquery
restrict ntp1.hetzner.com nomodify notrap nopeer noquery
restrict ntp2.hetzner.com nomodify notrap nopeer noquery
restrict ntp3.hetzner.com nomodify notrap nopeer noquery
restrict ntp.hetzner.net nomodify notrap nopeer noquery
restrict ntp1.hetzner.net nomodify notrap nopeer noquery
restrict ntp2.hetzner.net nomodify notrap nopeer noquery
restrict ntp3.hetzner.net nomodify notrap nopeer noquery

# Default configuration:
# - Allow only time queries, at a limited rate, sending KoD when in excess.
# - Allow all local queries (IPv4, IPv6)
restrict default nomodify nopeer noquery limited kod
restrict 127.0.0.1
restrict [::1]


# To allow machines within your network to synchronize
# their clocks with your server, but ensure they are
# not allowed to configure the server or used as peers
# to synchronize against, uncomment this line.
#
#restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap


Diese Restricts kannst Du eigentlich weglassen unten. Das ist, wenn ein NTPd auf einem Server läuft, dieser nicht selbst dann als Timeserver andauernd angefragt wird...
Die Server hab ich auch vom Serverprovider. Gehen aber auch hier bei mir, lokal. Die, die bei der Config drinnestehen, per Standard: Liefen bei mir nicht. (Dasselbe in Windoof... musste andere suchen, die Standard gehen oft nicht)...

Was hast Du im File

Quellcode

1
/usr/lib/systemd/system/ntpd.service
?

Versuch es mal hiermit: (Kannst ja zur not Deine mal kurz umbenennen (ntpd.service -> kurzer_Test) - damit Du, sollten meine Einstellungen nicht gehen, zu Deinen zurückkehren kannst...

Quellcode

1
2
3
4
5
6
7
8
9
10
11
cat ntpd.service
[Unit]
Description=Network Time Service
After=ntpdate.service sntp.service

[Service]
ExecStart=/usr/sbin/ntpd -g -n
PrivateTmp=true

[Install]
WantedBy=multi-user.target


Guck mal, ob es mit den Einstellungen geht...
Gruß
mnt_gentoo
_________________________________________________________________________________________

Die Launen und das Schicksal eines Gentoo-Users: ?( :| :cursing: :wacko: 8| ^^ 8o ;( :P ?( ...

8

20.06.2014, 18:09

Quellcode

1
2
3
4
5
6
7
8
9
10
11
localhost olaf # cat /usr/lib/systemd/system/ntpd.service
[Unit]
Description=Network Time Service
After=ntpdate.service sntp.service

[Service]
ExecStart=/usr/sbin/ntpd -g -n
PrivateTmp=true

[Install]
WantedBy=multi-user.target


die /etc/ntp.conf habe ich jetzt mal geändert, da der Dienst lief, aber die Uhrzeit wieder falsch war. Ich habe den Dienst neu gestartet und jetzt stimmt die Uhr. Werde ich beobachten.

PS: Kann etwas dauern, da ich nicht jeden Tag starte.

Danke
MfG

9

22.06.2014, 20:13

Diese Standard-Timeserver liefen nicht bei mir. Funktionierten nicht. Hatte zuerst gedacht, es liege an Port-Forwarding im Router. "UDP 123" freigegeben. Ging auch nicht. Bei meinem Server im RZ den ich bei Hetztner habe habe ich (ebenfalls aus deren HowTos) die im letzten Post genannten eingetragen und die laufen einwandfrei. Die habe ich, als es hier an meinem lokalen mit den Standard-Servern nicht funktionierte, ebenfalls auf die Hetzner-NTPs in ntp.conf gesetzt und funktionierte - OHNE Änderungen in KDE - auch sofort. Im KDE funktionierte es NIE einzustellen. Das hab ich auch in KDE total abgestellt, das der irgendwas noch mit der Systemuhr zutun hat. Ich vermute: ENTWEDER / ODER... Also ENTWEDER N U R!!! KDE für die Controls der Systemuhr | ODER | KDE-Einstellungen nutzen. Da ich aber ohnehin selbst HIER - bei Systemstarts zunächst NUR auf die vconsole (ohne DE) aufstarte (DE starte ich später manuell 'systemctl start kdm.service' nach), bringt mir die KDE-Einstellung ohnehin wenig. NTPd vertraue ich da ein großes Stück mehr, als KDE.

P.S. Bei Servern (so meine Erfahrung) ist es ohnehin für manche Anwendungen von bedeutender Wichtigkeit, das die Uhr in sehr kleinen Schrittweiten synchronisiert wird, statt mit großen. Hatte es mal statt dem ntp-Server (also ntpd) mit dem ntp-CLIENTEN versucht, worauf dovecot (Mailserver) sich dann selbst beendet.

Dann wurde mir (in anderem Forum) vorgeschlagen, ntp-CLIENT - per CRON zu steuern :wacko: :wacko: :wacko: :wacko: - Eine weitere Inet-Seite wiederum sagt "Wer statt einem DAEMON" einen CLIENTEN per CRON (um dasselbe erreichen zu versuchen) steuert, sei ohnehin "palle" ;))) - Naja, ich mach es mit ntpd (also DAEMON) und bisher ist es zuverlässig.
Gruß
mnt_gentoo
_________________________________________________________________________________________

Die Launen und das Schicksal eines Gentoo-Users: ?( :| :cursing: :wacko: 8| ^^ 8o ;( :P ?( ...

Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »mnt_gentoo« (22.06.2014, 20:19)


10

13.02.2016, 08:16

Ich muss das noch einmal aufwärmen. Ich habe jetzt nach längerer zeit wieder Gentoo in Benutzung. Die Zeit passt nicht. Ich habe jetzt erst einmal folgendes gemacht:

Quellcode

1
2
3
4
5
6
7
8
/etc/conf.d/hwclock
clock="local" #neu

clock_systohc="YES" #Das hate ich schon

clock_hctosys="No" #neu

clock_args=""

Folgende Dateien sahen so aus, ohne das unter kde5 die Zeit gepaßt hat

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
cat /usr/lib/systemd/system/ntpd.service
[Unit]
Description=Network Time Service
After=ntpdate.service sntp.service
Conflicts=systemd-timesyncd.service

[Service]
ExecStart=/usr/sbin/ntpd -g -n
PrivateTmp=true

[Install]
WantedBy=multi-user.target

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
cat /etc/ntp.conf
# NOTES:
# DHCP clients can append or replace NTP configuration files.
# You should consult your DHCP client documentation about its
# default behaviour and how to change it.

# Name of the servers ntpd should sync with
# Please respect the access policy as stated by the responsible person.
#server         ntp.example.tld         iburst

# Common pool for random people
#server pool.ntp.org

# Pools for Gentoo users
#server 0.gentoo.pool.ntp.org
#server 1.gentoo.pool.ntp.org
#server 2.gentoo.pool.ntp.org
#server 3.gentoo.pool.ntp.org

# Hetzner-Online-AG
server ntp.hetzner.de iburst
server ntp1.hetzner.de iburst
server ntp2.hetzner.de iburst
server ntp3.hetzner.de iburst
server ntp.hetzner.com iburst
server ntp1.hetzner.com iburst
server ntp2.hetzner.com iburst
server ntp3.hetzner.com iburst
server ntp.hetzner.net iburst
server ntp1.hetzner.net iburst
server ntp2.hetzner.net iburst
server ntp3.hetzner.net iburst

##
# A list of available servers can be found here:
# http://www.pool.ntp.org/
# http://www.pool.ntp.org/#use
# A good way to get servers for your machine is:
# netselect -s 3 pool.ntp.org
##

# you should not need to modify the following paths
driftfile       /var/lib/ntp/ntp.drift

#server ntplocal.example.com prefer 
#server timeserver.example.org 

# Warning: Using default NTP settings will leave your NTP
# server accessible to all hosts on the Internet.

# If you want to deny all machines (including your own)
# from accessing the NTP server, uncomment:
#restrict default ignore
# Restrictions
restrict ntp.hetzner.de nomodify notrap nopeer noquery
restrict ntp1.hetzner.de nomodify notrap nopeer noquery
restrict ntp2.hetzner.de nomodify notrap nopeer noquery
restrict ntp3.hetzner.de nomodify notrap nopeer noquery
restrict ntp.hetzner.com nomodify notrap nopeer noquery
restrict ntp1.hetzner.com nomodify notrap nopeer noquery
restrict ntp2.hetzner.com nomodify notrap nopeer noquery
restrict ntp3.hetzner.com nomodify notrap nopeer noquery
restrict ntp.hetzner.net nomodify notrap nopeer noquery
restrict ntp1.hetzner.net nomodify notrap nopeer noquery
restrict ntp2.hetzner.net nomodify notrap nopeer noquery
restrict ntp3.hetzner.net nomodify notrap nopeer noquery

# Default configuration:
# - Allow only time queries, at a limited rate, sending KoD when in excess.
# - Allow all local queries (IPv4, IPv6)
restrict default nomodify nopeer noquery limited kod
restrict 127.0.0.1
restrict [::1]


# To allow machines within your network to synchronize
# their clocks with your server, but ensure they are
# not allowed to configure the server or used as peers
# to synchronize against, uncomment this line.
#
#restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap
# Generated by dhcpcd from eth0.dhcp
server 192.168.2.1
# End of dhcpcd from eth0.dhcp

Ähnliche Themen