I cannot connect to any wifi connection since I deleted the network-manager. Is there any way to get it from another computer and then install it on mine or is there a way I can get an internet connection without the network-manager?


I suggest you edit a file:

gksudo gedit /etc/network/interfaces

Amend it to read:

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet dhcp
wpa-essid myssid
wpa-psk mypasscode

Restart the interface:

sudo ifdown wlan0 && sudo ifup -v wlan0


ping -c3 www.ubuntu.com

If you get ping results, you are connected. If you wish, you may reinstall Network Manager and revert the file you amended to remove the wlan0 stanza.

| improve this answer | |

If you haven't rebooted,and still connected, you can run sudo apt-get install --reinstall network-manager. You're done there.

If you have rebooted the process is a bit more complicated - you will have to get Ubuntu's live cd or usb, and boot it, as if you are about to install Ubuntu anew. Live CD or USB does allow connection to internet, so make sure you're connected . Instead of installing, either press "Try Ubuntu" and access terminal through there, or press Ctrl + Alt + F2 .

Next you need to mount your ubuntu partition (noticce sda1 is just example , find out which one it is with lsblk ) and couple of folders. Thus:

sudo mount /dev/sda1 /mnt

sudo mount --bind /dev /mnt/dev

sudo mount --bind /proc /mnt/proc

sudo mount --bind /sys /mnt/sys

sudo chroot /mnt

By this point you can use live USB / CD to act as if you're working with your actual Ubuntu install, but still using Live USB/CD resources. Now you can run sudo apt-get install --reinstall network-manager

I've used LiveCD/USB recovery quite a few times when I bricked my system. It's one of the best options ever.

There is alternative option - connect through command line, but it will be a somewhat troublesome, especially if you have WPA2 security on your router. You could take your computer (if it's a laptop) to any open/usecure wifi hotspot, but there's too many nopes

| improve this answer | |

Try this:

Open a terminal,

Press Ctrl+Alt+T

Run it:

sudo iw dev

The iw command will list all the connected WiFi adapters:

    Interface wlan0
        ifindex 3
        wdev 0x1
        addr f4:ec:38:de:ad:de
        type managed

Designated name: phy#1

Device names: wlan0

Interface Index: 3

Address: mac address

Type: Managed. Type specifies the operational mode of the wireless devices.

You can check that if the wireless device is up or not running:

sudo ip link show wlan0

3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN mode DORMANT group default qlen 1000
    link/ether f4:ec:38:de:ad:de brd ff:ff:ff:ff:ff:ff

In the above example, wlan0 is not UP.

Execute the following command to bring up the WiFI interface:

sudo ip link set wlan0 up

3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether f4:ec:38:de:ad:de brd ff:ff:ff:ff:ff:ff

In the above example, now wlan0 is UP.

You check WiFi network connection status running the command:

sudo iw wlan0 link

Not connected.

The output shows that you are not connected to any network.

You scan to find out what WiFi networks are detected, running the command:

sudo iw wlan0 scan

BSS 00:19:e3:fa:b6:9e(on wlan0)
    TSF: 25277930826 usec (0d, 07:01:17)
    freq: 2437
    beacon interval: 100 TUs
    capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
    signal: -46.00 dBm
    last seen: 424 ms ago
    Information elements from Probe Response frame:
    SSID: Adrogue
    Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 
    DS Parameter set: channel 6
    Country: US Environment: Indoor/Outdoor
        Channels [1 - 11] @ 30 dBm
    ERP: <no flags>
    Extended supported rates: 24.0 36.0 48.0 54.0 
    RSN:     * Version: 1
         * Group cipher: CCMP
         * Pairwise ciphers: CCMP
         * Authentication suites: PSK
         * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)
    HT capabilities:
        Capabilities: 0x500c
            SM Power Save disabled
            No RX STBC
            Max AMSDU length: 3839 bytes
            DSSS/CCK HT40
            40 MHz Intolerant
        Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
        Minimum RX AMPDU time spacing: 8 usec (0x06)
        HT RX MCS rate indexes supported: 0-15
        HT TX MCS rate indexes are undefined
    HT operation:
         * primary channel: 6
         * secondary channel offset: no secondary
         * STA channel width: 20 MHz
         * RIFS: 0
         * HT protection: no
         * non-GF present: 1
         * OBSS non-GF present: 0
         * dual beacon: 0
         * dual CTS protection: 0
         * STBC beacon: 0
         * L-SIG TXOP Prot: 0
         * PCO active: 0
         * PCO phase: 0
    WMM:     * Parameter version 1
         * BE: CW 15-1023, AIFSN 3
         * BK: CW 15-1023, AIFSN 7
         * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
         * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
    ---- truncated ----

