Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selecting 'Daemon + Drift' as ntp method does not set date #1208

Closed
borpin opened this issue Oct 22, 2017 · 10 comments
Closed

Selecting 'Daemon + Drift' as ntp method does not set date #1208

borpin opened this issue Oct 22, 2017 · 10 comments

Comments

@borpin
Copy link

borpin commented Oct 22, 2017

Selecting 'Daemon + Drift' as ntp method does not set date

Required Information:

  • DietPi Version | 157
  • SBC Device? OrangePi Zero
  • Power supply used (EG: 5v 1A RAVpower)? Good!
  • SD card used (EG: Sandisk ultra)? Kingston
  • Distro (EG: Jessie) | uname -a? Linux DietPi 3.4.113-sun8i v64 #18 SMP PREEMPT Thu Jun 15 02:16:06 CEST 2017 armv7l GNU/Linux

Additional Information (if applicable):

  • Can this issue be replicated on a fresh installation of DietPi? Yes

Expected behavior:

Selecting 'daemon + drift' as time syncronization method sets the correct date time

Actual behavior:

Date / Time is not being set correctly. Daemon does not seem to be running.

Steps to reproduce:

When creating a new image, in the dietpi setup configuration file, select 'Daemon + Drift' as ntp method.

Did you submit a dietpi-bugreport?

31ce7a2b-3cd9-4754-a9b4-24ac5eba4b88-0

Extra details:

A message relating to ntp is seen during setup indicating it has been successful.

On a fresh install as tzdata is installed the following message is seen (indicating date/time has not been set)

Current default time zone: 'Europe/London'
Local time is now:      Sat Mar 11 12:16:44 GMT 2017.
Universal Time is now:  Sat Mar 11 12:16:44 UTC 2017.
Run 'dpkg-reconfigure tzdata' if you wish to change it.

Not sure what should be running as the daemon but there is no sign of ntpd or systemd-timesyncd

Package ntp is installed.

It seems reasonable to use systemd-timesyncd

root@DietPi:/lib/systemd/system# systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; disabled)
   Active: inactive (dead)
     Docs: man:systemd-timesyncd.service(8)

My Solution locally

  • Edit /etc/systemd/timesyncd.conf and enabled the time servers line.
  • Enable systemd-timesyncd systemctl enable systemd-timesyncd.service
  • Start systemd-timesyncd systemctl start systemd-timesyncd.service
  • Check timedatactl
root@DietPi:/usr/sbin# timedatectl status
      Local time: Sun 2017-10-22 09:33:52 BST
  Universal time: Sun 2017-10-22 08:33:52 UTC
        RTC time: Thu 1970-01-01 00:34:09
       Time zone: Europe/London (BST, +0100)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2017-03-26 00:59:59 GMT
                  Sun 2017-03-26 02:00:00 BST
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2017-10-29 01:59:59 BST
                  Sun 2017-10-29 01:00:00 GMT
  • Note NTP synchronized: no
  • Enable syncronization timedatectl set-ntp true

