Closed adamo closed 5 months ago
Thanks for opening your first issue here! Be sure to follow the issue template and include your OS/Vagrant/VVV versions! Don't forget you can get support in the VVV slack at https://varyingvagrantvagrants.org/docs/en-US/slack/
I see missingWinAdminPriv
have you tried this from a prompt with elevated admin privileges? As an aside vagrant-hostsupdater
isn't necessary for VVV, unless you're using it on other vagrant projects I'd uninstall it.
You should also be able to replace all of these:
nginx_upstream: php83
With these:
php: 8.3
Thanks for your reply but the problem is still there. Maybe there is a problem with a DNS inside the machine?
When using vagrant ssh i can do ping 8.8.8.8
but ping google.com
fails
hmmm that's possible, I've had that myself but only when using Parallels on Arm, I switched the DNS inside the VM to 8.8.8.8
too and things started working again.
See https://github.com/Varying-Vagrant-Vagrants/VVV/issues/2662 which links to a howto, I also attempted to automate this with https://github.com/Varying-Vagrant-Vagrants/VVV/pull/2701 but didn't have much luck.
I was hoping to set these servers for DNS:
DNS_SERVERS=(
# Quad9
"9.9.9.9"
"149.112.112.112"
"2620:fe::fe"
"2620:fe::9"
# Cloudflare
"1.1.1.1"
"1.0.0.2"
"2606:4700:4700::1112"
"2606:4700:4700::1002"
)
Using google would cause issues in some countries that block those DNS servers, and there are privacy considerations to account for too. Quad9 has a good reputation on those counts and Cloudflare comes in close too
I'm still fighting with this nothing has worked or I'm missing something. I've tried:
/etc/resolv.conf
Im still getting ' Network connection issues found. Unable to reach https://ppa.launchpadcontent.net' when provisioning and Problem: Could not load the site, this implies that provisioning the site failed, please check there were no errors during provisioning, and reprovision.
error.
You shouldn't need to do anything related to VirtualBox or vagrant here to try and diagnose and fix this, all viable debugging steps are general Ubuntu steps you can perform via vagrant ssh
and vagrant halt
/vagrant up
.
Also keep in mind no attempt is made to provision sites until after the main provisioner has completed. If it fails then nothing after it will run, after all why provision a site on a VM with no Nginx/PHP/DB? ( Why install the roof on a house that has no walls yet? )
Of note, Ubuntu has tried changing how DNS is handled over several revisions, knowing which version of Ubuntu will help greatly. You also don't need to reprovision to test if your fix worked, it's enough to test it from the command line inside the VM. Reprovisioning is just the most exensive/time consuming way to do it.
It's also highly unlikely you can fix this from the vagrant/Windows side, all clues point to a Linux based solution
changing the ip address in /etc/resolv.conf
If I remember right this is a generated file, by turning off the VM and turning it back on as part of a provision you've probably erased your DNS changes.
changing the file step 3 (Method 2: The not-so-easy way) from https://learnubuntu.com/change-dns-server/
This article backsup the temporary part of the above.
Take a look at Netplan. My next step with that PR was to figure out a netplan YAML file to drop in to add the DNS servers. Modifying an existing netplan YAML file in the VM and applying it should also work.
You definitely don't need to install resolvectl etc, it should all be doable with what's already there.
There is a chance your VM has a much older Ubuntu version that doesn't use this system though.
I've went to Virtualbox forum https://forums.virtualbox.org/viewtopic.php?t=94277
Those are all Windows errors and Windows error logs, totally unrelated to what you're dealing with. If you had the issues that thread is talking about then the provisioners would never have started in the first place and you'd be seeing vagrant errors not provisioner errors.
reinstalled vagrant, VB again - removed, added network interfaces
This rarely fixes problems and usually causes new ones! Unless you're seeing a VirtualBox or Vagrant error don't touch these!
turned the firewall off
If the host WIndows OS also had this issue then that might have been the cause, you should turn it back on.
Im still getting ' Network connection issues found. Unable to reach https://ppa.launchpadcontent.net/' when provisioning
The provisioner network checks are there to check if it's safe to continue and help diagnose issues. Some people can provision even when these checks fail and had to disable them manually, we do not know why.
These should be treated as informational and not as an error. Most people who encounter this do so because they didn't bother to reboot their machine after updating/installing VirtualBox. The problem you're facing is actually further down in the apt-get update
step where it can't resolve the hosts for packages.
Wow. Thank you'r response and the effort you put in it. It helped me immensely the problem as you'd pointed out is in the distro and "Of note, Ubuntu has tried changing how DNS is handled over several revisions, knowing which version of Ubuntu will help greatly." I have Ubuntu 20.04 LTS
I've followed this advice then did sudo ap-get update
the update that failed previously worked.
The provision has the same problems so i guess it resets the name servers to previous values - how do I make them permament?
The latter echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
is probably what you want but I can't confirm if that's the case
The latter
echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
is probably what you want but I can't confirm if that's the case
Yes this worked inside ssh but after provision it resets the DNS and the error is still there. Where can I add this line in the provision script?
Where can I add this line in the provision script?
You don't, that's not how this is supposed to work. If Linux was your main operating system you wouldn't want to re-apply a temporary fix everytime you turned the machine on, or modify a Linux OS installer to do it for you.
Test it via vagrant ssh
and ignore the provisioning and see if it does indeed get stripped. I've managed to do this in the past and it required no changes to VVV once done in an SSH session inside the VM, the difficulties came when trying to add it to the provisioners so I didn't have to figure it out everytime I destroyed the VM and created a new one for testing. That's what the PR I linked to was attempting to do, and why I was digging through Netplan configs ( and modifying a netplan config is probably what you need to do too )
Look at https://linuxize.com/post/how-to-set-dns-nameservers-on-ubuntu-18-04/#setting-dns-nameservers-on-ubuntu-server it has a Netplan example that might help, my PR tried to modify those nameservers but I assumed they existed and they did not.
The PR could be modified to use shyaml
to add those but if DNS isn't working then we can't install shyaml
in order to fix it so it has to be done without any shyaml
/PHP using tools only available in stock Ubuntu
Thanks. OK. Trying those solutions right now with no luck. It seems DNS settings are really messed up right nowin ubuntu.
what file did you modify in Netplan? Do you have a copy of it?
I modified each in the directory - don't have the ability to get it now but I've added this to each one
nameservers:
addresses: [1.1.1.1, 1.0.0.1]
and then sudo netplan apply
this systemd-resolve --status | grep 'DNS Servers' -A2
didn't work
the indentation matters, if there is no indentation on the nameservers section then it won't work
This is how it looks
/etc/netplan/50-vagrant.yaml
/etc/netplan/00-installer-config.yaml
Can you add it to the 00-installer-config.yaml
too under eth1
?
you can also copy into /srv/www
if you want to modify it with a native editor and copy back, just be careful with line endings
I've contacted a friend whos a ubuntu expert heres what he did:
/etc/hosts
file weight /etc/hosts.old
/etc/hosts
for ubuntu It works.
Thank you @tomjn for all the help.
Hmm do you know what the contents were? That’s worrying but if it’s full of site host names it would explain why and suggest a fix
On Thu, 13 Jun 2024 at 11:38, Adam @.***> wrote:
I've contacted a friend whos a ubuntu expert heres what he did:
- checked /etc/hosts file weight
- it was 90 mb (much too much)
- copied /etc/hosts.old
- pased in a template of /etc/hosts for ubuntu https://gist.github.com/ghoneycutt/e531984406b4b86ace687ea8958a6dc3
- restart
It works.
Thank you @tomjn https://github.com/tomjn for all the help.
— Reply to this email directly, view it on GitHub https://github.com/Varying-Vagrant-Vagrants/VVV/issues/2707#issuecomment-2165274553, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOLZZST4U7O6NPKVLBYBTZHFZBVAVCNFSM6AAAAABJEMXITCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRVGI3TINJVGM . You are receiving this because you were mentioned.Message ID: @.***>
Ah it's as I thought, every provision adds the hosts of VVV to the local file so that local loopback works, but it doesn't cleanup or check if it's already there.
So there are 2 places that add site host names, one adds them with #vvv-auto on the end, and this function is meant to clear them out:
This one adds them and checks if they're already present:
and in the vagrant up trigger it updates the hosts without checking first in vvv_update_guest_hosts
, so lots of vagrant up/halt would extend the hosts file over time
I've created a PR here:
https://github.com/Varying-Vagrant-Vagrants/VVV/pull/2708
It might help prevent or reduce this from happening, can you take a look?
I suspect this code isn't cleaning up the hosts file but might be appending it:
Does anything jump out at you as obvious?
also found in my notes: https://github.com/derekbit/kube-virtdeploy/blob/master/scripts/fix.generic-ubuntu-dns.sh
@adamo can you test the PR at https://github.com/Varying-Vagrant-Vagrants/VVV/pull/2708? From what I understand cleaning your hosts file manually was a temporary fix, this should solve the problem and auto-cleanup the hosts file automatically
Closing this now that #2708 is merged
Sorry for the delay but you're working with a speed of light and I had family thins to attend to - if this helps you I'll check it today.
@adamo no rush, the changes made it into the v3.13.1 release so there's no urgency. Confirm when you're free and give me a ping if the host file starts growing or DNS becomes weird again
I've applied the updated, and will keep you posted if something comes up.
What was The Command Used To Provision
What Kind of VVV Provision Was This
This was a reprovision of an already working VVV
Logs/What Broke
I've tried to add a new site and provision but got errors connecting to hosts.
Steps to Reproduce (for bugs)
1. 2. 3. 4.
Your Environment
Operating System: Windows
\ V\ V\ V / v3.13 Ruby:3.1.4, Path:"C:/strony/sites" _/_/_/ git::develop(c4250187)
Platform: mingw32 windows missingWinAdminPriv vagrant-hostsupdater vagrant-goodhosts vagrant-vbguest monochrome-terminal shared_db_folder_disabled Vagrant: v2.4.1, virtualbox: v7.0.18