How to force Network Manager in Ubuntu to rescan wireless connections?
After closing my laptop, network manager does not see new wireless connections. Is there any bash command to force rescan? sudo service network-manager restart
does not help.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communitysudo iwlist interface scan
Where interface is the name of your wireless card, e. g. wlan0
Try
nmcli device wifi rescan
and
nmcli device wifi list
to see available networks
list
(or no argument at all).
In Ubuntu 16.04 and newer, restarting NetworkManager with sytemctl works (at least after scanning the networks manually with iwlist
):
# Find the name of the network interface, e.g. wlan0 or wlp3s0
ip addr show
# Scan for WLAN networks (replace wlan0 by the correct interface)
sudo iwlist wlan0 scan
# Restart Ubuntu’s Network Manager so it reloads the Access Point list
sudo systemctl restart NetworkManager
Simply deactivating and reactivating your wireless module would be a workaround.
I have too low reputation to elaborate under Davide's answer so I decided to add a new answer. Create a file /usr/share/applications/rescan.desktop
with the following contents to be able to easily launch a rescan through the dashboard:
[Desktop Entry]
Name=Rescan wifi
Type=Application
Exec=/usr/bin/nmcli device wifi rescan
Terminal=false
Icon=network-wireless
NoDisplay=false
Categories=Network;System
Name[en]=Rescan wifi
Name[en_US]=Rescan wifi
The checked answer is incorrect for most situations. Only nmcli controls NM.
The first thing to do is to check for NM's radio status:
$ nmcli r
This will let you know if the wifi radio is enabled.
If not, then:
$ nmcli r wifi on
You can then confirm the result:
$ sudo nmcli device wifi list