accidently deleted wpa_supplicant

I recently found myself in the same situation. The answer is actually out there, but it's spread all over the internet

I had to do multiple different google searches( with multiple different keywords ) and go through dozens of different questions, on different forums, on the SAME TOPIC.

Finally, i was able to solve the problem, but had to go through a frustating process, this is very difficult for Linux Newbies, who like to play around with little or no knowledge( like me )

This was posted about a month ago and you probably solved it by now,

I'm gonna answer this anyways, It'll atleast make it easier for people who faces this very problem in the future:)


STEP 1 : getting acces to internet via ethernet cable

open your terminal and run this command

iwconfig

to find out the name of your ethernet device. the output will look something like this...

wlp2s0f0  IEEE 802.11  ESSID:"LYF"  
          Mode:Managed  Frequency:2.437 GHz  Access Point: DC:E8:38:61:A4:50   
          Bit Rate=65 Mb/s   Tx-Power=20 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=70/70  Signal level=-37 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:36  Invalid misc:76   Missed beacon:0

enp4s0    no wireless extensions.

lo        no wireless extensions.

in older versions of ubuntu, the wifi device will usually be named wlan0 and the eternet ( LAN cable ) will probably be named as eth0 ( or something like that )

but now, in 16.04 ( my ubuntu version ) the names are device specific. in my case they're wlp2s0f0 and enp4s0 for wifi and eternet decices, respectively.


run this command to get your eternet device up and running...

sudo dhclient enp4s0 up

you can check by running

curl www.google.com

if it didn't work then your'll get a resolution error,

if it did work then you'll get some html code, ( this is just to see if the connection is OK )

NOTE : if step 1 is UNsuccesfull, then skip to step 3


STEP 2 : re-installing wpasupplicant via apt-get

run the command

sudo apt-get install wpasupplicant

NOTE : if step 2 is succesfull, then you can skip step 3


STEP 3 : re-installing wpasupplicant manually ( if step 1 failed )

When you remove a certain package, you also remove all of it's dependencies and probably configuration files too ( is you "accidentally" purged it )

I'm assuming that you have a debian based distro ( ubuntu is a debian based linux distro ),

if you do, then download the .deb files from here...

https://packages.debian.org/wheezy/wpasupplicant

you might also need another 2 files which are dependencies of wpasupplicant, you'll find them here...

https://packages.debian.org/wheezy/libengine-pkcs11-openssl

and here...

https://packages.debian.org/wheezy/libp11-2

after downloading them,

navigate to the folder where you downloaded them ( remember, all 3 files should be in the same folder ) and run

sudo dpkg -i *.deb

NOTE : if step 1 failed, then after step 3 you should be able to succesfully connect to the internet via the LAN cable


STEP 4 : putting the peices together

you're going to have to link all the components together, you can do that by,

sudo apt-get install ubuntu-desktop

this command will download and install any missing files ( such as network-manager, gnome-indicator, etc ) that might have also been accidentally removed. also, it'll update all the packages to the latest version


STEP 5 : reboot for changes to take effect

run this command in the terminal

shutdown -r now

you should be able to connect to the internet via wifi and enternet after this.