I am trying to make a simple server on an old macbook. I got Ubuntu 14.04 installed, but I need to use apt-get to install some packages, and apt-get will not work.

The problem is that apt-get cannot connect to ubuntu.com. I see the error

 Could not resolve 'us.archive.ubuntu.com'

I tried to ping google.com and, and they cannot be reached either. I edited my /etc/resolv.conf file to include nameserver and I still couldn't get out.

I figured it must be the wifi connection, which is weird because I configured the wifi during installation and it was working fine. I have been spending the past several hours trying to get

wpa_supplicant -iwlan0 -Dwext -c<(wpa_passphrase <my SSID> <my password>)

(which I am most definitely running as a superuser) to work. It doesn't. It immediately spits out the following

Successfully initialized wpa_supplicant
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWSCAN]: Device or resource busy

after which it enters an infinite loop of trying to connect and failing.

It is possible that the device is busy because I had earlier put in a wpa_supplicant command with the -B option, which put it in the background, and I can't figure out how to kill the background process. But before that, I was having a similar problem: I just can't connect to the internet.

Since I can't connect to the internet, I have no access to apt-get so if it isn't in the standard Ubuntu 14.04 server distro, then I don't have it.

I was able, once, the first time, to get a ping google.com to return something, but it quickly went away and I haven't been able to duplicate anything.

What do I do here? Am I missing something really simple

(I did check that wlan0 is turned on, and I did scan for my SSID and it does show up in a scan. I just can't connect to it. I have double checked the password I'm using: it is the one written on the box, and it works on every other machine in the house)

EDIT: I removed D wext from the wpa_supplicant request. That is, I entered

wpa_supplicant -iwlan0 -c<(wpa_passphrase )

This doesn't let to connect to the internet still, but it removes the complaints about invalid arguments.

EDIT: I got it to work. My routine is (from root)

>ifconfig wlan0 up
>iwlist scan|less
>wpa_supplicant -iwlan0 -c<(wpa_passphrase <SSID> <password>)

If that connects, then I type it again but with -B to run it in background, then

>dhclient -r
>dhclient wlan0
>ping google.com

It should start returning data from google. If not, I kill the background process with

>kill `pidof wpa_supplicant`

This works for me.

  • Sounds like you need to try a wired connection. – Daniel Jul 22 '15 at 4:05

It should not be necessary to invoke wpa_supplicant directly OR to edit /etc/resolv.conf manually. For example, for a minimal DHCP setup you can use a /etc/network/interfaces file stanza like

auto wlan0
iface wlan0 inet dhcp
    wpa-ssid MyNetwork
    wpa-psk "Long p@ssphrase, with spaces\!"

Notice that this stanza includes the DNS server specification: if you have messed with /etc/resolv.conf you may need to reconfigure the resolvconf package to get things back to normal

sudo dpkg-reconfigure resolvconf

It will present you with a question about preparing /etc/resolv.conf for dynamic updates - answer "Yes". It may also present you with another question about temporarily appending your existing config to the dynamic one - if so you should probably answer "No" to that one. This will re-create the default symbolic link in place of your manually-edited file.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.