Wireless network failures are one of the most common problems faced by operating system users. Linux. IN UbuntuAs with any other system, network interfaces can stop responding due to temporary software errors, driver conflicts, or kernel updates. Often, the only way to restore the connection without a complete computer reboot is to force restart the network module.
Unlike Windows, where network management is often hidden in the graphical interface, in Ubuntu, the administrator has direct access to network service management tools. This allows for fine-tuning and quick recovery. wlan0 or other interfaces. Understanding how to properly restart the NetworkManager service, is a basic skill for any user of this OS, allowing you to save time on troubleshooting.
There are several ways to perform this procedure, from simple graphical switches to complex terminal commands. The method you choose depends on the severity of the failure and your access level. In this article, we'll cover all the current options, from the simplest to advanced diagnostic methods.
Using the GUI for a quick reset
The most obvious and accessible method for beginners is to use the built-in tools of the graphical shell. In modern versions of the distribution, such as Ubuntu with the GNOMENetwork management has been moved to the system tray. This allows you to quickly disable and enable the adapter without using the command line.
To do this, tap the network icon in the upper right corner of the screen. In the menu that opens, you'll see the Wi-Fi switch. Flipping it to the "Off" position deactivates the network module. After a few seconds, returning the switch to the "On" position will cause the system to attempt to reinitialize the device and connect to saved access points.
⚠️ Attention: If the graphical interface is frozen and unresponsive, this method won't help. In that case, switch to a terminal that operates at a lower system level.
Sometimes it can be useful to forget the network and reconnect. To do this, go to Settings → Wi-Fi, select the desired network, click the gear icon, and select "Forget Network." Then reconnect by entering the password. This often resolves issues with incorrect DHCP or DNS configurations.
Restarting the network service via the terminal
If the graphical interface is unavailable or unresponsive, the most effective method is to use the command line. In Ubuntu, the default service for managing network connections is NetworkManagerRestarting it is equivalent to turning Wi-Fi off and on, but it is performed at the system daemon level.
To perform these operations, you need superuser rights. Open the terminal (key combination Ctrl+Alt+T) and enter the command to stop the service. This will completely disconnect all active network connections, so save your work before starting the procedure.
sudo systemctl stop NetworkManager
After stopping the service, you must restart it. The system will rescan available networks and attempt to reconnect using saved profiles.
sudo systemctl start NetworkManager
You can also use a single restart command that will automatically stop and start the system. This is the most common method among system administrators.
sudo systemctl restart NetworkManager
☑️ Checklist before restarting the service
It's important to understand the difference between simply turning off Wi-Fi and stopping the service. If the service NetworkManager If it doesn't work, you won't even see a list of available networks in the interface. Therefore, checking the status via the command systemctl status NetworkManager is an important stage of diagnosis.
Managing a network interface with nmcli
For more flexible network management, Ubuntu uses a command line utility. nmcli (NetworkManager command line interface). It allows you to manage not only the service itself but also specific connections and devices. It's a powerful tool that provides more control than standard systemctl commands.
The first step is always to determine the name of your wireless interface. In modern systems, they are often called wlo1, wlan0 or have names that depend on the manufacturer, for example, Intel WirelessTo see the list of devices, run:
nmcli device status
Once you know the device's name, you can force it to disconnect. This action programmatically "pulls" the cable from the virtual port, breaking the connection at the driver level.
sudo nmcli radio wifi off
Then, after a short pause of 3-5 seconds, turn the radio module back on. The system will restart the airwaves scanning process.
sudo nmcli radio wifi on
Advantage nmcli The ability to manage specific connection profiles is key. If you're experiencing issues with a specific network, you can disable it without affecting other interfaces, such as Ethernet or VPN.
What to do if nmcli is not found?
The nmcli utility is part of the network-manager package. If the command isn't found, make sure the package is installed. In rare cases, server versions of Ubuntu use netplan, and management may differ.
Usage nmcli This is especially useful in scenarios where the GUI is not working correctly, but the NetworkManager service itself is functioning normally. It provides an intermediate level of diagnostics between the GUI and low-level kernel commands.
Resetting the kernel module and working with drivers
In situations where restarting services does not help, the problem may lie deeper - in the kernel module responsible for interaction with Wi-Fi adapterWireless card drivers, especially from manufacturers like Realtek or Broadcom, can sometimes hang at the Linux kernel level.
To solve this problem, we need to find out which driver is being used. This can be done using the command lspci or by looking at the output dmesg. However, the fastest way to find out the module name is to use the command lsmod in conjunction with grep.
lsmod | grep -i wifi
Once the module name is found (e.g. iwlwifi for Intel or rtl8821ce (For Realtek), it can be unloaded from memory and reloaded. This action is similar to physically removing and inserting the card into a running system.
sudo modprobe -r module_name
sudo modprobe module_name
| Manufacturer | Frequent kernel module | Device type |
|---|---|---|
| Intel | iwlwifi |
Built-in adapter |
| Realtek | rtl8xxxu |
USB whistle |
| Broadcom | b43 or wl |
Built-in adapter |
| Qualcomm Atheros | ath9k |
PCI/PCIe card |
⚠️ Attention: Be extremely careful when unloading kernel modules. If you remove a module responsible for the current connection and it doesn't reload, you will lose access to the system, especially if you're working remotely via SSH.
This method is a bit of a "heavy artillery" approach. It requires precise knowledge of the driver name. If you're unsure which module to use, it's best to restart NetworkManager to avoid complete loss of network functionality.
Automating the recovery process
If the problem is with Wi-Fi in Ubuntu If the error occurs with alarming regularity, it makes sense to automate the recovery process. Instead of manually entering commands each time, you can create a simple script that will perform the entire sequence of actions.
Create a file named wifi-restart.sh in your home directory. It should contain the service stop, pause, and start commands. Using a script helps avoid typos when entering long commands under stress.
#!/bin/bashecho "Stopping NetworkManager..."
sudo systemctl stop NetworkManager
sleep 2
echo "Starting NetworkManager..."
sudo systemctl start NetworkManager
echo "Done!"
After creating the file, don't forget to make it executable using the command chmod +x wifi-restart.shNow, starting recovery takes one second. For greater convenience, you can create an alias in the shell configuration file. .bashrc.
Adding a row alias wifireset='~/wifi-restart.sh' will allow you to reboot Wi-Fi simply by typing a word wifireset in the terminal. This significantly improves ease of use and response times to failures.
Diagnosing and troubleshooting persistent problems
If your Wi-Fi constantly requires a reboot, this indicates a deeper issue. Perhaps the power saving settings are disabling the adapter to save battery, or there are conflicting configurations. Netplan And NetworkManager.
A frequent cause of instability is an aggressive power saving policy. Ubuntu may attempt to disable the Wi-Fi module, believing it to be inactive. To check and disable this, create a configuration file for NetworkManager.
In the file /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf change the parameter value wifi.powersave on 2 (which means turning off power saving). Meaning 3 Enables it. After changing this, be sure to restart the service.
It is also worth checking the system logs for driver errors. Command journalctl -u NetworkManager will show the network service's operation history. Search for keywords like "error," "fail," or "firmware" to understand the cause of failures.
⚠️ Attention: Configuration file interfaces and names may vary across Ubuntu versions. Always check the paths and syntax against the official documentation for your distribution.
In some cases, a complete reset of network settings helps. Deleting the configuration files in the folder /etc/netplan/ (with a preliminary backup!) and recreating them from scratch can eliminate conflicts that arise after system updates.
Should I reinstall the drivers?
In Ubuntu, drivers are usually built into the kernel. Reinstallation is rarely required; most often, the problem is resolved by updating the kernel or installing additional firmware packages.
Frequently Asked Questions (FAQ)
Why doesn't Wi-Fi turn on automatically after rebooting Ubuntu?
This may be due to the NetworkManager service starting before the device driver has fully loaded. Also, check if the adapter is blocked by the rfkill command. Enter rfkill list in the terminal to check the lock status.
Is it safe to reboot your Wi-Fi while a file is downloading?
No, this will interrupt your connection. All active downloads, streaming, or online broadcasts will be stopped. Restarting the service will temporarily interrupt your connection for 5-10 seconds.
How do I find out what Wi-Fi driver I have without internet?
Use the command lspci -nnk | grep -iA2 netIt will display information about network hardware and the kernel driver used even without an active network connection.
Could the router be the cause if Wi-Fi drops out in Ubuntu?
Yes, DHCP lease issues or a NAT table overflow on the router can cause disconnections. Check if the issue affects other devices. If so, reboot the router.
What to do if the sudo systemctl restart NetworkManager command does not work?
Try using the deprecated, but sometimes working, method via service: sudo service network-manager restartAlso check if you are using systemd-networkd instead of NetworkManager.