Reputation: 403
How to change system default date time on Debian permanently?
I tried following command
# date --set="12 MAY 2012 12:12:12 PM"
# hwclock --systoh
But date-time is getting changed temporary.
After few seconds, current date is popping again.
Did I miss something?
Update
System is guest OS on virtual box, where ntp is not enabled.
While ntp is enabled in host OS.
Upvotes: 1
Views: 3899
Reputation: 301
If you have a systemd system then you have to use timedatectl:
timedatectl set-ntp false
timedatectl set-time '2018-12-12 12:12:12'
Upvotes: 1
Reputation: 26380
Just execute this command:
dpkg-reconfigure tzdata
You will be asked for the timezone.
debian docs recommends using tzconfig
, but it seems to be deprecated in favor of dpkg-reconfigure tzdata
Upvotes: 2
Reputation: 341
Looks like NTP
is setting your time over internet.... You need to stop NTP
.
Try these commands:
sudo service ntp stop
To prevent it from starting at boot:
sudo update-rc.d -f ntp remove
You may need to uninstall ntpd
if needed. Even though you uninstall ntpd
, ntpdate
will be still installed in your system. You can add exit status to disable it.
Add exit 0
to /etc/default/ntpdate
.
Upvotes: 2