11

I'm using Ubuntu 18.04.1 LTS. I want to disable network manager on an Ubuntu machine, because (1) I don't need it, (2) I prefer having hardcoded configuration, and (3) network manager regularly causes issues by changing the DHCP configuration.

I tried to follow the official documentation:

Stop network manager

sudo systemctl stop NetworkManager.service

Disable network manager (permanently) to avoid it restarting after a reboot

sudo systemctl disable NetworkManager.service

Despite this, the network manager is back again every time I reboot the machine.

How can I make it go away?

  • 1
    Is there a reason you cannot simply uninstall NM? – user535733 Nov 10 '18 at 11:40
  • What do you want to use instead of NetworkManager - netplan as in server? – N0rbert Nov 10 '18 at 11:48
  • @user535733: I didn't know network manager can be uninstalled. I'll check this one. – Arseni Mourzenko Nov 10 '18 at 11:49
  • 1
    @N0rbert: just hardcoded configuration in /etc/network/interfaces and in /etc/resolv.conf. Don't know if there is an official name for that. – Arseni Mourzenko Nov 10 '18 at 11:50
  • @ArseniMourzenko What is your desktop environment? If it is GNOME, then purging network-manager will remove gnome-control-center, which is essential part of GNOME. – N0rbert Nov 10 '18 at 11:59
13

The method depends on desktop environment:

  • For Ubuntu MATE 18.04.1 LTS purging network-manager package is safe. You can simply run:

    sudo apt-get purge network-manager
    
  • For Ubuntu 18.04.1 LTS with GNOME desktop purging network-manager package will also purge ubuntu-desktop and gnome-control-center (essential part of GNOME desktop). So it is not an option.

    Here you should disable NetworkManager service (as you have already done):

    sudo systemctl stop NetworkManager.service
    sudo systemctl disable NetworkManager.service
    

    and three more services:

    sudo systemctl stop NetworkManager-wait-online.service
    sudo systemctl disable NetworkManager-wait-online.service
    
    sudo systemctl stop NetworkManager-dispatcher.service
    sudo systemctl disable NetworkManager-dispatcher.service
    
    sudo systemctl stop network-manager.service
    sudo systemctl disable network-manager.service
    

    and then reboot.


Notes:

  1. You can read more about network configuration with /etc/network/interfaces from Ubuntu 16.04 LTS Server Guide.
  2. Modern Ubuntu 18.04 LTS server uses netplan, you can read about it in the Ubuntu 18.04 LTS Server Guide.
6

Try the mask command:

sudo systemctl stop NetworkManager.service
sudo systemctl mask NetworkManager.service

mask NAME...

Mask one or more units, as specified on the command line. This will link these unit files to /dev/null, making it impossible to start them.
This is a stronger version of disable, since it prohibits all kinds of activation of the unit, including enablement and manual activation. Use this option with care. This honors the --runtime option to only mask temporarily until the next reboot of the system.
The --now option may be used to ensure that the units are also stopped. This command expects valid unit names only, it does not accept unit file paths.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.