My Kali Linux is losing time
tedjames
Member Posts: 1,182 ■■■■■■■■□□
Weirdest thing. Up until a few weeks ago, the clock on my Kali Linux installation kept perfect time. Then one day it started slowing down. I reset it only to find it had lost 12 hours by the next day. I looked up the problem, and they recommended running these two commands:
sudo apt-get install ntpdate
sudo ntpdate in.pool.ntp.org
That reset the clock. And since then, I've run the second command several times, only to see it lose time again. I installed Kali Linux on Oracle VM Virtual Box over a year ago, and the clock has run fine up until now. The other tools/operations appear unaffected.
Any idea?
sudo apt-get install ntpdate
sudo ntpdate in.pool.ntp.org
That reset the clock. And since then, I've run the second command several times, only to see it lose time again. I installed Kali Linux on Oracle VM Virtual Box over a year ago, and the clock has run fine up until now. The other tools/operations appear unaffected.
Any idea?
Comments
-
636-555-3226 Member Posts: 975 ■■■■■□□□□□In over 20 years of working on computers I've never experienced that. If it was a physical box I'd say there's maybe a hardware problem. I've never dug into the time management in Debian (which Kali is derived from) or any other Linux box for that matter. Is there a time daemon that isn't running that should be? Maybe somehow you turned it off by accident? I only load up Kali occasionally - I don't use it for my daily driver - so I don't know if the Kali folks disable it by default or something.
-
TheFORCE Member Posts: 2,297 ■■■■■■■■□□Kali has had a new release recently, in September Kali 2017.2 was released.
Why not get a new iso and launch a new VM in Virtual Box.
If everything is fine then your other image has probably forten some updates that are not stable. -
hiddenknight821 Member Posts: 1,209 ■■■■■■□□□□What does the output of 'timedatectl status' command give you? I'd expect "Network time on" and "NTP synchronized" to be yes.
-
tedjames Member Posts: 1,182 ■■■■■■■■□□Running "timedatectl status" yields the following result:
Local time: Sun 2017-11-26 22:06:24 CST
Universal time: Mon 2017-11-27 04:06:24 UTC
RTC time: Tue 2017-11-21 07:39:59
Time zone: America/Chicago (CST, -0600)
System clock synchronized: no
systemd-timesyncd.service active: no
RTC in local TZ: no
I am running 2016.2 64-bit. Maybe I'll try installing 2017.2 on another machine and see what happens. It could be that something I did messed with the time. Just seems odd. -
hiddenknight821 Member Posts: 1,209 ■■■■■■□□□□Ok. Try running 'systemctl enable systemd-timesyncd' then 'systemctl restart systemd-timesyncd'. I hope you get both lines to become yes this time. I don't have a Kali distro to test this right now.
EDIT: I just realized the two lines I mentioned didn't show up in your output. In your case, the line 'System clock synchronized:' and 'systemd-timesyncd.service active:' should be yes. -
TeKniques Member Posts: 1,262 ■■■■□□□□□□Maybe the issue is with the time sync between Virtualbox and the VM? Reinstall the guest addition tools in Kali?
-
tedjames Member Posts: 1,182 ■■■■■■■■□□Thanks for the suggestions. I'll try these tonight after work.
-
tedjames Member Posts: 1,182 ■■■■■■■■□□hiddenknight821 wrote: »Ok. Try running 'systemctl enable systemd-timesyncd' then 'systemctl restart systemd-timesyncd'. I hope you get both lines to become yes this time. I don't have a Kali distro to test this right now.
EDIT: I just realized the two lines I mentioned didn't show up in your output. In your case, the line 'System clock synchronized:' and 'systemd-timesyncd.service active:' should be yes.
Here's the latest:
# systemctl enable systemd-timesyncd
Created symlink /etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service → /lib/systemd/system/systemd-timesyncd.service.
# systemctl restart systemd-timesyncd
# timedatectl status
Local time: Mon 2017-11-27 17:55:24 CST
Universal time: Mon 2017-11-27 23:55:24 UTC
RTC time: Tue 2017-11-21 08:46:26
Time zone: America/Chicago (CST, -0600)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no
Looks like those two lines now say yes. My time is correct again. I'll keep an eye on it and see what it looks like in a few hours.
Thanks for the help! I'll be saving these commands for future reference. And if I ever finish eJPT, I plan to take some Linux training... -
hiddenknight821 Member Posts: 1,209 ■■■■■■□□□□No problem! I figured it's probably one of the tools on Kali that you used that probably disabled all services, including the timesyncd service required to keep your time in sync. So when you put your computer to sleep or whatever, the VM will resume off from the time that was set before it went to sleep unlike the physical machines. A Windows VM would've done the same thing if you disable synchronization with the time servers.