Howto disable networkmanager and systemd-resolved?

Hi everyone! I don’t want networkmanager and systemd-resolved to manage my network. I just want a custom script which use the ip command. But i found that i can not disable these two. everything i tried will be useless. So…what is the correct way to disable them?

1 Like

Hi @wptskybzy, welcome to the Clear Linux* Forum!

Did you already try disabling the services via systemctl?

Disabling NetworkManager and systemd-resolved

  1. Open a terminal and run

    sudo -s

    then type your admin password to obtain admin privileges.

  2. Stop and disable NetworkManager with these commands:

    systemctl stop NetworkManager.service
    systemctl mask NetworkManager.service
  3. Stop and disable systemd-resolved with these commands:

    systemctl stop systemd-resolved.service
    systemctl mask systemd-resolved.service

Done, now you can close the terminal! :smile:

Re-enabling NetworkManager and systemd-resolved

If you want to reverse the changes you can follow the next steps:

  1. Open a terminal and run

    sudo -s

    then type your admin password to obtain admin privileges.

  2. Enable and start NetworkManager with these commands:

    systemctl unmask NetworkManager.service
    systemctl start  NetworkManager.service
  3. Enable and start systemd-resolved with these commands:

    systemctl unmask systemd-resolved.service
    systemctl start  systemd-resolved.service

Done, now you can close the terminal! :smile:


Thanks very much! This is indeed the right way to disable these services!

1 Like

You’re welcome @wptskybzy!

I would also suggest moving your question from General Discussion to Q&A and, if it works for you, to pick my answer as solution. In this way, it can be found more easily by anyone else who has the same problem.

You can do this by clicking the :pencil2: button near the post title :smile:

I’m a little bit curious, Why do you want to use script?

Are you setting static IP?

Setting a static IP with systemd-networkd is relatively simple. Please read the man pages for e.g. man

Sure, indeed i know. My dell server has 4 physical ethernet port,and for business reason,these four port must have different ip,mask,route and rule.I have create three additional table at rt_tables to handle this.And for history reason,i do have a .sh script to create network,which is running very well.

Disable and stop the systemd-resolved service:

sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved
Then put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:

Delete the symlink /etc/resolv.conf

rm /etc/resolv.conf
Restart network-manager

sudo service network-manager restart

Hope above information helps you. For more details regarding networking then you can contact Network Experts which also guides to help you.

This is old but you should also mask NetworkManager-wait-online.service as well.

systemctl stop NetworkManager-wait-online.service
systemctl mask NetworkManager-wait-online.service

I’ve noticed that it was taking over a minute for docker.service to start and so I ran systemd-analyze blame and saw that boot spent over a minute on NetworkManager-wait-online.service. Doing a systemctl status on NetworkManager-wait-online.service shows that it was failing to start (of course) since NetworkManager.service was already disabled and masked. Masking NetworkManager-wait-online.service saved about a minute of waiting.

1 Like

On a random note. I was testing systemd-networkd versus NetworkManager and it seems like NetworkManager is much faster on startup than systemd-networkd.

After switching to NetworkManager:

$ systemd-analyze
Startup finished in 11.429s (firmware) + 1.031s (loader) + 1.656s (kernel) + 16.284s (userspace) = 30.402s reached after 16.284s in userspace

It would be even faster if you’re running a static IP where NetworkManager-wait-online.service can be masked. I didn’t see the point of using NetworkManager at first since I am running Clearlinux Server. But bootup is much faster after switching back to NM and disabling systemd-networkd. This install is also running on a Dell Wyse 5070 J5005 in my homelab so any speed improvement is a win.