churchers / vm-bhyve

Shell based, minimal dependency bhyve manager
BSD 2-Clause "Simplified" License
806 stars 168 forks source link

dnsmasq fails to start up since it is invoked before vm-bhyve #528

Open mzaki-jp opened 8 months ago

mzaki-jp commented 8 months ago

when combined with vm-bhyve, dnsmasq fails to start up when booting from /etc/rc. dmesg shows:

dnsmasq[1732]: failed to create listening socket for 192.168.x.x: Can't assign requested address

This is because rcorder(8) arranges dnsmasq before vm.

In the system's rc.d scripts, "ipfw" and "pf" are required by "netwait", and then by "NETWORKING"; however, vm-bhyve's rc.d script contradicts them since it requires "NETWORKING" before "dnsmasq ipfw pf". I guess this leads to the omission of "vm before dnsmasq"

If I remove the directive requiring "SERVERS" from vm-bhyve's rc.d script, rcorder(8) arranges vm before dnsmasq, and dnsmasq successfully starts up. (although removing "NETWORKING" still fails. only removing "SERVERS" works well. I can't say why.)

So please consider modifying the rc.d script directive. Thanks in advance.

ierturk commented 6 months ago

It seems that the interface is being created as bridge0, then renamed as vm-public after the dnsmasq service is being tried to start

Jan  2 11:12:56 mac-bsd dnsmasq[1583]: unknown interface vm-public
Jan  2 11:12:56 mac-bsd dnsmasq[1583]: FAILED to start up
Jan  2 11:12:56 mac-bsd root[1587]: /etc/rc: WARNING: failed to start dnsmasq
Jan  2 11:12:56 mac-bsd kernel: .
Jan  2 11:12:56 mac-bsd kernel: bridge0: Ethernet address: 58:9c:fc:10:ff:a4
Jan  2 11:12:56 mac-bsd kernel: bridge0: changing name to 'vm-public'
Jan  2 11:12:57 mac-bsd kernel: bastille0: link state changed to UP
omani commented 2 months ago

I had the same issue. fixed it by implementing https://github.com/churchers/vm-bhyve/issues/435#issuecomment-1353550627