Conversation
And configure log level to debug when using -v,--verbose. This helps to debug issues in the example tool.
Replace the serial log hack that wrote the VM IP address from cloud-init
runcmd with mDNS-based discovery using avahi. This eliminates the need
for jq in the guest, the fragile serial log parsing, and the
per-driver/arch serial console device map (SERIAL_CONSOLE).
Cloud-init now installs avahi-daemon and sets the hostname to
"{name}-vmnet-helper". The host resolves "{name}-vmnet-helper.local" via
mDNS (macOS mDNSResponder) and waits for SSH to become reachable before
reporting the IP address.
Dashes are used in the hostname instead of dots because avahi strips
everything after the first dot and announces only the short name.
The ip-address file is still written for compatibility with bench and
CI. We will remove it in the next step.
Example first start (mDNS not cached, avahi not yet installed):
% ./example fedora --distro fedora -v
...
[ 0.071] INFO Starting 'vfkit' virtual machine 'fedora' ...
[ 5.077] DEBUG mDNS lookup 'fedora-vmnet-helper.local':
[Errno 8]nodename nor servname provided, or not known
[ 11.082] DEBUG mDNS lookup 'fedora-vmnet-helper.local':
[Errno 8] nodename nor servname provided, or not known
[ 17.038] INFO Virtual machine IP address: 192.168.105.10
Example second start (mDNS cached, avahi already installed):
% ./example fedora --distro fedora -v
...
[ 0.078] INFO Starting 'vfkit' virtual machine 'fedora' ...
[ 1.085] DEBUG Connect 192.168.105.10:22: timed out
[ 3.092] DEBUG Connect 192.168.105.10:22: timed out
[ 5.101] DEBUG Connect 192.168.105.10:22: timed out
[ 7.107] DEBUG Connect 192.168.105.10:22: timed out
[ 8.112] INFO Virtual machine IP address: 192.168.105.10
Co-authored-by: Cursor <cursoragent@cursor.com>
feeed20 to
607ba44
Compare
macOS Local Network Privacy (introduced in Sequoia) blocks access to local network for non-root processes running outside Terminal. On GitHub Actions, the example script runs as a launchd agent, which is denied local network access. Running as root bypasses this restriction. See actions/runner-images#1042 Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace the serial log IP hack with mDNS-based discovery. Cloud-init
installs avahi-daemon, which announces the VM hostname via mDNS. The
host resolves
{name}-vmnet-helper.localand waits for SSH to becomereachable before reporting the IP.
This eliminates jq, serial console device mapping, and fragile log
parsing. Debug logging (
--verbose) shows mDNS and SSH connectionattempts, making boot issues easy to diagnose.
CI
The example runs as root on GitHub Actions to bypass macOS Local Network
Privacy, which blocks mDNS resolution for non-root processes on headless
machines. See actions/runner-images#1042
Testing
Tested with: