Bhyve, my VM is booting with the wrong date.

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
My time is correct on my NAS, but when I boot my VM, I'm checking logs and it's telling me it's booting on the 18'th of July until it hits the NTP server.
(it is then set correctly after that point)


Bear in mind, I'm in Aus, I'm only 2 hours behind, the earliest time zone possible (NZ) it's not the 18'th anywhere on earth yet?
Any idea how I fix this? the syslog for the VM is eventually correcting once it talks to an NTP server.

What could cause this? It's not the end of the world but I imagine some more professional deployments might be annoyed.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Provided that your NAS host has got the correct time and date, set your VM's system clock to "UTC" for any Unix-like guest (Linux, FreeBSD), and to "Local" for Windows.

Bildschirmfoto 2021-07-17 um 14.32.22.png
 

diskdiddler

Wizard
Joined
Jul 9, 2014
Messages
2,377
Thank you! Must take not to turn the VM fully OFF for it to work, then it fixed it up.
Wonder why it's not default but no worry.
 

Gcon

Explorer
Joined
Aug 1, 2015
Messages
59
Thank you! Must take not to turn the VM fully OFF for it to work, then it fixed it up.
Wonder why it's not default but no worry.
Yes it's very strange that you can choose Windows, Linux and FreeBSD as the guest operating system, but doesn't change the system clock to UTC for the Linux and FreeBSD options. It should really do that.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
If you do touch /etc/wall_cmos_clock inside a FreeBSD guest, it will work with the clock set to local time. Maybe you want that, because all your FreeBSD machines run that way? Sometimes it really boils down to the admin knowing what they are doing.
 

Gcon

Explorer
Joined
Aug 1, 2015
Messages
59
If you do touch /etc/wall_cmos_clock inside a FreeBSD guest, it will work with the clock set to local time.

Interesting. I only have Ubuntu VMs in TrueNAS currently, and UTC clock and setting timezone works well for my uses.

Code:
root@nakivovm:~# timedatectl set-timezone Australia/Sydney
root@nakivovm:~# timedatectl
                      Local time: Tue 2021-08-10 01:01:02 AEST
                  Universal time: Mon 2021-08-09 15:01:02 UTC
                        RTC time: Mon 2021-08-09 15:01:01
                       Time zone: Australia/Sydney (AEST, +1000)
       System clock synchronized: yes
systemd-timesyncd.service active: yes
                 RTC in local TZ: no
root@nakivovm:~# date
Tue Aug 10 01:01:14 AEST 2021


All looking good with the time and date there (and time for bed :).
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
I only have Ubuntu VMs in TrueNAS currently, and UTC clock and setting timezone works well for my uses.
It works the same way in FreeBSD if you prefer. You just have the choice. E.g. if you are dual booting a desktop or notebook with FreeBSD and Windows, you want your CMOS clock set to local time.
 
Top