I am getting this strange thing on my Ubuntu 12.04 64-bit machine when I do a wget
$ wget google.com
--2014-07-18 14:44:32-- http://google.com/
Resolving http (http)... failed: Name or service not known.
wget: unable to resolve host address `http'
I have encountered this problem earlier when I got it for any web pages (and not http), which required me to add my nameserver to /etc/resolv.conf.
However, here that doesn't seem to be the problem, instead it is recognizing http as something different. Any advise?
The DNS server seems out of order. You can use another DNS server such as 8.8.8.8. Put nameserver 8.8.8.8 to the first line of /etc/resolv.conf.
remove the http or https from wget https:github.com/facebook/facebook-php-sdk/archive/master.zip . this worked fine for me.
I have this issue too. I suspect there is an issue with DigitalOcean’s nameservers, so this will likely affect a lot of other people too.
Here’s what I’ve done to temporarily get around it - but someone else might be able to advise on a better long-term fix:
Make sure your DNS Resolver config file is writable:
sudo chmod o+r /etc/resolv.conf
Temporarily change your DNS to use Google’s nameservers instead of DigitalOcean’s:
sudo nano /etc/resolv.conf
Change the IP address in the file to: 8.8.8.8
Press CTRL + X to save the file.
This is only a temporary fix as this file is automatically written/updated by the server, however, I’ve not yet worked out what writes to it so that I can update it permanently.
I figured out what went wrong. In the proxy configuration of my box, an extra http:// got prefixed to "proxy server with http".
Example..
http://http://proxy.mycollege.com
and that has created problems. Corrected that, and it works perfectly.
Thanks #WhiteCoffee and #ChrisBint for your suggestions!
If using Vagrant try reloading your box. This solved my issue.
It might happen because of the overriding of resolv.conf, This answer helped me, use below every time when you set up a new WSL. sudo chattr +i /etc/resolv.conf - will make the file immutable and won't be overwritten next time you start wsl.
sudo bash -c 'echo -e "[network]
generateResolvConf = false" > /etc/wsl.conf
rm /etc/resolv.conf
echo -e "options timeout:1 attempts:1 rotate
nameserver 1.1.1.1
nameserver 1.0.0.1" > /etc/resolv.conf
chattr -f +i /etc/resolv.conf'
Related
I have pulled into my web server so it has the latest code from my repo, i try to restart nginx - this doesnt do anything.
So I try the command
sudo nginx -s stop, and get the response that its failed because there is no such file or directory "run/nginx.pid" failed.
Trying to run the command ps aux | grep nginx gives me the response: unsupported option (BSD syntax) -- it actually comes out as ps aux > grep nginx in the digital ocean console.
Basically it seems that even though there are apparently no nginx processes running (although the command to check isnt working) my website is still running and using the old code, is there a way for me to check more definitively on the running processes?
Thanks if you can help.
Try sudo netstat -plunt to check if there's any nginx process running. See if there's anything running on port 80 or 443 and then look at the corresponding program name. You might have another server running possibly apache since it ships by default with most distributions which may be why nginx failed to start.
Another reason why it won't start might be due to faulty config. Go to /etc/nginx/ and double check that it's correct. You can also run sudo nginx -t to ensure that the config syntax is correct.
Alternatively, just check your nginx access log to see if it's actually serving any requests. You can also check the error log to see why it might fail to start. These resides in /var/log/nginx by default or check your nginx.conf for any custom path to logs.
Im using Vagrant with Docker and I currently need to reach the host machines dnses from the docker container or even add my custom dns to docker (then i will add my external ip to dns and effect would be the same I think). Is it even possible? I tried to mount /etc directory via config.yml as below
#directory map
docker_map:
- "/etc:/etc"
and input expecting dns in mounted /etc/hosts file, but it is not working for me (maybe am i doing sth wrong? idk)
I also tried to add host in below field in config.yml
# factory settings...
docker_hosts:
- "127.1.2.3 my-dns"
but again without success.
I also tried to add --dns parameter to DOCKER_OPTS in /etc/default/docker but It's for sth else I guess...
Could you give me any advice? Thank you.
I finally found a solution. It turned out that it ofc very simple.
Just call:
docker ps -a
Copy your container id, then:
docker exec -it <container_id> /bin/bash
now you are in your container's bash and you can install vim and modify /etc/hosts
Thanks to everyone for help
Today, I install ubuntu 16.04 in my machine.
When I boot the system, I can not get the IP address from DHCP server.
The network interface is renamed to enp2s0 from eth0.
I only get the IP address after run command:
$ sudo ethtool -s enp2s0 autoneg off speed 100
I try to add this command in init script (/etc/rc.local) but it does not work after I reboot system.
So, from now, when my machine is booted, I always need to add the above command mannually to get IP address.
Could anyone help me to solve this problem?
Thanks in advance.
Best Regards,
Since you're using ubuntu, use command line and execute the following:
$ sudo crontab -e
and add your script that you want to execute upon restarts by adding this at the end:
#reboot ethtool -s enp2s0 autoneg off speed 100
Hope this helps.
systemd considers both "rc.local" and "crontabs" to be "legacy". It has replacements for both. However, Ubuntu 16.04 supports both concepts.
I think your issue is that now rc.local is run before the network is fully online, causing your command to fail.
Look at /lib/systemd/system/rc.local.service to see how systemd is running your rc.local file. In particular note that the line After=network.target.
Try creating this file:
/etc/systemd/systemd/rc.local.service.d/10-wait-for-network.conf
Add these lines to it:
[Unit]
After=network-online.target
Then reboot and see if that works for you.
References:
Force services to wait for the network to be configured
Using systemd Drop-In units
Also, in the future SO is not the best place for systemd questions. Consider http://askubuntu.com for Ubuntu question instead.
I'll also add that the behavior change you found might be considered a bug in how Ubuntu emulates rc.local support with systemd. If the proposed fix works, perhaps Ubuntu shoudl change the rc.local replacement to load after network-online instead of network.
I am trying to install Meteor.js on a VM (Ubuntu 12.04) created with Vagrant.
The install should be as simple as:
curl https://install.meteor.com | /bin/sh
However this fails with curl: (7) couldn't connect to host
I have isolated the failure to a request within that shell script to this URL:
https://warehouse.meteor.com/bootstrap/0.7.0.1/meteor-bootstrap-Linux_i686.tar.gz
When I changed it to use HTTP instead of HTTPS it works. However I am running into problems elsewhere where it needs to pull things from httpS://warehouse.meteor.com/...
I thought the problem was with https, but if I do:
curl https://google.com
I get the page no problem, so what could be the issue?
Per another Ubuntu/Meteor question, it appears that there's some kind of certificate error (Meteor's SSL CA may not be installed by default in Ubuntu?) that goes away when you:
sudo apt-get update && sudo apt-get upgrade
For me upgrade didn't solve the problem.
My solution was to download the script from install.meteor.com and replace TARBALL_URL from https to http and I ran the script manually.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I'm using Ubuntu 11.10 and I manually configure DNS servers in /etc/resolv.conf but it gets somehow overwritten after I reboot. How can I prevent this?
Thanks.
As you can read in the header of resolv.conf :
Dynamic resolv.conf file for glibc resolver generated by resolvconf
So, the resolv.conf is generated, if you want to keep the resolvconf configuration after reboot, you will have to edit /etc/resolvconf/resolv.conf.d/base. In that file, put in your info as you would in resolv.conf.
nameserver 8.8.8.8
Then regenerate resolv.conf with resolvconf:
sudo resolvconf -u
After reading other answers, I still needed something different for the following reasons:
I'm not using resolvconf, just plain /etc/resolv.conf.
Using chattr +i to lock down resolv.conf seems too hacky. I need Puppet to be free to make changes when necessary.
The best solution I found overrides the default behavior of dhclient using its documented hooks.
Create a new file at /etc/dhcp/dhclient-enter-hooks.d/nodnsupdate with the following contents:
#!/bin/sh
make_resolv_conf() {
:
}
Then make the file executable:
chmod +x /etc/dhcp/dhclient-enter-hooks.d/nodnsupdate
Now when dhclient runs -- either on reboot or when you manually run sudo ifdown -a ; sudo ifup -a -- it loads this script nodnsupdate. This script overrides an internal function called make_resolv_conf() that would normally overwrite resolv.conf and instead does nothing.
This worked for me on Ubuntu 12.04.
I figure that the NetworkManager is overwriting the /etc/resolv.conf file. In my case it was the order in which my DNS servers were listed was something I wanted to change. You can do that through the NetworkManager by editing your connection IP4V settings.
You have DHCP client doing this. Follow these instructions to override that.
I use the following line :
chattr +i /etc/resolv.conf
to undo use :
chattr -i /etc/resolv.conf
Let me know if it worked...
NetworkManager can be configured to use manually entered IPv4 configuration, or get from DHCP IP/netmask/router only - in such a case it should not change /etc/resolv.conf
However, one may want have his own settings in the /etc/resolv.conf - like nameserver or domain to search; I just need a domain and I did by adding a file /etc/NetworkManager/dispatcher.d/99my_fix containing:
#!/bin/bash
rc=/etc/resolv.conf; le="search my.domain"
grep -q domain $rc && ! grep -q "$le" $rc && echo "$le" >> $rc
Of course I chmod-ed +x it. The NetworkManager invokes it after setting the /etc/resolv.conf and my script fixes it if nesessary; the first grep detects that network is up, the second that the fix was not applied - they both are necessary for the fix to be applied.
I had the same problem and I edited my `/etc/dhcp/dhclient.conf' file by adding domain-name and domain-name-servers
supersede domain-name "local.com";
supersede domain-name-servers 192.168.56.103;
192.168.56.103 is my vm running bind9 and my domain name is local.com
and I have removed the same from request section as well.
If the network interfaces for your server instance is controlled by DHCP, the dhclient program will overwrite your /etc/resolv.conf file whenever the networking service is restarted.
You can fix the issue by editing the "/etc/dhcp/dhclient.conf" file and adding supersede statements for domain-name, domain-search and domain-name-servers as follows:
supersede domain-name "mydomain.com";
supersede domain-search "mydomain.com"
supersede domain-name-servers 8.8.8.8;
In this particular case the name server is located at "8.8.8.8" and the domain name is "mydomain.com". Substitute your particular information.
Note that each line is terminated by a semi-colon and the domain name is enclosed in double quotes.