Announcement

Collapse
No announcement yet.

NetworkManager - do you need it?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    NetworkManager - do you need it?

    Playing around with systemd-analyze and I noticed NetworkManager was taking almost 11 seconds at boot up. 3-4 times anything else. This is a desktop machine so boot time isn't really a big deal, but hey - time is time - or money or something. Anyway, it occurred to me that since this is a desktop and I don't need or use wifi, what exactly do I need Network Manager for? Nada is the answer. I don't even use dhcp here because NFS is easier using fixed IPs. My server sits comfortably connected with no NM installed as it has no desktop at all. So I switched to systemd-networkd instead, which I only recently learned existed. It was pretty simple for the most part. NOTE I'm using KDEneon but it's based on 18.04 and networking isn't different from Kubuntu.

    This change shaved a full 6 seconds off of my boot time. YMMV.

    Removing NetworkManager:
    Since 18.04 was released, we've gone away from the old ifcfg files and now use something called netplan. My server is configured using systemd-networkd and netplan so I knew where to go next.

    First, I stopped and blocked NetworkManager:
    Code:
    sudo systemctl stop NetworkManager
    sudo systemctl disable NetworkManager
    sudo systemctl mask NetworkManager
    In /etc/netplan/ was 01-network-manager-all.yaml which contained only this:

    Code:
    # Let NetworkManager manage all devices on this systemnetwork:
      version: 2
      renderer: NetworkManager
    Not much needed because NetworkManager does the work. I removed that file and replaced it with one similar to my server named 01-netcfg.yaml which contains this:
    Code:
    network:  version: 2
      renderer: networkd
      ethernets:
        enp0s31f6:
          dhcp4: no
          dhcp6: no
          addresses: [192.168.1.199/23]
          gateway4: 192.168.1.1
          nameservers:
            addresses: [8.8.8.8,8.8.4.4]
    Note that this is a fixed IP and I use googles nameservers. If you want normal DCHP (network assigned IP address) then you want something like this:
    Code:
    network:  version: 2
      renderer: networkd
      ethernets:
        enp0s31f6:
          dhcp4: yes
    Also note that enp0s31f6 is the name of my ethernet port. Yours will be revealed with by running ifconfig in konsole or in KInfocenter under Network Information > Network Interfaces

    Next, I enabled systemd-networkd:
    Code:
    sudo systemctl unmask systemd-networkd.service
    sudo systemctl enable systemd-networkd.service
    sudo systemctl start systemd-networkd.service
    And finally, applied the netplan changes
    Code:
    sudo netplan apply
    and rebooted.

    On reboot, it took 30 or more seconds longer than usual, but booted up. I knew something was up, so I ran systemd-analyze blame again and BOTH networkManager and systemd-networkd launched. I don't know why this happened because as far as I know, the first set of commands above should have prevented it from launching. I threw caution to the wind and purged the NetworkManager packages (3 of them), held my breath (not really) and rebooted.

    This time, I had the fastest boot I'd seen in a long time and I was network connected. Success!

    Please Read Me

    #2
    I just tried it. Switching to systemd-networkd that is.
    I did it after reading the other thread, so I followed the instructions on this page. *

    Well, like osnluvr had, before I had:

    7.202s NetworkManager-wait-online.service
    2.005s dev-sdc2.device


    and after I had:

    5.544s systemd-networkd-wait-online.service
    5.009s NetworkManager-wait-online.service
    1.889s dev-sdc2.device

    Click image for larger version

Name:	arrabbiato1.gif
Views:	12
Size:	525 Bytes
ID:	644678

    So, should I throw caution to the wind and purge the NetworkManager packages (3 of them)? Er... which ones? ;·)

    -
    * The page contains an error: $ sudo systemctl start systems-resolved should (obviously) be: $ sudo systemctl start systemd-resolved

    Comment


      #3
      The history from apt:

      Purge: network-manager-pptp:amd64 (1.2.6-1), plasma-nm:amd64 (4:5.18.4.1-0xneon+18.04+bionic+build54), network-manager:amd64 (1.10.14-0ubuntu2)

      so I purged:

      network-manager-pptp
      plasma-nm
      network-manager

      I entered "sudo apt purge network-manager" and the other two were auto-removed at the same time

      Please Read Me

      Comment


        #4
        Perfect. It did just that.

        The following packages will be REMOVED:
        network-manager* network-manager-pptp* plasma-nm*

        After which:

        4.951s systemd-networkd-wait-online.service
        1.535s udisks2.service
        1.285s dev-sdc2.device
        1.008s mysql.service
        978ms accounts-daemon.service
        950ms ModemManager.service
        893ms postfix@-.service

        Comment


          #5
          Great. IDK why systemd isn't killing the service like it's supposed to. There must be a step I left out. I was a bit nervous to remove it completely like that, but I could reinstall it if I had to.

          Please Read Me

          Comment


            #6
            I have NetworkManager running and use it.

            Click image for larger version

