cirruslabs / tart

macOS and Linux VMs on Apple Silicon to use in CI and other automations
https://tart.run
Other
3.76k stars 106 forks source link

Router and DNS not set in Network settings #657

Closed simonbs closed 9 months ago

simonbs commented 9 months ago

After performing the upgrades as outlined in the table below, I'm seeing an issue where 9/10 times my virtual machines will fail to configure the networking settings correctly. The values for DNS and router are missing.

Upgrade From Upgrade To
Host Machine macOS Ventura macOS Sonoma 14.1.1
Virtual Machine macOS Ventura 14.0 macOS Sonoma 14.1.1
tart Unknown, but likely 1.21.1 2.3.0

The images below compares how the networking settings are expected to look and how they often end up when the virtual machine is booted.

Expected Actual (Often, at least)
good bad

In the case where the network settings are incorrect, the virtual machine is unable to make any network calls.

Have anyone seen anything similar or have an idea as to what might be causing this? These virtual machines have been running fine for months but we only started seeing this issue within the past 24 hours after upgrading the software.

edigaryev commented 9 months ago

Hello Simon,

  1. Does this behavior persists after the guest machine reboots?

  2. Are you passing any additional command-line variables to tart run <VM_NAME>?

simonbs commented 9 months ago

@edigaryev Thanks for your quick reply.

The problem persists even when rebooting the virtual machine and the host machine. It only happens sometimes when booting the virtual machine but it seems to happen most of the times. I have a suspicion that it also happens more often when running two virtual machines in parallel but I have been unable to confirm this.

I'm doing tart run <VM_NAME> --dir=<DIR>.

edigaryev commented 9 months ago

I've just looked at the screenshot one more and realized that it's not just the router address that is missing, your VM is not getting any address from the DHCP server at all. Instead, it's self-assigning a link-local address.

We've seen this behavior before, when the macOS DHCP server exhausts it's IP address pool.

You can try to tweak the default DHCP lease time and if that doesn't help, move/remove the /var/db/dhcpd_leases file and boot the VM again to see if that helps.

simonbs commented 9 months ago

@edigaryev We had quite a lot of leases in /var/db/dhcpd_leases and recently had quite a few reboots of our virtual machines over a short period of time so this sounds very plausible.

I have removed the /var/db/dhcpd_leases file and decreased our DHCP lease time to two hours. This seems to have fixed the issue for now.

Thank you so much for your prompt reply. You're a lifesaver! ❤️