# Help with systemd, NetworkManager and dhclient (SOLVED)

## raddaqii

Just posting this because I am happy to have found a valuable hint over at Archlinux that helped with systemd, NetworkManager and dhclient. That was, emotionally, an important bit in switching over to systemd, making networking reliable. Before I had wonky inconcistencies with the network.

Then, systemd's journalctl -f was reporting this over and over, not very useful:

```

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> Auto-activating connection 'mylan'.

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> Activation (enp4s0) starting connection 'mylan'

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> (enp4s0): device state change: disconnected -> prepare (reason 'none') [30 40 0]

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> NetworkManager state is now CONNECTING

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> Activation (enp4s0) Stage 1 of 5 (Device Prepare) scheduled...

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> Activation (enp4s0) Stage 1 of 5 (Device Prepare) started...

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> Activation (enp4s0) Stage 2 of 5 (Device Configure) scheduled...

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> Activation (enp4s0) Stage 1 of 5 (Device Prepare) complete.

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> Activation (enp4s0) Stage 2 of 5 (Device Configure) starting...

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> (enp4s0): device state change: prepare -> config (reason 'none') [40 50 0]

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> Activation (enp4s0) Stage 2 of 5 (Device Configure) successful.

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> Activation (enp4s0) Stage 3 of 5 (IP Configure Start) scheduled.

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> Activation (enp4s0) Stage 2 of 5 (Device Configure) complete.

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> Activation (enp4s0) Stage 3 of 5 (IP Configure Start) started...

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> (enp4s0): device state change: config -> ip-config (reason 'none') [50 70 0]

Okt 16 10:50:42 beetham NetworkManager[2697]: client_start: assertion `priv->client_type != 0' failed

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> (enp4s0): device state change: ip-config -> failed (reason 'dhcp-start-fa...20 15]

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> NetworkManager state is now DISCONNECTED

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> Marking connection 'mylan' invalid.

Okt 16 10:50:42 beetham NetworkManager[2697]: <warn> Activation (enp4s0) failed for connection 'mylan'

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> Activation (enp4s0) Stage 3 of 5 (IP Configure Start) complete.

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> (enp4s0): device state change: failed -> disconnected (reason 'none') [120 30 0]

Okt 16 10:50:42 beetham NetworkManager[2697]: <info> (enp4s0): deactivating device (reason 'none') [0]

Okt 16 10:50:42 beetham /etc/gdm/Xsession[4811]: ** (nm-applet:4973): WARNING **: async_got_type: could not read properties fo... exist

Okt 16 10:50:42 beetham /etc/gdm/Xsession[4811]: ** (nm-applet:4973): WARNING **: Could not create object for /org/freedesktop... exist

Okt 16 10:52:17 beetham systemd[1]: Accepted connection on private bus.

Okt 16 10:52:17 beetham systemd[1]: Running GC...

Okt 16 10:52:17 beetham systemd[1]: Got D-Bus request: org.freedesktop.systemd1.Manager.RestartUnit() on /org/freedesktop/systemd1

Okt 16 10:52:17 beetham systemd[1]: Trying to enqueue job NetworkManager.service/restart/replace

Okt 16 10:52:17 beetham systemd[1]: Installed new job NetworkManager.service/restart as 608

Okt 16 10:52:17 beetham systemd[1]: Installed new job NetworkManager-wait-online.service/restart as 672

Okt 16 10:52:17 beetham systemd[1]: Enqueued job NetworkManager.service/restart as 608

Okt 16 10:52:17 beetham systemd[1]: Job NetworkManager-wait-online.service/restart finished, result=done

Okt 16 10:52:17 beetham systemd[1]: Converting job NetworkManager-wait-online.service/restart -> NetworkManager-wait-online.s...e/start

Okt 16 10:52:17 beetham systemd[1]: Stopping Network Manager...

Okt 16 10:52:17 beetham systemd[1]: NetworkManager.service changed running -> stop-sigterm

Okt 16 10:52:17 beetham systemd[1]: Set up jobs progress timerfd.

Okt 16 10:52:17 beetham systemd[1]: Got D-Bus request: org.freedesktop.systemd1.Manager.GetUnit() on /org/freedesktop/systemd1

Okt 16 10:52:17 beetham NetworkManager[2697]: <info> caught signal 15, shutting down normally.

Okt 16 10:52:17 beetham NetworkManager[2697]: <info> (enp4s0): device state change: disconnected -> unmanaged (reason 'removed...10 36]

Okt 16 10:52:17 beetham NetworkManager[2697]: <info> (enp4s0): cleaning up...

Okt 16 10:52:17 beetham NetworkManager[2697]: <info> (enp4s0): taking down device.

Okt 16 10:52:17 beetham systemd[1]: Got D-Bus request: org.freedesktop.DBus.Properties.Get() on /org/freedesktop/systemd1/uni...service

Okt 16 10:52:17 beetham kernel: tg3 0000:04:00.0: System wakeup enabled by ACPI

Okt 16 10:52:17 beetham dhclient[5316]: receive_packet failed on enp4s0: Network is down

Okt 16 10:52:17 beetham dhclient[5693]: receive_packet failed on enp4s0: Network is down

Okt 16 10:52:17 beetham NetworkManager[2697]: <info> exiting (success)

```

And never got me a stable connection, so temporarily I reverted to manually issueing "dhclient enp4s0" all the time, like every 2 minutes. Urgh. Using the ON button in the NetworkManager gui made the button switch back to OFF immediately.

I understood that basically systemd (albeit weakly) implies the use of net-misc/dhcp instead of net-misc/dhcpcd, I noticed I had gone only half the way, only setting this:

```

# echo "net-misc/networkmanager -dhcpcd dhclient" >> /etc/portage/package.keywords/net-misc" 

```

then rebuild net-misc/networkmanager . Necessary, but not sufficient. Next, followed some advice from http://wiki.gentoo.org/wiki/NetworkManager, especially making sure rc-update starts no network services and interfaces except net.lo: 

```

# rc-update add NetworkManager default

# rc-update del net.enp4s0 default

# rc-update del net.wlp2s0 default

# systemctl disable dhcpcd.service

# systemctl disable dhcpd.service

# systemctl enable NetworkManager.service

# systemctl start NetworkManager.service

```

So... I found this forum hint over at Archlinux, and finally, to get it stable I had to change /etc/NetworkManager/NetworkManager.conf manually, switching one line top make it use dhclient instead of expecting dhcpcd:

```

[main]

plugins=ifnet,keyfile

plugins=keyfile

- dhcp=dhcpcd

+ dhcp=dhclient

no-auto-default=20:6x:8x:6x:4x:3x,

[logging]

#level=DEBUG

#domains=AGENTS,SETTINGS,SUSPEND

[ifnet]

managed=true

auto_refresh=false 

```

Before that last config change I had to run dhclient manually like every 2 minutes or so, since it would lose the dhcp lease, even though that had not expired. Whatever, now it works.  :Very Happy: 

Thought I'd share this.

----------

## aahamlin

 *raddaqii wrote:*   

> Just posting this because I am happy to have found a valuable hint over at Archlinux that helped with systemd, NetworkManager and dhclient. That was, emotionally, an important bit in switching over to systemd, making networking reliable. Before I had wonky inconcistencies with the network.
> 
> Thought I'd share this.

 

Thanks for sharing!   I just did world update on Fri to Gnome 3.8 and it pulled in systemd. It as a moment of carelessness really, I would have preferred to stick with Gnome 2 and openRC just because everything was working and stable... but once I stumbled down this path I figured it was easier to go to the end than undo everything.

With other posts and wiki docs on systemd I got everything working except for my wireless connection. I saw that NetworkManager docs mentioned searching for dhclient before dhcpcd and found your post when searching for what portage package contained dhclient. Anyway, followed your steps, rebooted and everything is working perfectly! Thanks again.

My errors were a little different, still pointed to dhcpcd being unable to obtain lease info for some reason.  Here is some of my log from journalctl for the time period I was still having errors, if it helps anyone else find this post.

```

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) starting connection 'Auto 2WIRE571'

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: disconnected -> prepare (reason 'none') [30 40 0]

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 1 of 5 (Device Prepare) scheduled...

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 1 of 5 (Device Prepare) started...

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 2 of 5 (Device Configure) scheduled...

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 1 of 5 (Device Prepare) complete.

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 2 of 5 (Device Configure) starting...

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: prepare -> config (reason 'none') [40 50 0]

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3/wireless): access point 'Auto 2WIRE571' has security, but secrets are required.

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: config -> need-auth (reason 'none') [50 60 0]

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 2 of 5 (Device Configure) complete.

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 1 of 5 (Device Prepare) scheduled...

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 1 of 5 (Device Prepare) started...

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: need-auth -> prepare (reason 'none') [60 40 0]

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 2 of 5 (Device Configure) scheduled...

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 1 of 5 (Device Prepare) complete.

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 2 of 5 (Device Configure) starting...

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: prepare -> config (reason 'none') [40 50 0]

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3/wireless): connection 'Auto 2WIRE571' has security, and secrets exist.  No new secrets needed.

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 2 of 5 (Device Configure) complete.

