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?
10 Answers
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
Test:
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.
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
-
Wow!! That's the neatest solution that just saved my day today! I had accidentally uninstalled ubuntu-desktop meta package and I got dropped down to a bare terminal with no network interface. Fortunately, I had a live USB stick, and I was able to recover using this solution. One addition to this solution, however: networking wasn't working inside
chroot
. I had to add some public nameservers to/etc/resolv.conf
to make it work, as suggested here: askubuntu.com/questions/820814/…– shivamsJun 24, 2022 at 18:13
Try this:
Open a terminal,
Press Ctrl+Alt+T
Run it:
sudo iw dev
The iw command will list all the connected WiFi adapters:
phy#0
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
HT20
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
network={
ssid="Adrogue"
#psk="11223344"
psk=42e1cbd0f7fbf3824393920ea41ad6cc8528957a80a404b24b5e4461a31c820c
}
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 8.8.8.8
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.
-
And the thousand dependencies too, if not already installed, as well. :)– Abel TomMar 17, 2018 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.
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
-
Ok. But that will only work if the user has not rebooted the machine. Jul 24, 2015 at 23:33
-
2
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.
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
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.
For anyone still struggling with this, I did some searching around and found the best solution for me.
Connect your mobile and do USB Tethering.
Open terminal:
#Check the adapter logical name for tethered hotspot
sudo lshw -C network
sudo dhclient <logical name of the tethered hotspot>
#to confirm you are connected:
ping 8.8.8.8
sudo apt-get install network-manager
This is the quickest fix i could find that worked for me.
UPDATE: This gave me a wifi adapter not found problem.
I resolved it by upgrading the kernel like below:
sudo add-apt-repository ppa:cappelikan/ppa -y
sudo apt install mainline -y
Open the mainline app, then install kernel 6.4.8.
Further edits
sudo nano /etc/network/interfaces
#Below is the content
auto lo iface lo inet loopback auto wlo1 iface wlo1 inet dhcp wpa-essid your ssid wpa-psk your password
sudo nano /etc/modprobe.d/mt7921e.conf
#Below is the content
alias pci:v000014C3d00000608sv*sd*bc*sc*i* mt7921e
sudo nano /etc/udev/rules.d/99-mt7921e.rules
#Below is the content
SUBSYSTEM=="drivers", DEVPATH=="/bus/pci/drivers/mt7921e", ATTR{new_id}="14c3 0608"
sudo ifconfig wlo1 down
sudo ifconfig wlo1 up
sudo systemctl restart NetworkManager