This turned out to be dead easy, although it took a bit of futzing around due to my own slowness. The situation arose during an a failed upgrade of my dad’s machine to Ubuntu 10.04 (aka Lucid Lynx). I’m sensing a pattern here; I don’t think there has been an upgrade that has gone smoothly on that machine. To be fair I think there may be problems with just about every component apart from the hard drive, but you think I would realise that upgrading that machine is a Bad Idea. Anyway, the solution:
A combination of wpa_supplicant
and wpa_passphrase
will do the trick.
- Get a root prompt. Either
sudo su
, or boot to single user (recovery) mode. Just don’t do that, select netroot, then get bored and hit Alt-F1 for a console 1. For some reason, that makes the machine very unhappy and so your wireless hardware probably will complain about device busy in step 2. So don’t do that. - Run
iwlist scanning
, and check your card can see the wireless network in question - If it can, run
wpa_passphrase [your-wireless-network-name] > wpa.conf
(egwpa_passphrase pegasus > wpa.conf
). The prompt will wait for you to enter a passphrase. Do this and hit enter. - Run
wpa_supplicant
. Replacewext
with the correct wireless driver (which is probablywext
, but runwpa_supplicant --help
to check) andwlan0
with your wireless interface wpa_supplicant -Dwext -iwlan0 -c/root/wpa.conf
- If that works, you should see text to the effect of “successfully associated”. If not, try again with a different driver, make sure your passphrase is correct, and make sure your wireless interface is working properly.
- Hit Ctrl+c, then the up arrow, then add a -B (for background) onto the end of the last command, thus:
wpa_supplicant -Dwext -iwlan0 -c/root/wpa.conf -B
- Run
dhclient -r
to release any DHCP leases you have. - Run
dhclient wlan0
to get a new IP address. Substitutewlan0
for your wireless interface, of course.
You should now be connected. This is a handy trick for any Linux user unaccustomed to connecting to wireless networks from the command line – let’s face it, network-manager has spoiled us rotten. But when an upgrade fails and won’t leave you with a functioning graphics driver (grr) and you need some packages, this is the way to do it.
thanks for the nice write up. the commands work perfectly.
Thank you very much for this, one thing to note is that I already had an instance of wpa_supplicant running. People trying this can check using “ps -ef” and if there already is an instance running type in “sudo kill -9 ” before doing step 5.
It may not work for everyone but that’s how I fixed my problem at step 5 when wpa_supplicant refused to run.
Good call Adam, though it might be worth SIGHUP, SIGINT or SIGABRT-‘ing the processes before leaping to kill -9 🙂
Can you please make a video? Sorry for the hassel.