rmcsharry
rmcsharry

Reputation: 5552

How to manually change linux system time?

I have Mint Linux running in a VM.

I tried through the GUI to set the date to an earlier date so I could try to mimic a database issue that occurred on production on that date.

I tried to use the date command.

Both times, within a few seconds the date is changed back to today.

I stopping auto time synchronisation - the output from timedatectl status is:

    Local time: Mon 2016-04-18 15:41:19 BST
  Universal time: Mon 2016-04-18 14:41:19 UTC
        Timezone: Europe/London (BST, +0100)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2016-03-27 00:59:59 GMT
                  Sun 2016-03-27 02:00:00 BST
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2016-10-30 01:59:59 BST
                  Sun 2016-10-30 01:00:00 GMT

I tried:

hwclock --set --date="2016-04-13 16:45:05"

Nothing works, the clock just keeps going back to today.

Upvotes: 1

Views: 2040

Answers (2)

rmcsharry
rmcsharry

Reputation: 5552

I feel like an idiot.

I thought it was Linux or Mint magic...stupid me forgot it is a VM, so it gets the time from the host.

I change the time on the host manually and hey presto it changed in the VM.

Doh, posting the answer just in case someone else forgets the most obvious thing too!

Upvotes: 2

MicSokoli
MicSokoli

Reputation: 841

My first suggestion would be to check if you have automatic time and date updates turned on, and if yes, to turn off that option. The same thing happened on my machine, although I use Debian.

Upvotes: 0

Related Questions