1

For some reason the BIOS of my HP Proliant Microserver (running Debian Jessie) doesn't like its Battery anymore, I changed it a couple of times, it always complains about the Battery being empty, which is not correct, I checked with a Voltmeter.

As a consequence, the machine forgets its date on startup, obviously causing all sorts of problems on restart. As a "simple" workaround, I want to prevent Debian of using the hwclock as a timesource, use ntpd instead and then (if need be) set the hwclock to the time retrieved by ntp.

There seem to have been some changes how the time is managed in the last couple of years, ntpdate seems not the right way anymore. ntpd -qg works, then there are posts where people say timedatectl is the correct way to handle time setting nowadays on a systemd distribution, but it's not working out of the box on my Debian ("Failed to create bus connection: No such file or directory").

  1. What is the correct way to retrieve system time via ntp on boot on a Debian Jessie system?

  2. How do I prevent Debian from using the hwclock as a time source? (https://wiki.debian.org/DateTime mentions /etc/init.d/hwclock.sh - so do I just delete it?)

1 Answer 1

1

First, you actually do need to have the clock set right before you get a network connection.

On Debian, there's a package called fake-hwclock that will make sure things are kept sane. It stores the date on shutdown, and then sets the system time to that on startup. This ensures the clock never appears to run backwards. It's widely used on cheapuer SBC systems, such as the Raspberry Pi. You can switch to using this by just installing it. It will override the time that systemd has pulled from the hardware.

As far as actually setting the time via NTP, look into systemd-timesyncd or one of the various NTP clients out there. Just starting one will make sure the clock is set correctly, though you may need special configuration to get it to step the time properly (for example, the official NTP daemon will need you to pass the -g otpion to it so that it just overrides the time without worrying about the exisitng offset).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .