Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
howto save hwclock on shutdown/ntpdate-sync with systemd
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
Vrenn
Apprentice
Apprentice


Joined: 15 Dec 2004
Posts: 286

PostPosted: Mon Jul 28, 2014 9:51 pm    Post subject: howto save hwclock on shutdown/ntpdate-sync with systemd Reply with quote

Hello dear systemd-users.
Today I tried systemd and it works wery well for the first try.
There is ony one thing that annoys me:
systemd saves not the system-time in the hardware-clock (tested when changed from utc to local clock, reboot and the wrong clock was here)

I use ntpdate.service with a personal ntp-server in cat /etc/systemd/system/ntpdate.service.d/00gentoo.conf.
The new server is used but after reboot the hardware-time is not set!
a manuall hwclock --systohc does the job but how can I tell systemd to write it after running my ntp-client?

put it in 00gentoo.conf?
get a hwclock.service-file?
_________________
With nice greetings
Vrenn
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 5763

PostPosted: Mon Jul 28, 2014 11:21 pm    Post subject: Reply with quote

Enable this kernel option instead:
Code:
CONFIG_RTC_SYSTOHC:

If you say yes here, the system time (wall clock) will be stored
in the RTC specified by RTC_HCTOSYS_DEVICE approximately every 11
minutes if userspace reports synchronized NTP status.

Symbol: RTC_SYSTOHC [=y]
Type  : boolean
Prompt: Set the RTC time based on NTP synchronization
  Location:
    -> Device Drivers
      -> Real Time Clock (RTC_CLASS [=y])
  Defined at drivers/rtc/Kconfig:28
  Depends on: RTC_CLASS [=y]
Back to top
View user's profile Send private message
Vrenn
Apprentice
Apprentice


Joined: 15 Dec 2004
Posts: 286

PostPosted: Tue Jul 29, 2014 1:47 pm    Post subject: Reply with quote

I'm using this kernel-opt, but synced time is not saved in rtc. It just does nothing (tested for about an hour, controlled with timedatectl status).
_________________
With nice greetings
Vrenn
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 3960
Location: Dallas area

PostPosted: Tue Jul 29, 2014 2:13 pm    Post subject: Reply with quote

With openrc there is /etc/init.d/hwclock which will save the time.

There should be something similar in systemd.
If not it should be trivial to add the hwclock save to the shutdown script.


Edit to add: There should be a service with timedate in it's name, look at the man page for how to use it.
_________________
Asus m5a99fx, FX 8320 - nouveau, oss4, rx550 for qemu passthrough
Acer laptop E5-575, i3-7100u - i965, alsa
---both---
5.0.13 zen kernel, profile 17.0 (no-pie) amd64-no-multilib
gcc 8.2.0, eudev, openrc, openbox, palemoon
Back to top
View user's profile Send private message
Vrenn
Apprentice
Apprentice


Joined: 15 Dec 2004
Posts: 286

PostPosted: Tue Jul 29, 2014 8:02 pm    Post subject: Reply with quote

Good tip, I would prefer a shutdown-script, and will search for it.
At now I'm helping me by taking ntpdate out of my boot-process and putting it in the networkmanager-dispatcher:
/etc/NetworkManager/dispatcher.d/61-ntp-client:
#!/bin/bash

#first sync with systemd and my ntp-client
systemctl start ntpdate

#second write it to disc
hwclock --systohc
man timedatectl gives me only an example of setting up a full ntp-demon, not the right one for my laptop. Anyhow systemd is a very interesting new thing to look at (thanks gentoo).

I would not have believed that changing the core system is so trouble-free and the only problem that takes me hours should be the ntp...
_________________
With nice greetings
Vrenn
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum