-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time inside VM goes out of sync #3218
Comments
I also have this issue, every time the host suspends. I thought the right thing to do was to install the qemu-guest-agent, but I cannot get that to work, as /dev/virtio-ports/org.qemu.guest_agent.0 doesn't exist. |
@mdillavou for UTM VMs with "Full Graphics" display mode (default) you need to use SPICE guest agent instead of the QEMU guest agent. ( When running VMs through (non-SPICE) QEMU, it looks like the QEMU guest agent uses a serial port interface. QEMU wiki contains very similar looking arguments to enable the guest agent serial port like the ones in use by UTM for the SPICE agent (note that UTM uses QMP to communicate with running VMs). I am confused if these are compatible or even if they can be used at the same time. I wanted to try this, so I pasted these lines to the QEMU tab of the UTM VM configuration UI: -chardev qga_proxy,id=qga0
-device virtio-serial
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 Results in an error message when I attempt to start the VM:
I am out of my depth here, but I guess the QEMU included with UTM is built without the guest agent included. |
As far as I know, SPICE only deals with the display and clipboard, not time. For the guest agent, I configured mine with the following:
My VM started up fine, and I was able to successfully start the guest agent, as the |
@mdillavou If you install
Although this works, why not just run ntp in the guest (either manually or by restarting the ntp service)? Technically all the additional QEMU arguments do is make a virtio serial port. It's just that it matches the name the |
Interesting. That does work, but does UTM/qemu not come with an application to run on the host to connect to the socket and run those commands as appropriate? I suppose I could script something to manually connect an run every time my laptop wakes up. I do use NTP in my guest. The problem is that:
In my guest, I have a hot key to force the time to reset, but it'd be nice to not have to. |
I'm thinking of adding (with a config toggle) a virtio serial port with
and use What do you think of in the Edit: Might be a while before I get this done since I need to figure out how UTM handles JSON and extend it for QEMU guest agent. |
Any updates on this? Any successful workarounds? |
I've taken some time to write a proper Swift program that sets the guest time when the host wakes. Here's the instructions on how to use it: Steps before launching the VM
Steps inside the VM
Steps on the Host Mac
|
Thanks! I added a cron job to start this up on boot and it works great. |
If you're talking about starting up the Guest Agent inside the VM, it might be better to just use the init system service and enable it to run at boot. |
Ah, no, I mean that swift script on the host. |
In that case you might want to create a workflow that runs the script to the background, and add that to your Startup Applications? |
Any reason why that would be better than a cron task? |
Not really. If your current solution is working fine then just keep using it. |
Is there a solution/workaround for a MacOS guest? I'm running Monterey and have seen the clock go out of sync. |
For macOS guest I've used ChronyControl and then set
Since it can get wildly out of step. This may cause excess jumps, so it doesn't stop the problem, but it's a workaround. |
this seemed to resolve it for me I didn't use the container over the weekend and it was three days behind. https://forums.macrumors.com/threads/time-synchronization-command-line-in-macos-big-sur.2279396/ |
Just a reminder for @osy to look into providing guest IP address using QEMU guest agent as well. |
I think this may go into v4.2 instead as v4.1 is already getting late... |
No problem, don't rush yourself. Would you like this to be in a separate issue then? Or do you want to track guest agent implementation in only one placee? |
Let's just keep this here for now. |
Thanks for this workaround! |
Automatically set guest time on GA connect and VM resume. Resolves #3218
Hello, I came across this issue while trying to sync time in my VM. I found with UTM 4.2.5 I'm able to force a time sync in the guest VM by restarting
I took this clue from d0d3b1b. My issue though, is that when I close my Macbook to place my host to sleep at May I request that additional hooks be added into UTM to call Please also let me know if you'd like me to file a new issue. Thanks! Edit: I see #5252 has been filed for this follow-up issue. Will follow there, thanks! |
Describe the issue
When running VMs in the background over a long period of time, the time inside the VM goes out of sync after not using the VM for some time. This happens in all VMs regardless of the guest operating system.
Configuration
The text was updated successfully, but these errors were encountered: