No DNS Resolution in development vm (vagrant, parallels, multisite, landrush)

Hey,

I am having problems getting setup after moving from an Intel to Apple Silicon Mac. I followed the guide here: Trellis: Vagrant | Roots Documentation

DNS resolution in the VM is broken after landrush has added the resolvers for the sites of our multisite instance. This becomes apparent in the next step (Installing NFS client) as the domains of the package repos can’t be resolved.

Editing /etc/resolv.conf manually and adding 8.8.8.8 or similar works, but that obviously is not an acceptable solution to the problem.

trellis 1.13.0
macOS 12.4
Parallels Pro Version 17.1.2 (51548)
Vagrant 2.2.18 (downgraded from 2.2.19)
landrush-ip 0.2.7

@conrad also mentioned problems in this thread

Curious if anybody has a multisite instance up and running with a similar setup.

Cheers
Philipp

Are you sure it’s landrush-ip version 0.2.7?
I have exact same setup and it’s working for me with a multisite?

Is the main domain working and can you access the admin?

Yup

➜  trellis git:(master) ✗ vagrant plugin install landrush  
Installing the 'landrush' plugin. This can take a few minutes...
Fetching filelock-1.1.1.gem
Fetching landrush-ip-0.2.7.gem
Fetching eventmachine-1.0.9.1.gem
Building native extensions. This could take a while...
Fetching rubydns-0.8.5.gem
Fetching win32-process-0.10.0.gem
Fetching landrush-1.3.2.gem
Installed the plugin 'landrush (1.3.2)'!

Just set everything up and I can confirm, that I can access all sites of the instance normally, when editing resolv.conf while vagrant is starting up. It has to happen after landrush is doing its thing and just in time for vagrant to install nfs client.

Otherwise the following happens:

[landrush] Host DNS resolver config for TLD 'wp-test.test.local.XXXXXXX.dev' looks good.
==> default: Installing NFS client...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

apt-get -yqq update
apt-get -yqq install nfs-common portmap
exit $?


Stdout from the command:



Stderr from the command:

W: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/dists/focal/InRelease  Temporary failure resolving 'us.ports.ubuntu.com'
W: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/dists/focal-updates/InRelease  Temporary failure resolving 'us.ports.ubuntu.com'
W: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/dists/focal-backports/InRelease  Temporary failure resolving 'us.ports.ubuntu.com'
W: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/dists/focal-security/InRelease  Temporary failure resolving 'us.ports.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
E: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/pool/main/libt/libtirpc/libtirpc-common_1.2.5-1_all.deb  Temporary failure resolving 'us.ports.ubuntu.com'
E: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/pool/main/libt/libtirpc/libtirpc3_1.2.5-1_arm64.deb  Temporary failure resolving 'us.ports.ubuntu.com'
E: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/pool/main/r/rpcbind/rpcbind_1.2.5-8_arm64.deb  Temporary failure resolving 'us.ports.ubuntu.com'
E: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/pool/main/k/keyutils/keyutils_1.6-6ubuntu1_arm64.deb  Temporary failure resolving 'us.ports.ubuntu.com'
E: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/pool/main/libn/libnfsidmap/libnfsidmap2_0.25-5.1ubuntu1_arm64.deb  Temporary failure resolving 'us.ports.ubuntu.com'
E: Failed to fetch http://us.ports.ubuntu.com/ubuntu-ports/pool/main/n/nfs-utils/nfs-common_1.3.4-2.5ubuntu3.4_arm64.deb  Temporary failure resolving 'us.ports.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?


You shouldn’t have to manually edit any file at all?
When I run trellis up in my multisite project, my output looks like this:

==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Automatic installation for Landrush IP not enabled
==> default: [landrush] Using eth1 (192.168.50.5)
==> default: [landrush] Adding 'mydomain.test => 192.168.50.5' to /Users/username/.vagrant.d/data/landrush/hosts.json
    default: [landrush] starting DNS server: '/opt/vagrant/embedded/bin/ruby /Users/username/.vagrant.d/gems/2.7.4/gems/landrush-1.3.2/lib/landrush/start_server.rb 10053 /Users/username/.vagrant.d/data/landrush /Users/username/.vagrant.d/gems/2.7.4/gems'
==> default: [landrush] Using eth1 (192.168.50.5)
[landrush] Host DNS resolver config for TLD 'mydomain.test' looks good.

My hosts.json then contains the following:

{
  "sub.mydomain.test": "192.168.50.5",
  "mydomain.test": "192.168.50.5",
  "5.50.168.192.in-addr.arpa": "mydomain.test"
}

My /etc/resolve.conf doesn’t contain anything Trellis related at all?

search home
nameserver 62.179.104.196
nameserver 213.46.228.196

On trellis down the output is:

==> default: [landrush] Removing machine entry: mydomain.test

And my hosts.json then only contains the following:

{
  "sub.mydomain.test": "192.168.50.5"
}

The only differences are that i’m still on MacOS 12.3.1 and have a slightly older Trellis version 1.9.1 in this project?

Seems more like a NFS issue with the MacOS beta 12.4 maybe or literarily a:
Temporary failure resolving 'us.ports.ubuntu.com'

I can recall I had to manually add my /sbin/nfsd file to the Security & Privacy > Full Disk Access panel.

1 Like

I’ve hit this issue on monetery and so has a colleague. But after restarting the host machine this got resolved… hate to be that guy but have you tried restarting? I’ve found it’s more likely to happen when changing internet connections, or when being assigned an IPV6 address.

Ideally yes :slight_smile: , but without it will fail altogether since us.ports.ubuntu.com can’t be resolved. This IS the main issue, I agree, but it seems to be tied to landrush somehow, since it is only broken after the landrush setup. (tried sshing in before the landrush commands were run and was able to ping google.com)

The resolv.conf I edited is the one in the VM. I could have made that clearer. (replaced 127.0.0.53 with 8.8.8.8 to be able to pull packages from the internet.)

The output is as follows:

==> default: Machine booted and ready!
==> default: Checking for Parallels Tools installed on the VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Automatic installation for Landrush IP not enabled
==> default: [landrush] Setting up iptables rule on guest for DNS server 127.0.0.53
==> default: [landrush] network: :private_network, {:ip=>"192.168.50.5", :hostsupdater=>"skip", :protocol=>"tcp", :id=>"42d2e973-9ef9-47b8-9405-e440a43d1a1e"}
==> default: [landrush] network: :forwarded_port, {:guest=>22, :host=>2222, :host_ip=>"127.0.0.1", :id=>"ssh", :auto_correct=>true, :protocol=>"tcp"}
==> default: [landrush] Using eth1 (192.168.50.5)
==> default: [landrush] Adding 'XXXXX.local.XXXXX.dev => 192.168.50.5' to /Users/philipp/.vagrant.d/data/landrush/hosts.json
    default: [landrush] starting DNS server: '/opt/vagrant/embedded/bin/ruby /Users/philipp/.vagrant.d/gems/2.7.4/gems/landrush-1.3.2/lib/landrush/start_server.rb 10053 /Users/philipp/.vagrant.d/data/landrush /Users/philipp/.vagrant.d/gems/2.7.4/gems'
==> default: [landrush] Using eth1 (192.168.50.5)
[landrush] Host DNS resolver config for TLD 'XXXXX.local.XXXXX.dev' looks good.
[landrush] Host DNS resolver config for TLD 'XXXXX.local.XXXXX.dev' looks good.
[landrush] Host DNS resolver config for TLD 'XXXXX.local.XXXXX.dev' looks good.
[landrush] Host DNS resolver config for TLD 'XXXXX.local.XXXXX.dev' looks good.
[landrush] Host DNS resolver config for TLD 'XXXXX.local.XXXXX.dev' looks good.
[landrush] Host DNS resolver config for TLD 'XXXXX.local.XXXXX.dev' looks good.
[landrush] Host DNS resolver config for TLD 'XXXXX.local.XXXXX.dev' looks good.
[landrush] Host DNS resolver config for TLD 'XXXXX.local.XXXXX.dev' looks good.
[landrush] Host DNS resolver config for TLD 'XXXXX.local.XXXXX.dev' looks good.
[landrush] Host DNS resolver config for TLD 'wp-test.test.local.XXXXX.dev' looks good.
==> default: Installing NFS client...

The hosts.json also echoes the entries mentioned in the output above. All that seems fine.

The landrush documentation mentions the following and I also tried manually setting an upstream server in the Vagrantfile.

Any DNS queries that do not match any of Landrush’s configuration data, will be passed through to an upstream DNS server. Per default Landrush uses Google’s DNS server with the IP 8.8.8.8.

At least in my case landrush doesn’t seem to process those DNS queries not matched by its config.

Yes, I did that as well and with the nameserver set manually the folders are shared as they should and everything works.

@craigpearson yes :grin:, restarted multiple times and also had the issue before the update to 12.4. Tried different network settings on the host machine as well, but DNS resoution works on the Mac itself as well as a Windows 11 and Ubuntu 20.04.2 ARM64 VM in Parallels with the same Shared Parallels network setting.

I also just destroyed the box and set it up fresh and can confirm the problem persists.

What’s in your ~/vagrant.d/data/landrush/config.json file?
I have the following:

{
  "upstream": [
    [
      "udp",
      "8.8.8.8",
      53
    ],
    [
      "tcp",
      "8.8.8.8",
      53
    ]
  ]
}

It’s the same for me.

Took a while to get my parallels license from work to continue working on this.

Seems like there was an update to the vagrant box and Parallels in the meantime, but other than that everything is unchanged and I am still having the issue. :frowning:

@Twansparant can you confirm you are also using jeffnoxon/ubuntu-20.04-arm64 on an M1 Mac with Parallels Pro edition?

Edit: just tried with bento/ubuntu-20.04-arm64 as well - no difference

Yes I can confirm, I have the exact same setup!

Just recently got an M1 mac and hit these issues last night consistently too. Exact same setup

There’s a reported issue with parallels not sending DNS requests via TCP on the Pro version, and it only working for parallels Business Edition, rel: KB Parallels: Unable to perform DNS requests over TCP in Shared network

It’s definitely an issue with landrush, and/or when vagrant attempts sort NAT (Parallels NAT)

I’m going to reach out to parallels

Hmm, we’re also on the Parallels Desktop for Mac Pro Edition and it seems to be working for us?
Do you have SSL enabled in development?

Thanks for your support @Twansparant appreciate still feeding back when yours is working. SSL is enabled on development, but with this issue the provision or machine setup doesn’t get as far as that.

Although the issue looks to be related to NFS, in fact what is happening is Landrush is spinning up a DNS server, at that point it appears to communicate with vagrant to alter the iptables for the DNS server.

I do note that the difference between your provision and mine and @phenke’s is that you don’t seem to have the iptables part:

Twansparents output:

==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Automatic installation for Landrush IP not enabled
==> default: [landrush] Using eth1 (192.168.50.5)
==> default: [landrush] Adding 'mydomain.test => 192.168.50.5' to /Users/username/.vagrant.d/data/landrush/hosts.json
    default: [landrush] starting DNS server: '/opt/vagrant/embedded/bin/ruby /Users/username/.vagrant.d/gems/2.7.4/gems/landrush-1.3.2/lib/landrush/start_server.rb 10053 /Users/username/.vagrant.d/data/landrush /Users/username/.vagrant.d/gems/2.7.4/gems'
==> default: [landrush] Using eth1 (192.168.50.5)
[landrush] Host DNS resolver config for TLD 'mydomain.test' looks good.

Mine and @phenke’s:

==> default: Checking for Parallels Tools installed on the VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Automatic installation for Landrush IP not enabled
==> default: [landrush] Setting up iptables rule on guest for DNS server 127.0.0.53
==> default: [landrush] network: :private_network, {:ip=>"192.168.50.5", :hostsupdater=>"skip", :protocol=>"tcp", :id=>"42d2e973-9ef9-47b8-9405-e440a43d1a1e"}
==> default: [landrush] network: :forwarded_port, {:guest=>22, :host=>2222, :host_ip=>"127.0.0.1", :id=>"ssh", :auto_correct=>true, :protocol=>"tcp"}
==> default: [landrush] Using eth1 (192.168.50.5)
==> default: [landrush] Adding 'XXXXX.local.XXXXX.dev => 192.168.50.5' to /Users/philipp/.vagrant.d/data/landrush/hosts.json
    default: [landrush] starting DNS server: '/opt/vagrant/embedded/bin/ruby /Users/philipp/.vagrant.d/gems/2.7.4/gems/landrush-1.3.2/lib/landrush/start_server.rb 10053 /Users/philipp/.vagrant.d/data/landrush /Users/philipp/.vagrant.d/gems/2.7.4/gems'
==> default: [landrush] Using eth1 (192.168.50.5)
[landrush] Host DNS resolver config for TLD 'XXXXX.local.XXXXX.dev' looks good.

Would it be possible to see the following @Twansparant just so I can further debug (massively appreciate this):

  • Vagrantfile
  • Development host file /trellis/hosts/development
  • Any appropriate entries in /etc/hosts
  • Your vagrant.default.yml file
  • Settings of your parallels global network config Preferences -> Network
  • Settings of your parallels VM network config Right click on Box in Parallels -> Configure -> Network

Sure thing!
See my gist for these:

  • Vagrantfile
  • Development host file /trellis/hosts/development
  • Any appropriate entries in /etc/hosts
  • Your vagrant.default.yml file



I do remember I had to apply this solution and add my /sbin/nfsd file to the MacOS Security & Privacy - Full Disk Access tab, but I’m not sure if that’s related to this problem?

Curious what you find out!

@Twansparant thank you so much, this is now fixed. In your Vagrantfile you have this addition: DNS resolution Landrush aarch64 · GitHub

Which disables DNS routing on the guest, adding that and now landrush behaves as expected

In terms of adding this change to upstream, I’m not sure if adding the same line on a none parallels configuration would break DNS for virtualbox, so we may need to have a conditional check to see if the current provisioner is parallels before disabling DNS redirecting

I still have a mac with intel so I can test this tonight

@phenke if you add this line to your Vagrantfile, it should fix your issues: DNS resolution Landrush aarch64 · GitHub

@Twansparant can I send you a beer / donate to a charity of your choice?

3 Likes

Dang, I totally forgot about that line :face_with_hand_over_mouth:
Glad it’s fixed for you now!

2 Likes

Many thanks to both of you! :pray:

Works perfectly with the addition of that option.

3 Likes