Name:	Screenshot_20200501_110725.jpg
Views:	1
Size:	67.1 KB
ID:	644679

            $ systemd-analyze
            Startup finished in 2.726s (kernel) + 8.384s (userspace) = 11.110s
            graphical.target reached after 8.374s in userspace


            Here is my blame listing:
            Code:
            $ systemd-analyze blame
            6.531s NetworkManager-wait-online.service                                                       
            1.624s [COLOR=#ff0000]man-db.service    [/COLOR]                                                                       
             916ms [COLOR=#ff0000]smartmontools.service[/COLOR]                                                                    
             689ms systemd-logind.service                                                                   
             545ms [COLOR=#ff0000]snapper-boot.service   [/COLOR]                                                                  
             516ms dev-sda1.device                                                                          
             510ms udisks2.service                                                                          
             486ms systemd-resolved.service                                                                 
             482ms upower.service                                                                           
             459ms networkd-dispatcher.service                                                              
             424ms systemd-journald.service                                                                 
             414ms systemd-timesyncd.service                                                                
             413ms logrotate.service                                                                        
             407ms systemd-machined.service                                                                 
             383ms accounts-daemon.service                                                                  
             337ms gpu-manager.service                                                                      
             303ms systemd-fsck@dev-disk-by\x2duuid-ce2b5741\x2dc01e\x2d4b3d\x2db6ba\x2d401ad7f7fcdf.service
            ...skipping...
              14ms systemd-sysctl.service                                                                   
              13ms sys-kernel-tracing.mount                                                                 
              12ms systemd-tmpfiles-setup-dev.service                                                       
              12ms plymouth-read-write.service                                                              
              11ms blk-availability.service                                                                 
              10ms systemd-remount-fs.service                                                               
              10ms systemd-random-seed.service                                                              
              10ms kmod-static-nodes.service                                                                
               8ms systemd-backlight@backlight:intel_backlight.service                                      
               8ms systemd-user-sessions.service                                                            
               7ms systemd-update-utmp-runlevel.service                                                     
               7ms console-setup.service                                                                    
               5ms home.mount                                                                               
               5ms ufw.service                                                                              
               4ms sys-fs-fuse-connections.mount                                                            
               4ms sddm.service                                                                             
               3ms sys-kernel-config.mount
            The ones highlighted in red are those services I've added since my last blame reading gave me a 5.1 sec user space load time.
            Last edited by GreyGeek; May 01, 2020, 10:20 AM.
            "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
            – John F. Kennedy, February 26, 1962.

            Comment


              #7
              Yeah, well, so did we

              Comment


                #8
                I am using DHCP. I used a slightly different method than oshunluvr's. See post #2.

                Comment


                  #9
                  Ya, I posted a stupid question and deleted it.
                  I have a Hurricane IPv6 tunnel. I used a systemd unit to create and run it.
                  It would be interesting to see if any conflicts arise.
                  Still contemplating...
                  "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                  – John F. Kennedy, February 26, 1962.

                  Comment


                    #10
                    Unrelated to this post, but I'm amazed how much snap adds to boot time. 16 entries in systemd-analyze blame for a total of 5.60152 seconds.

                    Please Read Me

                    Comment


                      #11
                      Also, removing NM resulted in 15 other packages to go to "no longer required" status.
                      dns-root-data dnsmasq-base iputils-arping libkf5modemmanagerqt6 libkf5wallet-bin libndp0 libnm0 libopenconnect5 libstoken1 libteamdctl0 libtomcrypt1 libtommath1 ppp pptp-linux qml-module-org-kde-prison

                      Please Read Me

                      Comment


                        #12
                        Originally posted by oshunluvr View Post
                        Unrelated to this post, but I'm amazed how much snap adds to boot time. 16 entries in systemd-analyze blame for a total of 5.60152 seconds.
                        I'm not
                        See this post, from Jul 24th...

                        Code:
                        ~$ systemd-analyze blame | head -n 20
                              12.054s NetworkManager-wait-online.service
                               3.683s dev-sdb1.device
                               2.455s systemd-journal-flush.service
                               1.813s dev-loop10.device
                               1.811s dev-loop8.device
                               1.809s dev-loop9.device
                               1.636s dev-loop4.device
                               1.613s dev-loop5.device
                               1.601s dev-loop7.device
                               1.597s dev-loop6.device
                               1.594s dev-loop3.device
                               1.546s dev-loop2.device
                               1.535s dev-loop1.device
                               1.528s dev-loop0.device
                               1.316s snapd.service
                               1.042s udisks2.service
                                546ms systemd-udev-trigger.service
                                478ms NetworkManager.service
                                412ms upower.service
                                383ms networkd-dispatcher.service

                        Comment


                          #13
                          Yikes. Forgot about those. Add another 2.191 seconds.

                          Please Read Me

                          Comment


                            #14
                            stuart@office:/var/log/apt$ systemd-analyze blame |grep 'loop\|snap'
                            1.120s snapd.service
                            445ms snap-gnome\x2d3\x2d28\x2d1804-116.mount
                            417ms snap-discord-109.mount
                            415ms snap-core-9066.mount
                            405ms snap-shotcut-64.mount
                            375ms snap-gtk\x2dcommon\x2dthemes-1506.mount
                            363ms snap-core18-1754.mount
                            363ms dev-loop2.device
                            328ms snap-gtk\x2dcommon\x2dthemes-1502.mount
                            327ms snap-discord-108.mount
                            327ms snap-gnome\x2d3\x2d26\x2d1604-98.mount
                            326ms snap-vobsub2srt-19.mount
                            324ms snap-core18-1705.mount
                            295ms dev-loop3.device
                            293ms dev-loop4.device
                            285ms snap-shotcut-61.mount
                            219ms dev-loop0.device
                            173ms dev-loop1.device
                            163ms dev-loop6.device
                            143ms dev-loop7.device
                            130ms snap-core-8935.mount
                            127ms dev-loop5.device
                            113ms dev-loop9.device
                            111ms dev-loop8.device
                            75ms dev-loop11.device
                            71ms dev-loop10.device
                            45ms dev-loop12.device
                            14ms snapd.seeded.service
                            523us snapd.socket


                            7.79252 seconds
                            Last edited by oshunluvr; May 01, 2020, 11:07 AM.

                            Please Read Me

                            Comment


                              #15
                              Indeed. That's why I purged snapd and chromium, disabled the loops, located the mount points of the loops and removed them.
                              "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                              – John F. Kennedy, February 26, 1962.

                              Comment

                              Working...
                              X