valet-linux: Bug: Lost network connection after running valet install
Basic info
| Distro (Name and version) | PHP Version | Valet version |
|---|---|---|
| Ex: Ubuntu 22.04 | 8.1.2 | Latest |
- [x]I’ve checked the issue queue and could not find anything similar to my bug.
- I’m on the latest version of valet-linux (
valet --version):2.2.32 - I’ve run
valet fixandvalet installafter updating and before submitting my issue/feature.
What is the problem?
After running valet install for a few seconds, the network connection is lost (the network icon shows an exclamation mark)
What was supposed to happen? Lost Internet connection
What actually happened? Network icon with exclamation mark and cannot network access
How to reproduce this?
- Install new Ubuntu 22.04
- Install Composer, Install Valet
- Run
valet installand lost internet.
I have reinstalled Ubuntu and tried to install Valet 3 times but still get the same problem
What is the solution? N/A
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 6
- Comments: 28
@datlechin, I had the same problem as the one you described (see my first comment on this issue) and found a solution and I’m going to share the steps with you in the hope that this would help.
TL;DR
echo "nameserver 8.8.8.8" >> /opt/valet-linux/custom-nameservers(I don’t remember if you need to restart something at this point)/etc/default/dnsmasqand add the lineDNSMASQ_EXCEPT=loor un-comment it if you find it (I found it in the last line of the file on a fresh install) and restartdnsmasqThe details I actually went through two major problems :
First problem
Whenever, I installed valet, I lost network access and when I manage to configure my internet connection back, I override
/etc/resolv.confand cannot access my web applications served by Valet.WHY ? (according to my very limited understanding) Because, I need my
resolv.confto check thenameserver 8.8.8.8for my internet connection to work (I don’t know if everybody has this problem or just me) and by using valet’sresolv.confit doesn’t do that by defaultSolution to the first problem
I have to add the line
nameserver 8.8.8.8to some file that will always be checked by valet’sresolv.conffile (which is/op/valet-linux/valet-dns) and that file is/opt/valet-linux/custom-nameserversso adding this line there fixed this issue for meSecond problem
At this point, I was able to access both my network connection and my valet projects at the same time but for some very strange and unknown reason, after minutes of use and/or after each reboot, everything stops working, until I run
valet installand restart my network manager (I described it in more details in my first comment)WHY ? (according to my very limited understanding) There is some bug with
dnsmasqthat is way beyond my understanding (I read about it here and I even got my solution from there)It’s worth mentioning at this point that when I ran
service dnsmasq status, one of the lines I gor wasno servers found in /opt/valet-linux/dns-servers, will retryand that error (or warning) line disappeared after the solution I described belowSolution to the second problem
I have to tell
dnsmasqto not use my local machine as a dns resolver by adding the lineDNSMASQ_EXCEPT=loto the file/etc/default/dnsmasq(lo: the loopback interface) and restart thednsmasqserviceI hope this helps you solve your problem, if so please let me know so that one of us can add it to the docs as a potential solution for a potential problem)
This isn’t fixed as far as i can see. ass mentioned by @Alecaddd there hasn’t been any code changes to stop this from happening, just some work arounds which may or may not work.
Please could this be reopened until there is a merge for the fixes so we can keep up to date.
Kind Regards, Mike
I have the same issue :
My conf now is the following :
valet install(this generates the/opt/valet-linux/resolv.conffile and makes/etc/resolv.confpoint to it)/opt/valet-linux/custom-nameserverswith the linesnameserver 8.8.8.8andnameserver 8.8.4.4inspired by old issues of this repo (that I cannot find right now)The problem :
Every few hours, for an unknown reason (that’s where the fix should happen), valet (or some other process ?!) rewrites the file
/opt/valet-linux/resolv.confto contain only one linenameserver 127.0.0.1(that what causes the loss of Network connection) My temporary fix is to :valet installIt works for a few hours before causing the same problem
I am not sure but I think rebooting also causes the same issue.
I hope this helps identify the root of the problem
I’ll take a look when I find some spare time
Alessandro @.***> schrieb am So., 26. Juni 2022, 18:33:
I have the same problem after upgrading to Ubuntu 22.04. Lost connection. And valet-linux doesn’t serve my sites either. I had to uninstall valet-linux to get internet connection back.