Understanding the Root Cause
The behavior you described, where programs appear to hang during initialization, is a classic symptom of a blocking systemd unit. In Ubuntu 24.04 LTS (Noble Numbat), the default installation includes a service designed to ensure network availability before launching graphical sessions. While this improves reliability for cloud-dependent applications, it creates an unacceptable delay for local users who do not require internet access to launch basic tools like terminals or file managers.
The specific culprit is almost always NetworkManager-wait-online.service. When enabled, this service waits for NetworkManager to report that at least one active connection is online. If your system has multiple network interfaces, or if the DHCP lease takes time to process, the system will pause all dependent services until the timeout expires or the connection succeeds. This often manifests as a "frozen" screen for approximately 20-30 seconds before the desktop environment becomes responsive.
Disabling the Wait-Online Service
To resolve the startup lag immediately, you need to disable the wait-online service. This action tells systemd to start network configuration in parallel with other services rather than waiting for it to complete first. Please follow these steps carefully using the terminal.
- Open a Terminal: Press
Ctrl+Alt+Tto open a new terminal window. - Stop the Service: Run the following command to stop the currently running instance:
sudo systemctl stop NetworkManager-wait-online.service - Disable the Service: Prevent the service from starting automatically on boot:
sudo systemctl disable NetworkManager-wait-online.service - Mask the Service (Optional but Recommended): To ensure it cannot be accidentally re-enabled by package updates, mask it:
sudo systemctl mask NetworkManager-wait-online.service
After executing these commands, reboot your system. You should notice that the login screen appears much faster, and applications launch instantly without the previous hanging period. For more details on how to manage system resources effectively, you might find our guide on Understanding CPU, Memory, and GPU Usage on Multiple Ubuntu Computers helpful for monitoring post-fix performance.
Alternative: Adjusting the Timeout
If you prefer not to disable the service entirely, you can increase the timeout duration to reduce the impact on other critical network tasks while still allowing the session to proceed sooner. However, note that simply changing the timeout may not fully eliminate the delay if the network never becomes "fully online" within that window.
You can edit the service file directly to change the timeout value. Open the editor with root privileges:
sudo nano /lib/systemd/system/NetworkManager-wait-online.service
Look for the line containing TimeoutStartSec=. The default is usually 90 seconds, but some configurations set it lower. Changing this value does not typically solve the immediate 25-second hang unless the hang is caused by a different underlying issue. Therefore, disabling the service remains the most effective solution for the specific symptom described.
Checking for Other Blocking Services
In rare cases, other services may also block the graphical session. If disabling the NetworkManager service does not resolve the issue, check for other long-running systemd units. You can identify slow-starting services by analyzing the boot log.
Run the following command to see which services took the longest to start:
systemd-analyze blame | head -n 20
This command lists the top 20 slowest services. Look for any service that shows a time close to 25 seconds. Common offenders include disk encryption unlocking prompts (if configured incorrectly) or third-party driver installations. If you see a service related to Dropbox or similar cloud sync tools causing delays, refer to our article on Dropbox Not Automatically Updating on Ubuntu: How to Update Manually for troubleshooting steps related to cloud synchronization conflicts.
Verifying Network Connectivity After Fix
Disabling the wait-online service means your applications may attempt to access the network before it is fully ready. This is generally safe for local applications but could cause minor errors in apps that strictly require internet access upon launch. To verify your network status manually, use:
nmcli general status
This command provides a quick overview of whether your Wi-Fi or Ethernet connection is active. If you encounter connectivity issues after making these changes, they are likely unrelated to the startup delay and may require separate troubleshooting, such as checking DNS settings or firewall rules.
Frequently Asked Questions
Will disabling this service break my internet connection?
No, it will not break your internet connection. NetworkManager will still configure your network interfaces in the background. The only difference is that the graphical session will no longer wait for the network to be fully established before launching.
How do I revert these changes if I experience issues?
To revert the changes, open a terminal and run sudo systemctl unmask NetworkManager-wait-online.service followed by sudo systemctl enable NetworkManager-wait-online.service. Then reboot your system to restore the default behavior.
Is this issue specific to Ubuntu 24.04?
While present in Ubuntu 24.04, this issue has existed in previous versions including 22.04. However, recent updates to systemd and NetworkManager in Ubuntu 24 have made the wait-online mechanism more prominent in default configurations, leading to increased reports of this specific delay.
Can I delay specific applications instead of the whole system?
It is difficult to delay individual applications based on network status because most GUI applications do not query network availability before starting. Disabling the global wait service is the standard approach to improve perceived system responsiveness.
What if I am using a VM?
If you are running Ubuntu in a virtual machine, especially on KVM or virt-manager, network delays can also stem from virtual NIC configurations. For VM-specific networking issues, such as those involving port forwarding or NAT, consult our guide on Ubuntu 22.04 VM on KVM/virt-manager Not Connecting to Internet.