Skip to content

machine: add vfkit timesync device for Apple VMs#28527

Open
vyasgun wants to merge 2 commits intocontainers:mainfrom
vyasgun:pr/krunkit-timesync
Open

machine: add vfkit timesync device for Apple VMs#28527
vyasgun wants to merge 2 commits intocontainers:mainfrom
vyasgun:pr/krunkit-timesync

Conversation

@vyasgun
Copy link
Copy Markdown
Member

@vyasgun vyasgun commented Apr 16, 2026

Checklist

Ensure you have completed the following checklist for your pull request to be reviewed:

  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all
    commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. See CONTRIBUTING.md
    for more information.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)
  • Tests have been added/updated (or no tests are needed)
  • Documentation has been updated (or no documentation changes are needed)
  • All commits pass make validatepr (format/lint checks)
  • Release note entered in the section below (or None if no user-facing changes)

Does this PR introduce a user-facing change?

Related PR: containers/podman-machine-os#175

None

Fixes: containers#28345

Signed-off-by: Gunjan Vyas <vyasgun20@gmail.com>
@vyasgun vyasgun force-pushed the pr/krunkit-timesync branch from 8726ab7 to 8a97ed3 Compare April 16, 2026 15:32
@TomSweeneyRedHat
Copy link
Copy Markdown
Member

TomSweeneyRedHat commented Apr 17, 2026

@vyasgun thanks for the PR! Our CI is barking as there's no test to go along with the change. Would that be possible to add?

Otherwise, LGTM

Comment thread pkg/machine/apple/apple.go Outdated
}
vm.Devices = append(vm.Devices, mounts...)

timesync, err := vfConfig.TimeSyncNew(1234)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please consider using a named constant for the port

@mheon
Copy link
Copy Markdown
Member

mheon commented Apr 20, 2026

I dunno if testing for this one is particularly reasonable - hard to validate proper date/time stuff in my experience. I'm going to add No New Tests.

@mheon mheon added the No New Tests Allow PR to proceed without adding regression tests label Apr 20, 2026
@l0rd
Copy link
Copy Markdown
Member

l0rd commented Apr 21, 2026

@vyasgun machine e2e tests are failing on macOS with libkrun. You can try to reproduce the problem locally using make localmachine (see the doc).

@Honny1
Copy link
Copy Markdown
Member

Honny1 commented Apr 29, 2026

I started with the takeover of the podman-machine-os PR. And I think it would be good to add this for QEMU, to benefit from this on linux.

@vyasgun, can you do updates, or can I take over this PR too? I think it would be good to finish this to get this into Podman 6.1.

@vyasgun
Copy link
Copy Markdown
Member Author

vyasgun commented May 4, 2026

@l0rd I suspect the e2e failures on CI are from an older krunkit (need v1.2.0+ or so). I can’t see which version CI uses from the CI logs. Locally everything passes:

Ran 73 of 80 Specs in 792.949 seconds
SUCCESS! -- 73 Passed | 0 Failed | 0 Pending | 7 Skipped

I updated contrib/cirrus/mac_env.sh to print krunkit --version. Those prints don’t show up in the HTML log though - where can I look for them?

@vyasgun
Copy link
Copy Markdown
Member Author

vyasgun commented May 4, 2026

@Honny1 I have updated this PR with the suggested changes

@l0rd
Copy link
Copy Markdown
Member

l0rd commented May 4, 2026

@vyasgun CI is failing at code validation, and the machine tests aren't executed. To avoid that, you can use make validatepr before pushing.

… version

Signed-off-by: Gunjan Vyas <vyasgun20@gmail.com>
@vyasgun vyasgun force-pushed the pr/krunkit-timesync branch from dd54fd3 to 4e3b715 Compare May 5, 2026 17:17
@mheon
Copy link
Copy Markdown
Member

mheon commented May 5, 2026

I think the failures are flakes? Restarted the bunch.

@l0rd
Copy link
Copy Markdown
Member

l0rd commented May 6, 2026

@vyasgun your suspect was correct: the krunkit version installed in the VMs that run the CI is 1.1.1 (last line of this file). I know that linux/windows images are defined here but I am not sure about macOS ones. @Luap99 @ashley-cui @timcoding1988 should know. I am afraid we won't be able to merge this PR before updating the VM image.

@Luap99
Copy link
Copy Markdown
Member

Luap99 commented May 6, 2026

The macos worker pool uses brew to install the runtime deps
https://github.com/containers/automation/blob/7081019797582cb07158f1e2249bd224cfb10090/mac_pw_pool/setup.sh#L86-L109

IF the update is not in brew we will not consume it

@Luap99
Copy link
Copy Markdown
Member

Luap99 commented May 6, 2026

