{"id":145,"date":"2022-02-22T02:05:46","date_gmt":"2022-02-22T01:05:46","guid":{"rendered":"https:\/\/svenczaja.de\/?p=145"},"modified":"2026-01-16T16:43:14","modified_gmt":"2026-01-16T15:43:14","slug":"unendliche-weiten-zeit-fuckup-raspberry-pi","status":"publish","type":"post","link":"https:\/\/svenczaja.de\/index.php\/2022\/02\/22\/unendliche-weiten-zeit-fuckup-raspberry-pi\/","title":{"rendered":"Unendliche Weiten &#8230; Zeit FuckUP Raspberry PI"},"content":{"rendered":"\n<div class=\"wp-block-cover alignwide is-repeated\" style=\"min-height:190px;aspect-ratio:unset;\"><div role=\"img\" aria-label=\"Uhr Banner\" class=\"wp-block-cover__image-background wp-image-146 is-repeated\" style=\"background-position:50% 50%;background-image:url(https:\/\/blog.svenczaja.de\/wp-content\/uploads\/2022\/02\/uhr.jpg)\"><\/div><span aria-hidden=\"true\" class=\"wp-block-cover__background has-background-dim\"><\/span><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<p class=\"has-text-align-center has-large-font-size wp-block-paragraph\"><\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-columns alignwide is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Gerade eben bemerkte ich auf Einem meiner vielen Raspberry PIs, dass die Zeit nicht stimmt. Also mal geschaut was da los ist.<\/p>\n\n\n\n<pre class=\"wp-block-code alignwide has-small-font-size\"><code>pi@raspbirrypi:~ $ ntpq\n-bash: ntpq: command not found<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Befehl <code>ntpq<\/code> Fehlanzeige! Ist ntp denn \u00fcberhaupt installiert? <\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code><kbd>pi@raspbirrypi:~ $ dpkg -l | grep -i ntp\npi@raspbirrypi:~ $<\/kbd><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">N\u00f6 \ud83d\ude00<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Da ich schon l\u00e4nger dar\u00fcber nachdachte, dass eigentlich jeder Raspberry Pi bei mir im Netz eine gleiche Grundconfig ben\u00f6tigt, fangen wir doch jetzt damit an. \ud83d\ude42 Und so sieht das initiale Ansible Playbook aus.<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>root@netbase:\/etc\/ansible# cat raspberry_base.yml \n---\n- name: installiert die Basis Software auf alle Raspberries damit die Grundpakete alle gleich sind.  \n  hosts: raspi\n  become: yes\n  tasks:\n     - name: Install ntp\n       apt:\n        name: ntp\n        state: present\n     - name: Set Timezone to Europe\/Berlin\n       shell: \"timedatectl set-timezone Europe\/Berlin\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Dies werde ich dann in Zukunft immer mehr erweitern. Neben dem NTP Dienst habe ich auch gleich noch die Zeitzone gesetzt, da ich teilweise Raspberries mit UTC und andere mit CET gefunden habe. BTW -&gt; <code>become: yes<\/code> &lt;- steht daf\u00fcr, dass wir den root brauchen. Ist ja logisch, ein &#8222;normaler&#8220; User kann in der Regel keine Softwarepakete installieren.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ansible Playbook abgefeuert und fertig. \ud83d\ude42 <\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>root@netbase:\/etc\/ansible# ansible-playbook -u pi raspberry_base.yml \n\nPLAY &#91;installiert die Basis Software auf alle Raspberries damit die Grundpakete alle gleich sind.] ******************************************************************\n\nTASK &#91;Gathering Facts] ******************************************************************\nok: &#91;raspbirrypi.home]\nok: &#91;raspburrypi.home]\nok: &#91;raspbarrypi.home]\nok: &#91;raspborrypi.home]\nok: &#91;raspberrypi.home]\nok: &#91;blackberrypi.home]\nok: &#91;raspstrompi.home]\n\nTASK &#91;Install ntp] ******************************************************************\nok: &#91;raspburrypi.home]\nok: &#91;raspbarrypi.home]\nok: &#91;raspbirrypi.home]\nok: &#91;raspborrypi.home]\nok: &#91;blackberrypi.home]\nok: &#91;raspberrypi.home]\nok: &#91;raspstrompi.home]\n\nTASK &#91;Set Timezone to Europe\/Berlin] ******************************************************************\nchanged: &#91;raspbarrypi.home]\nchanged: &#91;raspburrypi.home]\nchanged: &#91;raspbirrypi.home]\nchanged: &#91;raspborrypi.home]\nchanged: &#91;blackberrypi.home]\nchanged: &#91;raspberrypi.home]\nchanged: &#91;raspstrompi.home]\n\nPLAY RECAP ******************************************************************\nblackberrypi.home          : ok=3    changed=1    unreachable=0    failed=0   \nraspbarrypi.home           : ok=3    changed=1    unreachable=0    failed=0   \nraspberrypi.home           : ok=3    changed=1    unreachable=0    failed=0   \nraspbirrypi.home           : ok=3    changed=1    unreachable=0    failed=0   \nraspborrypi.home           : ok=3    changed=1    unreachable=0    failed=0   \nraspburrypi.home           : ok=3    changed=1    unreachable=0    failed=0   \nraspstrompi.home           : ok=3    changed=1    unreachable=0    failed=0 <\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Wer sich noch fragt, was in meinem playbook <code>hosts: raspi<\/code> bedeutet. Der findet die Antwort hier. <\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>root@netbase:\/etc\/ansible# cat hosts \n# This is the default ansible 'hosts' file.\n#\n# It should live in \/etc\/ansible\/hosts\n#\n#   - Comments begin with the '#' character\n#   - Blank lines are ignored\n#   - Groups of hosts are delimited by &#91;header] elements\n#   - You can enter hostnames or ip addresses\n#   - A hostname\/ip can be a member of multiple groups\n\n# Ex 1: Ungrouped hosts, specify before any group headers.\n\n#green.example.com\n#blue.example.com\n#192.168.100.1\n#192.168.100.10\n\nnetbase.home ansible_connection=local\n\n# All RaspberrPis\n&#91;raspi]\nraspberrypi.home\nraspborrypi.home\nraspbirrypi.home\nraspburrypi.home\nraspbarrypi.home\nblackberrypi.home\nraspstrompi.home\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Kleiner Sidehack noch am Rande; sollte Euch mal die Zeit v\u00f6llig aus dem Ruder laufen und diese sich trotz hinterlegtem NTP Server nicht mehr einstellen, k\u00f6nnt ihr mit den folgenden Befehlen das Ganze per Workaround erstmal l\u00f6sen. <\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>pi@raspberrypi ~ $ sudo service ntp stop\npi@raspberrypi ~ $ sudo ntpd -gq\n22 Feb 01:50:18 ntpd&#91;21891]: ntpd 4.2.8p10@1.3728-o Sat Mar 10 18:03:33 UTC 2018 (1): Starting\n22 Feb 01:50:18 ntpd&#91;21891]: Command line: ntpd -gq\n22 Feb 01:50:18 ntpd&#91;21891]: proto: precision = 1.145 usec (-20)\n22 Feb 01:50:18 ntpd&#91;21891]: Listen and drop on 0 v6wildcard &#91;::]:123\n22 Feb 01:50:18 ntpd&#91;21891]: Listen and drop on 1 v4wildcard 0.0.0.0:123\n22 Feb 01:50:18 ntpd&#91;21891]: Listen normally on 2 lo 127.0.0.1:123\n22 Feb 01:50:18 ntpd&#91;21891]: Listen normally on 3 eth0 192.168.1.113:123\n22 Feb 01:50:18 ntpd&#91;21891]: Listen normally on 4 lo &#91;::1]:123\n22 Feb 01:50:18 ntpd&#91;21891]: Listen normally on 5 eth0 &#91;2003:c9:b702:26be:ba27:ebff:fec6:809c]:123\n22 Feb 01:50:18 ntpd&#91;21891]: Listen normally on 6 eth0 &#91;fe80::ba27:ebff:fec6:809c%2]:123\n22 Feb 01:50:18 ntpd&#91;21891]: Listening on routing socket on fd #23 for interface updates\n22 Feb 01:50:19 ntpd&#91;21891]: Soliciting pool server 173.212.192.154\n22 Feb 01:50:20 ntpd&#91;21891]: Soliciting pool server 195.201.163.190\n22 Feb 01:50:20 ntpd&#91;21891]: Soliciting pool server 144.76.0.164\n22 Feb 01:50:21 ntpd&#91;21891]: Soliciting pool server 46.165.252.57\n22 Feb 01:50:21 ntpd&#91;21891]: Soliciting pool server 176.9.166.35\n22 Feb 01:50:21 ntpd&#91;21891]: Soliciting pool server 2001:418:3ff::53\n22 Feb 01:50:22 ntpd&#91;21891]: Soliciting pool server 2001:638:504:2000::34\n22 Feb 01:50:22 ntpd&#91;21891]: Soliciting pool server 194.25.134.196\n22 Feb 01:50:22 ntpd&#91;21891]: Soliciting pool server 80.153.195.191\n22 Feb 01:50:22 ntpd&#91;21891]: Soliciting pool server 37.221.193.210\n22 Feb 01:50:23 ntpd&#91;21891]: Soliciting pool server 116.202.222.249\n22 Feb 01:50:23 ntpd&#91;21891]: Soliciting pool server 2a01:4f9:c010:bf3::2\n22 Feb 01:50:23 ntpd&#91;21891]: Soliciting pool server 3.121.254.221\n22 Feb 01:50:23 ntpd&#91;21891]: Soliciting pool server 162.159.200.123\n22 Feb 01:50:24 ntpd&#91;21891]: Soliciting pool server 185.11.138.90\n22 Feb 01:50:24 ntpd&#91;21891]: Soliciting pool server 2a03:4000:27:602:d4cf:50ff:fedb:b65a\n22 Feb 01:50:24 ntpd&#91;21891]: Soliciting pool server 213.209.109.44\n22 Feb 01:50:27 ntpd&#91;21891]: ntpd: time slew +0.009508 s\nntpd: time slew +0.009508s\npi@raspberrypi ~ $ sudo service ntp start<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" id=\"tw-target-text\">Das -gq weist den ntp-Daemon an, die Zeit ungeachtet des Offsets (g) zu korrigieren und sofort zu beenden (q), nachdem die Zeit eingestellt wurde.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Bei Wiederholung der Zeitprobleme m\u00fcsst ihr in die Analyse gehen, wo die eigentliche Ursache f\u00fcr das Problem liegt.<\/p>\n<\/div>\n<\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Gerade eben bemerkte ich auf Einem meiner vielen Raspberry PIs, dass die Zeit nicht stimmt. Also mal geschaut was da los ist. Befehl ntpq Fehlanzeige! Ist ntp denn \u00fcberhaupt installiert? N\u00f6 \ud83d\ude00 Da ich schon l\u00e4nger dar\u00fcber nachdachte, dass eigentlich jeder Raspberry Pi bei mir im Netz eine gleiche Grundconfig ben\u00f6tigt, fangen wir doch jetzt &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/svenczaja.de\/index.php\/2022\/02\/22\/unendliche-weiten-zeit-fuckup-raspberry-pi\/\" class=\"more-link\"><span class=\"screen-reader-text\">\u201eUnendliche Weiten &#8230; Zeit FuckUP Raspberry PI\u201c <\/span>weiterlesen<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[12,53,20,48,50,49,8,52,51,54],"class_list":["post-145","post","type-post","status-publish","format-standard","hentry","category-raspberrypi","tag-ansible","tag-cet","tag-linux","tag-ntp","tag-ntpd","tag-ntpq","tag-raspberry-pi","tag-timedatectl","tag-timezone","tag-utc","entry"],"_links":{"self":[{"href":"https:\/\/svenczaja.de\/index.php\/wp-json\/wp\/v2\/posts\/145","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/svenczaja.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/svenczaja.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/svenczaja.de\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/svenczaja.de\/index.php\/wp-json\/wp\/v2\/comments?post=145"}],"version-history":[{"count":12,"href":"https:\/\/svenczaja.de\/index.php\/wp-json\/wp\/v2\/posts\/145\/revisions"}],"predecessor-version":[{"id":256,"href":"https:\/\/svenczaja.de\/index.php\/wp-json\/wp\/v2\/posts\/145\/revisions\/256"}],"wp:attachment":[{"href":"https:\/\/svenczaja.de\/index.php\/wp-json\/wp\/v2\/media?parent=145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/svenczaja.de\/index.php\/wp-json\/wp\/v2\/categories?post=145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/svenczaja.de\/index.php\/wp-json\/wp\/v2\/tags?post=145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}