0

I want to set the date to "1990-??-??" on my PC, but when I reboot it, I see:

On Ubuntu 1604 the system date is "11 Feb 2016" but the RTC is "1990-??-??".

On Ubuntu 1404 both of them are "1 Jan 2014".

Is this Ubuntu bug?

I use the following commands to do that:

  1. # timedatectl set-ntp no (stop automatic time update)
  2. # timedatectl set-time "1990-8-8 20:20:20" (Set date)
  3. # hwclock --systohc (sync RTC)

I test some dates and found that I could not set date before "11-Feb-2016" on Ubuntu 1604 and "1-Jan-1998" on Ubuntu 1404.

1

When using systemd it sets the "reasonable" time when booting, i.e. advances the clock if it returns time older than the release date of systemd itself. These values are set in both timesyncd and init.

This is the place that sets TIME_EPOCH.

  • Is it possible to change the date to any desired date? If no, how I change this value or disable systemd to does not set new date? – H. mohseni Jun 30 '18 at 11:05
  • You need to recompile systemd, either with the code I've linked to disabled, or with particular mtime set on NEWS file. No easy way without recompilation comes to my mind. – Tomasz Pala Jul 1 '18 at 15:05
-1

On UNIX, there usually is a fallback with no working realtime clock:

The kernel then uses the time stamp from the super block of the root filesystem.

With the date command, you of course may set up any time in the range from at least Jan 1 1970 to 2038

  • I use date command but the result was the same. What do you mean " use from super block of the root filesystem" ? – H. mohseni Jun 30 '18 at 10:13
  • If your date does not allow you to set the date to Jan 1 1970, it is broken. The kernel setz up the date by a value from the root filesystem in case there is no working hardware clock. – schily Jun 30 '18 at 10:45
  • date and hwclock --systohc commands work properly. Problem occurs after reboot. – H. mohseni Jun 30 '18 at 10:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.