1

I have a 13" Lenovo Flex 5 (2022) Chromebook, running ChromeOS 111 and I need to be able to manually set the date and time. From internet searches, I found that I should be able to use the set_time command in the Chrome Shell (CROSH) to do this, but it fails with an error (see example in code block)

crosh> set_time 22 April 2023 11:45am
ERROR - Time not set. Network time cannot be overridden.
ERROR - ERROR: command failed

From Settings > Advanced > Date and Time I have tried manually setting the time zone, but this isn't adequate for my need and doesn't resolve the set_time error. I have also tried disabling all networks and running the command, with the same result.

I'm pretty new to Chrome OS, so I've thought of a couple other ideas, but not sure if these would work or how to execute them (change the NTP target or change the hosts file to loopback so the network time fails -or- create a local NTP server to manually set the time).

How can I manually set the time on ChromeOS?

1

2 Answers 2

2

There is an extensive article on timekeeping for Chromium OS, which should be equally valid for Chrome OS.

It is not foreseen for the user to manually set the time, as all secure network protocols rely on a coherent timekeeping. An example is that a malware could set back the clock to trick the OS into accepting expired certificates.

An accurate up-to-date clock is critical to modern devices. Secure network communication is fundamentally based on systems having clocks in sync with each other. Even being out of sync by as little as O(hours) is enough to disrupt some services.

In the articles there are three documented workarounds. Besides the Bios method, which is only possible on some hardware, these workarounds are possible only after a restart and as long as there's no network connection:

  • chrome://set-time

NB: This stops working once the system is able to sync with the network.

  • crosh -> set_time

NB: This stops working once the system is able to sync with the network.

  • In the BIOS on non-CrOS hardware (e.g. ChromeOS Flex)

As you can read in the article, the above methods also won't allow you to set the clock back to earlier than a compile constant, which is 1st Jan of the year in which your OS version was released. I quickly summarize the failsafe methods for the clock:

When a CrOS device is off, the current time is maintained in the real time clock (RTC) in UTC format.

Should the built-in battery fail, on startup

typically the clock is initialized to the (Unix) epoch (1 Jan 1970).

However:

When userland starts executing, one of the very first programs run is platform2/init/chromeos_startup. The first thing it does is check the system clock and compare it to a minimum valid time, a compile-time constant. If the system clock is older than that, we immediately set the clock to that time.

And also:

When we build CrOS, we hardcode Jan 1st of the current year as the minimum valid time. We update this constant yearly.

Furthermore:

(R121: a maximum valid time check added which is minimum valid time + 30 years)

To sum up:

Basically, on any Chrome OS release, there's no way to set the clock to any time before January 1st of the year that release was made. Even a OS hack would immediately be corrected at startup of the system. And at most, you can turn the clock forward 30 years. But as soon as you connect to the internet, the clock will sync with Google's servers.

A last note

Given that your crosh command failed on a date that should have been possible to set, it is entirely possible that in Chrome OS the manual time correction methods available in Chromium OS are disabled. Chromebooks were developed to be "extensions of the Internet", and Google is taking good care that you cannot really escape such concept. From Wikipedia

Google announced the project in July 2009, initially describing it as an operating system where applications and user data would reside in the cloud. ChromeOS was used primarily to run web applications.

EDIT - possible partial solution

Given the article linked in another answer, it looks like ChromeOS 'remembers' when its time was once set through the network, and won't let it be changed. to work around this, try the following:

  • disconnect any network
  • restart your Chromebook and enter Bios by repeatedly hitting F2 (or Fn+F2) during startup (it's a Lenovo, so that's the key to enter Bios - might be a different key for a different OEM).
  • In Bios, set the system time to some years in the past
  • Now, once Chrome OS starts, the time will be set to Jan 1st of the current year (as explained above).
  • You should now be able to manually set the time & date using set_time in CROSH, taking into account the limits described here above.
2
  • see my edit here above
    – 1NN
    May 22 at 8:17
  • Thanks for the detailed answer! Unfortunately I can't test it, since the Chromebook in question is now broken (unrelated.) However, it certainly looks like you've covered all bases I can imagine and gave a lot of helpful background, so I'm accepting this answer. 2 days ago
2

I'm going out on a limb here but skimming what source code in Chromium, (I know it's not Chrome OS) you might try time_info command in crosh. If the reply states that the network-synchronized is a yes, then the statis cannot be changed. I'm not sure what exactly makes network-synchronized active but I think this is intentional According to this article.

" If the time has not been set automatically via network syncing, the system clock can be changed. This dialog allows the user to change the date, time and time zone when possible. The motivation is to unbrick devices with the wrong time that need to be rolled out into time-sensitive networks. "

Based on what I'm reading, the Chromium system is intended to disallow users to modify the time to be adjusted for security reasons. Since Chrome OS is commercialize, I would be willing to bet you cannot work around this without violating something or other.

1
  • +1, thanks for the helpful tip and finding this article! 2 days ago

You must log in to answer this question.

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