Dec 14 20:17:08 localhost NetworkManager[1778]: <info> (enp0s29u1u3): supplicant interface state: disconnected -> scanning

Dec 14 20:17:18 localhost NetworkManager[1778]: <info> (enp0s29u1u3): supplicant interface state: scanning -> associating

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> (enp0s29u1u3): supplicant interface state: associating -> associated

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> (enp0s29u1u3): supplicant interface state: associated -> 4-way handshake

Dec 14 20:17:19 localhost dhcpcd[1777]: enp0s29u1u3: carrier acquired

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> (enp0s29u1u3): supplicant interface state: 4-way handshake -> completed

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3/wireless) Stage 2 of 5 (Device Configure) successful.  Connected to wireless network '2WIRE571'.

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 3 of 5 (IP Configure Start) scheduled.

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 3 of 5 (IP Configure Start) started...

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: config -> ip-config (reason 'none') [50 70 0]

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Beginning DHCPv4 transaction (timeout in 45 seconds)

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 3 of 5 (IP Configure Start) complete.

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> (enp0s29u1u3): DHCPv4 client pid 3844 exited with status 0

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 4 of 5 (IPv4 Configure Timeout) scheduled...

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 4 of 5 (IPv4 Configure Timeout) started...

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: ip-config -> failed (reason 'ip-config-unavailable') [70 120 5]

Dec 14 20:17:19 localhost NetworkManager[1778]: <warn> Activation (enp0s29u1u3) failed for connection 'Auto 2WIRE571'

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 4 of 5 (IPv4 Configure Timeout) complete.

Dec 14 20:17:19 localhost dhcpcd[1777]: enp0s29u1u3: sending IPv6 Router Solicitation

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: failed -> disconnected (reason 'none') [120 30 0]

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> (enp0s29u1u3): deactivating device (reason 'none') [0]

Dec 14 20:17:19 localhost dhcpcd[1777]: enp0s29u1u3: checking for 169.254.35.235

Dec 14 20:17:19 localhost dhcpcd[1777]: control command: /sbin/dhcpcd -B -K -L -G -c /usr/libexec/nm-dhcp-client.action enp0s29u1u3

Dec 14 20:17:19 localhost dhcpcd[1777]: enp0s29u1u3: carrier lost

Dec 14 20:17:19 localhost NetworkManager[1778]: <info> (enp0s29u1u3): supplicant interface state: completed -> disconnected

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) starting connection 'Auto 2WIRE571'

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: disconnected -> prepare (reason 'none') [30 40 0]

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 1 of 5 (Device Prepare) scheduled...

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 1 of 5 (Device Prepare) started...

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 2 of 5 (Device Configure) scheduled...

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 1 of 5 (Device Prepare) complete.

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 2 of 5 (Device Configure) starting...

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: prepare -> config (reason 'none') [40 50 0]

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3/wireless): access point 'Auto 2WIRE571' has security, but secrets are required.

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: config -> need-auth (reason 'none') [50 60 0]

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 2 of 5 (Device Configure) complete.

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 1 of 5 (Device Prepare) scheduled...

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 1 of 5 (Device Prepare) started...

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: need-auth -> prepare (reason 'none') [60 40 0]

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 2 of 5 (Device Configure) scheduled...

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 1 of 5 (Device Prepare) complete.

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 2 of 5 (Device Configure) starting...

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: prepare -> config (reason 'none') [40 50 0]

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3/wireless): connection 'Auto 2WIRE571' has security, and secrets exist.  No new secrets needed.

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 2 of 5 (Device Configure) complete.

Dec 14 20:17:26 localhost NetworkManager[1778]: <info> (enp0s29u1u3): supplicant interface state: disconnected -> scanning

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> (enp0s29u1u3): supplicant interface state: scanning -> associating

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> (enp0s29u1u3): supplicant interface state: associating -> associated

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> (enp0s29u1u3): supplicant interface state: associated -> 4-way handshake

Dec 14 20:17:36 localhost dhcpcd[1777]: enp0s29u1u3: carrier acquired

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> (enp0s29u1u3): supplicant interface state: 4-way handshake -> completed

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3/wireless) Stage 2 of 5 (Device Configure) successful.  Connected to wireless network '2WIRE571'.

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 3 of 5 (IP Configure Start) scheduled.

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 3 of 5 (IP Configure Start) started...

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: config -> ip-config (reason 'none') [50 70 0]

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Beginning DHCPv4 transaction (timeout in 45 seconds)

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 3 of 5 (IP Configure Start) complete.

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> (enp0s29u1u3): DHCPv4 client pid 3909 exited with status 0

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 4 of 5 (IPv4 Configure Timeout) scheduled...

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 4 of 5 (IPv4 Configure Timeout) started...

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: ip-config -> failed (reason 'ip-config-unavailable') [70 120 5]

Dec 14 20:17:36 localhost NetworkManager[1778]: <warn> Activation (enp0s29u1u3) failed for connection 'Auto 2WIRE571'

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> Activation (enp0s29u1u3) Stage 4 of 5 (IPv4 Configure Timeout) complete.

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> (enp0s29u1u3): device state change: failed -> disconnected (reason 'none') [120 30 0]

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> (enp0s29u1u3): deactivating device (reason 'none') [0]

Dec 14 20:17:36 localhost dhcpcd[1777]: enp0s29u1u3: carrier lost

Dec 14 20:17:36 localhost NetworkManager[1778]: <info> (enp0s29u1u3): supplicant interface state: completed -> disconnected

Dec 14 20:17:36 localhost dhcpcd[1777]: enp0s29u1u3: waiting for carrier

Dec 14 20:17:36 localhost dhcpcd[1777]: control command: /sbin/dhcpcd -B -K -L -G -c /usr/libexec/nm-dhcp-client.action enp0s29u1u3

```

Oh, one more thing...   The docs I have read from Gentoo wiki and Gnome 3.8 upgrade guide suggest removing the ifnet plugin from NetworkManager because it may cause problems/have incompatibilities. I have done that on my system and can confirm the ifnet plugin is no longer necessary.

----------