The two important pieces of information from the above are the SSID and the security protocol WPA/WPA2 vs WEP.

The SSID from the above example is Adrogue. The security protocol is RSN, also commonly referred to as WPA2.

Now You will generate a configuration file for wpa_supplicant that contains the pre-shared key passphrase for the WiFi network.

sudo wpa_passphrase Adrogue >> /etc/wpa_supplicant.conf 11223344

Where 11223344 was the Network password.

wpa_passphrase will create the necessary configuration entries based on your input.

Each new network will be added as a new configuration in the configurations file /etc/wpa_supplicant.conf.

sudo cat /etc/wpa_supplicant.conf 

# reading passphrase from stdin

To connect, run the following command:

sudo wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.conf

-B : Means run wpa_supplicant in the background.

-D : Specifies the wireless driver.

wext : Is the generic driver.

-c : Specifies the path for the configuration file.

Now use dhclient to get an IP address by DHCP:

sudo dhclient wlan0

You can use ip or ifconfig command to verify the IP address assigned by DHCP

sudo ip addr show wlan0

And ping Google’s IP to confirm network connection:

sudo ping
| improve this answer | |

You could always just download the stuff from here or just search for specific packages here depending on which packages you deleted, copy them to a pendrive or something then just do a dpkg -i on them and voilà, you have whatever installed again.

| improve this answer | |
  • And the thousand dependencies too, if not already installed, as well. :) – Abel Tom Mar 17 '18 at 17:47

Okay, I encountered this issue on XUbuntu 12.04 LTS about yesterday, this question is old but perhaps it would help some people in the future.

I fix this issue in the "traditional way".

Since there's no way to connect to Internet in my XUbuntu, I use my phone to find what I need.

I googled on my phone for network-manager and network-manager-gnome precise.

And then I went to download it from my phone and move that two deb files to my computer.

After that I installed the two .deb files:

sudo dpkg -i network-manager.deb
sudo dpkg -i network-manager-gnome.deb

And then you can restart the network manager service with this command:

service network-manager restart 

And it works perfectly for me . I know everyone here have a phone with Internet connection. So it should work.

| improve this answer | |

If you have synaptic installed you can select network-manager and network-manager-gnome and use the generate package download script to download it and all dependencies on a machine with internet access, put them on a USB stick and install them using sudo dpkg -i *.deb in the folder where you run the download script.

| improve this answer | |

If you've recently upgraded your network manager you can use sudo apt-get install --reinstall network-manager, but this only works if the package is still in your Apt cache

| improve this answer | |
  • apt-get will get (download) the package if its not found in cache. – guiverc Feb 20 '18 at 3:13

If you are going to run these commands, make sure your internet is working. I made the mistake of running them while my internet was cut out and it purged my network manager and made it impossible to recover it thus impossible to access the internet. I have spent over 13 hours trying to fix the issue to no avail. I now have to reinstall my operating system all together.

So, please make sure you’re internet isn’t presently cut out before running the above commands or you will likely the ability to ever connect to the internet again unless you reinstall your OS.

| improve this answer | |

There's an easy fix if the network manager package is still in the cache.

    sudo apt-get install network-manager

Done. That simple, if not, see above answer

| improve this answer | |
  • Ok. But that will only work if the user has not rebooted the machine. – Sergiy Kolodyazhnyy Jul 24 '15 at 23:33
  • 1
    Or if network-manager is still in apt's cache. – Léo Lam Jul 26 '15 at 7:45

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.