Reference used [(https://feeding.cloud.geek.nz/posts/time-synchronization-with-ntp-and-systemd/)] although he intimates that ntp cannot be installed alongside systemd-timesyncd.

@MichaIng
Copy link
Owner

MichaIng commented Nov 9, 2017

Jep, choosing 'Daemon + Drift' doesn't seem to have any effect. No service/process of ntp can be found active.

@Fourdee
Copy link
Collaborator

Fourdee commented Nov 9, 2017

Quick test on Odroid C2, unable to replicate:

root@DietPi:~# timedatectl status
      Local time: Thu 2017-11-09 20:02:34 GMT
  Universal time: Thu 2017-11-09 20:02:34 UTC
        RTC time: n/a
       Time zone: Europe/London (GMT, +0000)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 2017-10-29 01:59:59 BST
                  Sun 2017-10-29 01:00:00 GMT
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 2018-03-25 00:59:59 GMT
                  Sun 2018-03-25 02:00:00 BST

image

Could be specific to our OPi Zero image.

@MichaIng
Copy link
Owner

MichaIng commented Nov 10, 2017

  • Okay, for the first, dbus need to be installed for systemd to initiate systemd-timesyncd
  • On Jessie then the service is starting as expected.
  • But on Stretch, it fails if ntp is still installed and active: https://superuser.com/questions/938926/systemd-timesyncd-service-start-fails
    This error really just shows up on Stretch. On Jessie everything works, even if the mentioned /usr/sbin/ntpd is present.

https://feeding.cloud.geek.nz/posts/time-synchronization-with-ntp-and-systemd/

In any case the ntp package is not necessary anymore, so should be purged if timesyncd is used, and pool server can be changed via /etc/systemd/timesyncd.

@Fourdee
Copy link
Collaborator

Fourdee commented Nov 10, 2017

@MichaIng

Great find 👍

But on Stretch, it fails if ntp is still installed and active:
In any case the ntp package is not necessary anymore, so should be purged if timesyncd is used

So in theory, we could simply apt-get purge ntp when user selects daemon + drift, and visa versa, reinstall as needed?

@MichaIng
Copy link
Owner

MichaIng commented Nov 10, 2017

Jep, this also works on Jessie and we can keep installation slim this way. ntp pools need to be set in /etc/systemd/timesyncd.conf then.

But in terms of memory consumption ntp called by cron is still the preferred way, as systemd-timesyncd consumes up to 5M on my VMs + additional dbus memory.

@Fourdee
Copy link
Collaborator

Fourdee commented Nov 12, 2017

@MichaIng

👍 I'll add this to v159 milestone

@borpin
Copy link
Author

borpin commented Nov 12, 2017

It has been suggested to me that timesyncd may not work on a Read Only filesystem https://community.openenergymonitor.org/t/ensuring-emonpi-emonbase-time-is-synchronised-with-an-ntp-server/5487/11

Not sure if this is useful information or not.

Fourdee referenced this issue Nov 13, 2017
+ NTPD Modes | NTP is now uninstalled when SystemD timedatectl is
enabled. Reinstalled on demand. Timedatectl pool servers are now also
set:
https://github.com/Fourdee/DietPi/issues/1208#issuecomment-343762480
Fourdee referenced this issue Nov 13, 2017
+ Minor, use function to terminate ntp process:
https://github.com/Fourdee/DietPi/issues/1208#issuecomment-343762480
@Fourdee
Copy link
Collaborator

Fourdee commented Nov 13, 2017

Tested 2 > 4 > 0 > 2 > after all commits on:

  • 🈯️ Jessie
  • 🈯️ Stretch

Fourdee referenced this issue Nov 13, 2017
+ Reboot no longer required.
+ No need to patch entry for ntp to .installed file, if installed.
set_software installs/uninstalls on demand.
https://github.com/Fourdee/DietPi/issues/1208#issuecomment-343762480
@MichaIng
Copy link
Owner

Works great, also tested with Jessie and Stretch VMs back and forth 🙂.

@Fourdee
Copy link
Collaborator

Fourdee commented Nov 15, 2017

@MichaIng

Excellent 👍

I'll mark this as completed.

@Fourdee Fourdee closed this as completed Nov 15, 2017
@Fourdee Fourdee mentioned this issue Dec 10, 2017
Fourdee referenced this issue Dec 10, 2017
**v159**
(10/11/17)

**Image Modifications:**

VMWare | Updated to Debian Stretch: https://github.com/Fourdee/DietPi/issues/1219

VirtualBox | Updated to Debian Stretch, many thanks @MichaIng: https://github.com/Fourdee/DietPi/issues/1219

RPi | Updated to Debian Stretch: https://github.com/Fourdee/DietPi/issues/475

**Changes / Improvements / Optimizations:**

General | Odroid XU3/4 images updated: Includes kernel support for EMMC 5.1 (thanks Meveric): https://github.com/Fourdee/DietPi/issues/1252

General | DietPi RPi kernel: Updated to 4.9.62.

General | DietPi RPi kernel: Will no longer re-install, if the current version is already at latest.

General | Added farenheit readouts for cpu_info and dietpi-config. For those "over the pond" :D : http://dietpi.com/phpbb/viewtopic.php?f=12&t=2516&p=9772#p9772

General | Sparky SBC: Kernel update to add support for USB 1.1 DACs, thanks @sudeep. This must be enabled manually, if using a USB 1.1 DAC, as this breaks Allo WiFi dongle. Edit "/DietPi/uEnv.txt" and change the value "aotg.aotg1_speed=1" (from "0"), then reboot.
General | We now define a default LD_LIBRARY_PATH for all systems, exported from /etc/bash.bashrc: https://github.com/Fourdee/DietPi/issues/475#issuecomment-350380744

DietPi-Services | Run "dietpi-services help" to see a full list of updated commands: Added support for "enable" and "disable". "disable" will stop and disable the service and prevent it from running, "enable" will enable and start the service. EG: "dietpi-services disable cron", will prevent Cron from starting. Added support for start/stop/restart a single service (eg: dietpi-services stop apache2). This is basically a symlink to systemD: https://github.com/Fourdee/DietPi/issues/1114

DietPi-Config | WiFi: Now uses the wpa_supplicant.conf method to setup WiFi connections. WEP is no longer supported by DietPi in this mode. WPA-PSK/WPA2-PSK and OPEN hosts supported: https://github.com/Fourdee/DietPi/issues/1262

DietPi-Backup | "Full Backup" Mode is now the default for fresh DietPi installations. This is mainly due to MySQL data now being in the DietPi userdata directory.

DietPi-Config | Tools > Benchmarks: Added ability to benchmark CPU performance based on bash + integer: https://github.com/Fourdee/DietPi/issues/1253#issuecomment-346881878

DietPi-Config | Time sync modes: NTP is now uninstalled when SystemD timedatectl is enabled. Reinstalled on demand. Timedatectl pool servers are now also set: https://github.com/Fourdee/DietPi/issues/1208#issuecomment-343762480

DietPi-Software | First run setup, now logged to /etc/dietpi/logs/dietpi-firstrun-setup.log.

DietPi-Software | APT log: Moved to /etc/dietpi/logs/dietpi-software_apt.log, to prevent RAMlog clearing log during automated installations.

DietPi-Software | MPD (Stretch): Install updated to 0.20.11. Also supports native DSD playback (thanks to @sudeep and PJotr), when "Native" output freq/bit is set: https://github.com/Fourdee/DietPi/issues/1236

DietPi-Software | moOde: MPD now installed via pre-built binaries. Will reduce install time: https://github.com/Fourdee/DietPi/issues/1223#issuecomment-345265290

DietPi-Software | Nextcloud: Correct database access issue for MariaDB + minor fixes: https://github.com/Fourdee/DietPi/pull/1242

DietPi-Software | ownCloud: Installation fixed, respecting different distro repos: https://github.com/Fourdee/DietPi/pull/1243

DietPi-Software | MPD (inc YMPD/O!MPD): Default data directory is now "/mnt", this will include all USB drives and network locations: https://github.com/Fourdee/DietPi/issues/1202

DietPi-Software | Mopidy: Default data directory is now "/mnt", this will include all USB drives and network locations.

DietPi-Software | Syncthing: Installation updated to version 0.14.40, for new installations only. Removal of inotify (now included in main syncthing): https://github.com/Fourdee/DietPi/issues/1260

DietPi-Software | Node-Red: Symlink created during install from ~/.node-red to DietPi user data dir: https://github.com/Fourdee/DietPi/issues/1256

DietPi-Software | YMPD: Fixed Stretch installation + Now available for all CPU archs + Upgraded to SystemD service: https://github.com/Fourdee/DietPi/issues/475

DietPi-Software | Gitea: Install updated to 1.3.1 (for new installations only). Added support for ARMv8. Now installed to /mnt/dietpi_userdata/gitea, runs as dietpi user: https://github.com/Fourdee/DietPi/issues/686 http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=9863#p9863

**Bug Fixes:**

DietPi-Automation | Resolved an issue where SSH server choice, was not installing selected choice: https://github.com/Fourdee/DietPi/issues/1122

DietPi-Config | Nvidia driver: nouveau now disabled by default on x86_64, fix for 750Ti and possibily other Nvidia chipsets (thanks dubyazero): https://github.com/Fourdee/DietPi/issues/1244

DietPi-Config | RPi Stretch: Resolved an issue with onboard Wifi failing to scan: https://github.com/Fourdee/DietPi/issues/1262

DietPi-Config | RAM Benchmark: Resolved an issue where devices without /tmp mounted to tmpfs would fail the test. We now check for this mount, prior to allowing the test to run: https://github.com/Fourdee/DietPi/issues/1130#issuecomment-350114298

DietPi-Software | Pi-Hole: Resolved various issues with this installation. DietPi will now also detect a failed Pi-Hole script exit and flag as not installed. : https://github.com/Fourdee/DietPi/issues/1282#issuecomment-350490524

DietPi-Software | Redis: Minor un/installation/activation fixes of PHP module (Thanks to @MichaIng) : https://github.com/Fourdee/DietPi/pull/1249

DietPi-Software | moOde: Resolved an issue where dietpi-drive_manager mounted drives, would not be available in the libary: https://github.com/Fourdee/DietPi/issues/1223#issuecomment-346708298

DietPi-Software | PHP: Solve 'upload_tmp_dir' issue, if PHP service uses 'PrivateTmp': https://github.com/Fourdee/DietPi/issues/1144

DietPi-Software | Syncthing: Resolved a permissions issue with self program updates: https://github.com/Fourdee/DietPi/issues/1260

DietPi-Software | Home Assistant: Resolved an issue with ARMv8 installation, where Python build would fail due to lack of build-essential: https://github.com/Fourdee/DietPi/issues/1255

DietPi-Software | MPD: Corrected various uninstallation issues.

DietPi-Software | APT Removal: Resolved an issue in Stretch, where held packages were not being removed: https://github.com/Fourdee/DietPi/issues/475

DietPi-Software | FFMPEG: Resolved inability to install on XU4 Jessie: https://github.com/Fourdee/DietPi/issues/1273

DietPi-Software | Chromium (RPi Stretch): Resolved installation + desktop icon symlink: https://github.com/Fourdee/DietPi/issues/475#issuecomment-350111359

DietPi-Software | Resolved an issue where dietpi permissions were not being set correctly, for symlinked userdata dir.

DietPi-Update | Resolved an issue where .update_available file would still exist in no network situations: https://github.com/Fourdee/DietPi/issues/1258

Patch_File | Auto swapfile generation no longer run twice (mostly for pre v150 images): https://github.com/Fourdee/DietPi/issues/1257

**Allo Web Interface v4:**

MPD: Native DSD playback support, when "Native" output freq/bit is set in MPD settings page: https://github.com/Fourdee/DietPi/issues/1241

MPD: Default data directory is now "/mnt", this will include all USB drives and network locations.

SQUEEZELITE: Added ability to set native DSD output modes. Please note, success of selected output mode is limited to DAC and kernel capabilities. We have verified Combo 384 with u32le output mode on Sparky SBC + USB Bridge: https://github.com/Fourdee/DietPi/issues/1237#issuecomment-348241209

O!MPD: Updated to 1.03. Please make sure to update your library (Settings > Update), to rescan the new "/mnt" location which includes all networked and USB drives. Depending on your additional storage setup, the rescan may take 5-30 minutes.

RPi Image: Has been updated to Debian Stretch. This offers peformance improvements in the web interface, and newer ALSA libs. Previous installations are still supported. To upgrade, please write the new image. Upgrading to Stretch is not a requirement: http://dietpi.com/phpbb/viewtopic.php?f=8&t=2317&p=8869#p8869

Sparky SBC: We have remove the WiFi Hotspot installation by default, this is to avoid majority users having to remove this software title, before WiFi can be configured via terminal access. To reinstall this software, please connect the WiFi dongle, then run "dietpi-software install 60" via terminal.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants