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:
In /etc/netplan/ was 01-network-manager-all.yaml which contained only this:
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:
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:
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:
And finally, applied the netplan changes
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!
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
Code:
# Let NetworkManager manage all devices on this systemnetwork: version: 2 renderer: NetworkManager
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]
Code:
network: version: 2 renderer: networkd ethernets: enp0s31f6: dhcp4: yes
Next, I enabled systemd-networkd:
Code:
sudo systemctl unmask systemd-networkd.service sudo systemctl enable systemd-networkd.service sudo systemctl start systemd-networkd.service
Code:
sudo netplan apply
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!
Comment