Setting clock on resumed OpenBSD guest (VMware host)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting clock on resumed OpenBSD guest (VMware host)

Tor Houghton
Hello,

At present I am running a small python script that tails /var/log/messages
and looks for '/bsd: VMware guest resuming from suspended state', executes
'doas rcctl restart ntpd' (with 'ntpd_flags="-s" in /etc/rc.conf.local') so
that the guest's clock gets brought forward.

Are there other (better!) ways of doing this?

Kind regards,

Tor Houghton

Reply | Threaded
Open this post in threaded view
|

Re: Setting clock on resumed OpenBSD guest (VMware host)

Otto Moerbeek
On Thu, Feb 13, 2020 at 09:05:19AM +0100, Tor Houghton wrote:

> Hello,
>
> At present I am running a small python script that tails /var/log/messages
> and looks for '/bsd: VMware guest resuming from suspended state', executes
> 'doas rcctl restart ntpd' (with 'ntpd_flags="-s" in /etc/rc.conf.local') so
> that the guest's clock gets brought forward.
>
> Are there other (better!) ways of doing this?
>
> Kind regards,
>
> Tor Houghton
>

The will no longer work on current, where ntpd will only bump the clock
if securelevel is 0 and the -s flag no longer exists.

You could use rdate, though it is not secure (it will accept any
network input) and in general it is unwise to bump the clock on a
running system. This should be solved in vmd some day I suppose,
assuming the vm *can* determine it is being unsuspended by the host.

It might be better to zzz the vm before telling the host to suspend
it. When resuming the vm kernel will do the right thing.

        -Otto