Overall this looks like something we need some basic tests? The fact that this passes with the machine-os change seems concerning, we need some way to confirm the socket is actually active and can be used to talk to the host hypertvisor otherwise how do we ever catch regressions in qemu/kruntkit/vfkit or our own code around this...

Honny1 added a commit to Honny1/podman-machine-os that referenced this pull request May 6, 2026
Install qemu-guest-agent and configure it to listen on vsock port 1234
(matching the constant in containers/podman). The service is gated by a
DMI sys_vendor check (ExecCondition) so it only runs on Podman machine
providers that expose the vsock channel: vfkit (Apple Inc.), libkrun
(Libkrun), and qemu (QEMU). A custom SELinux module allows
virt_qemu_ga_t to use vsock sockets.

Related PR: containers/podman#28527
Replace: containers#175

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
Copy link
Copy Markdown
Member

@Honny1 Honny1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also wire an explicit qemu-ga vsock unix socket (e.g. <name>-qemu-ga.sock) in addition to --timesync? That would give us a concrete host endpoint to test and debug, and helps prevent regressions around guest-agent connectivity.

const applehvMACAddress = "5a:94:ef:e4:0c:ee"
const (
applehvMACAddress = "5a:94:ef:e4:0c:ee"
timeSyncVsockPort = 1234
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be shared in pkg/machine/define.

Honny1 added a commit to Honny1/podman-machine-os that referenced this pull request May 6, 2026
Install qemu-guest-agent and configure it to listen on vsock port 1234
(matching the constant in containers/podman). The service is gated by a
DMI sys_vendor check (ExecCondition) so it only runs on Podman machine
providers that expose the vsock channel: vfkit (Apple Inc.), libkrun
(Libkrun), and qemu (QEMU). A custom SELinux module allows
virt_qemu_ga_t to use vsock sockets.

Related PR: containers/podman#28527
Replace: containers#175

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
Honny1 added a commit to Honny1/podman-machine-os that referenced this pull request May 6, 2026
Install qemu-guest-agent and configure it to listen on vsock port 1234
(matching the constant in containers/podman). The service is gated by a
DMI sys_vendor check (ExecCondition) so it only runs on Podman machine
providers that expose the vsock channel: vfkit (Apple Inc.), libkrun
(Libkrun), and qemu (QEMU). A custom SELinux module allows
virt_qemu_ga_t to use vsock sockets.

Related PR: containers/podman#28527
Replace: containers#175

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
@Honny1
Copy link
Copy Markdown
Member

Honny1 commented May 6, 2026

Anyway, I tested that with an image from containers/podman-machine-os#238. And the time is correctly synchronized.

Honny1 added a commit to Honny1/podman-machine-os that referenced this pull request May 6, 2026
Install qemu-guest-agent and configure it to listen on vsock port 1234
(matching the constant in containers/podman). The service is gated by a
DMI sys_vendor check (ExecCondition) so it only runs on Podman machine
providers that expose the vsock channel: vfkit (Apple Inc.), libkrun
(Libkrun), and qemu (QEMU). A custom SELinux module allows
virt_qemu_ga_t to use vsock sockets.

Related PR: containers/podman#28527
Replace: containers#175

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
@cfergeau
Copy link
Copy Markdown
Contributor

cfergeau commented May 6, 2026

The macos worker pool uses brew to install the runtime deps https://github.com/containers/automation/blob/7081019797582cb07158f1e2249bd224cfb10090/mac_pw_pool/setup.sh#L86-L109

IF the update is not in brew we will not consume it

Looks like the brew "repo" for krunkit changed, slp/krunkit is not up to date, but https://github.com/slp/homebrew-krun (aka slp/krun) has 1.2.1.

@cfergeau
Copy link
Copy Markdown
Contributor

cfergeau commented May 6, 2026

The macos worker pool uses brew to install the runtime deps https://github.com/containers/automation/blob/7081019797582cb07158f1e2249bd224cfb10090/mac_pw_pool/setup.sh#L86-L109
IF the update is not in brew we will not consume it

Looks like the brew "repo" for krunkit changed, slp/krunkit is not up to date, but https://github.com/slp/homebrew-krun (aka slp/krun) has 1.2.1.

And cfergeau/crc should no longer be needed (and is no longer updated), vfkit is in the main homebrew repo.

Honny1 added a commit to Honny1/podman-machine-os that referenced this pull request May 6, 2026
Install qemu-guest-agent and configure it to listen on vsock port 1234
(matching the constant in containers/podman). The service is gated by a
DMI sys_vendor check (ExecCondition) so it only runs on Podman machine
providers that expose the vsock channel: vfkit (Apple Inc.), libkrun
(Libkrun), and qemu (QEMU). A custom SELinux module allows
virt_qemu_ga_t to use vsock sockets.

Related PR: containers/podman#28527
Replace: containers#175

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

machine No New Tests Allow PR to proceed without adding regression tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants