Re: setting the date for testing
On 2020-12-13 16:34, Michael Grant wrote: and now it appears to stick. So I'm good. Thanks for your help though! Michael Grant Glad to read you have solved it. Grx HdV
Re: setting the date for testing
> Could it be that you have systemd-timesyncd running? > > BTW, this is what I do to manually/explicitly set the system time (taken > verbatim from my vimwiki, so don't mind the wording): > > Changing the Current Date: > > # timedatectl set-time > > Or both at once: > > # timedatectl set-time > > This commands will fail if an NTP service is enabled. The NTP service can be > enabled and disabled using a command as follows: > > # timedatectl set-ntp > > Changes to the status of chrony or ntpd will not be immediately noticed by > timedatectl. If changes to the configuration or status of these tools are > made, enter the following command: > > # systemctl restart systemd-timedated.service > > By default, the system is configured to use UTC. To configure your system to > maintain the clock in the local time, run the timedatectl command with the > set-local-rtc option as root: > > # timedatectl set-local-rtc I tried stopping systemd-timedated and ntp: # systemctl stop systemd-timedated.service # systemctl stop ntp Then: # timedatectl set-time 2025-12-13 14:01:42 and here's what I see by running date every few seconds: # date Sat 13 Dec 14:01:43 GMT 2025 # date Sat 13 Dec 14:01:44 GMT 2025 # date Sun 13 Dec 14:01:48 GMT 2020 # date Sun 13 Dec 14:01:49 GMT 2020 I can't see anything running that would re-set the date. This is a VM running inside virtualbox. I just figured it out, it WAS using the hardware clock. I shut down the VM and ran this on the host: VBoxManage modifyvm MyVM --biossystemtimeoffset 12623040 and now when it booted, I saw this: $ date Sun 13 Dec 15:29:47 GMT 2020 $ date Fri 13 Dec 15:29:59 GMT 2024 $ date Fri 13 Dec 15:30:00 GMT 2024 $ date Fri 13 Dec 15:30:01 GMT 2024 $ date Fri 13 Dec 15:30:01 GMT 2024 $ date Fri 13 Dec 15:31:49 GMT 2024 and now it appears to stick. So I'm good. Thanks for your help though! Michael Grant signature.asc Description: PGP signature
Re: setting the date for testing
On 2020-12-13 14:36, Michael Grant wrote: This did not work: # timedatectl set-ntp true Failed to set ntp: NTP not supported # timedatectl set-ntp false Failed to set ntp: NTP not supported Other ideas? I am trying to set the date manually so that I can test the system set at future dates. Setting the system using the date command, it just resets itself back to the current date/time after a few seconds. How can I stop this? Thanks! Michael Grant *From: *hdv@gmail <mailto:hdv.ja...@gmail.com> *Sent: *07 December 2020 07:53 *To: *debian-user@lists.debian.org <mailto:debian-user@lists.debian.org> *Subject: *Re: setting the date for testing On 2020-12-06 21:56, hdv@gmail wrote: > # timedatectl set-ntp true I am sorry for the typo. This should of course have been "false"! Grx HdV Could it be that you have systemd-timesyncd running? BTW, this is what I do to manually/explicitly set the system time (taken verbatim from my vimwiki, so don't mind the wording): Changing the Current Date: # timedatectl set-time Or both at once: # timedatectl set-time This commands will fail if an NTP service is enabled. The NTP service can be enabled and disabled using a command as follows: # timedatectl set-ntp Changes to the status of chrony or ntpd will not be immediately noticed by timedatectl. If changes to the configuration or status of these tools are made, enter the following command: # systemctl restart systemd-timedated.service By default, the system is configured to use UTC. To configure your system to maintain the clock in the local time, run the timedatectl command with the set-local-rtc option as root: # timedatectl set-local-rtc HTH Grx HdV
RE: setting the date for testing
This did not work: # timedatectl set-ntp true Failed to set ntp: NTP not supported # timedatectl set-ntp false Failed to set ntp: NTP not supported Other ideas? I am trying to set the date manually so that I can test the system set at future dates. Setting the system using the date command, it just resets itself back to the current date/time after a few seconds. How can I stop this? Thanks! Michael Grant From: hdv@gmail Sent: 07 December 2020 07:53 To: debian-user@lists.debian.org Subject: Re: setting the date for testing On 2020-12-06 21:56, hdv@gmail wrote: > # timedatectl set-ntp true I am sorry for the typo. This should of course have been "false"! Grx HdV
Re: setting the date for testing
On Sun, Dec 06, 2020 at 08:43:51PM +, Michael Grant wrote: I need to set the date to several years in the future in order to test something. When I do this via the date command, the date returns back almost instantly (or within a few seconds). Depending on what you're doing you may want to look at the faketime or datefudge packages.
Re: setting the date for testing
On 2020-12-06 21:56, hdv@gmail wrote: > # timedatectl set-ntp true I am sorry for the typo. This should of course have been "false"! Grx HdV
Re: setting the date for testing
On 2020-12-06 21:43, Michael Grant wrote: I need to set the date to several years in the future in order to test something. When I do this via the date command, the date returns back almost instantly (or within a few seconds). # timedatectl set-time 2025-12-06 20:41:41 # date Sat 6 Dec 20:41:43 GMT 2025 # date Sat 6 Dec 20:41:44 GMT 2025 # date Sun 6 Dec 20:41:48 GMT 2020 I’m not using ntp (that I know of). # timedatectl timesync-status Failed to query server: The name org.freedesktop.timesync1 was not provided by any .service files # timedatectl show Timezone=Europe/London LocalRTC=no CanNTP=no NTP=no NTPSynchronized=no TimeUSec=Sun 2020-12-06 20:37:19 GMT RTCTimeUSec=Sun 2020-12-06 18:51:22 GMT How can I stop (temporarily) the system from automatically setting the date so that I can set it forward? I encountered this type of thing myself a while ago as well. And, just like you, I thought there was no NTP running, but systemd had some tricks upon its sleeve. Try this to see if it solves your troubles: # timedatectl set-ntp true Changes to the status of this service will not be immediately noticed by timedatectl. Thus, you'll have to enter the following command too: # systemctl restart systemd-timedated.service HTH Grx HdV