You are not logged in.

#1 2021-05-13 13:44:54

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 318

[SOLVED] Netctl and interface-specific daemons execution order

I have ethernet interfaces with static IP addresses configured by netctl. I noticed error messages in log from dhcpd4 and samba which are configured to bind to certain interfaces:

/etc/dhcpd/lan1.conf:


local-address 192.168.1.254;

dhcpd[22113]: No subnet declaration for lan1 (no IPv4 addresses).

dhcpd[22113]: Not configured to listen on any interfaces!

systemd[1]: dhcpd4@lan1.service: Control process exited, code=exited, status=1/FAILURE
dhcpd[22113]: exiting.
systemd[1]: dhcpd4@lan1.service: Failed with result 'exit-code'.
systemd[1]: Failed to start IPv4 DHCP server on lan1.

/etc/samba/smb.conf:


   interfaces = 192.168.0.1

smbd[22125]: [2021/05/13 15:03:47.978713,  0] ../../source3/lib/interface.c:685(load_interfaces)
smbd[22125]:   WARNING: no network interfaces found

systemd[1]: smb.service: Main process exited, code=dumped, status=6/ABRT
systemd[1]: smb.service: Failed with result 'core-dump'.

After some investigation i found netctl start up later than these daemons, thus interfaces have no yet assigned addresses at daemons startup moment.

I solved the problem by adding "Wants=network.target" to netctl.service:

--- /usr/lib/systemd/system/netctl.service
+++ /etc/systemd/system/netctl.service
@@ -4,2 +4,3 @@
 Before=network.target
+Wants=network.target

Now there are no errors in log, but i'm curious: is it a mistake in netctl.service provided by netctl package or it's my misunderstanding of systemd units execution order?

Last edited by dimich (2021-05-13 15:34:51)

Offline

#2 2021-05-13 14:28:26

seth
Member
Registered: 2012-09-03
Posts: 60,943

Re: [SOLVED] Netctl and interface-specific daemons execution order

man 7 netctl.special wrote:

       netctl-wait-online.service
           When activated, this unit waits for all enabled netctl profiles to come online.
           Enabling this unit causes network-online.target to only be reached once all enabled
           netctl profiles are fully connected. The maximum time, in seconds, to wait for
           profiles can be passed to this unit via TIMEOUT_ONLINE=. The default value is 120. If
           a timeout occurs, the service enters a failed state.

Offline

#3 2021-05-13 15:34:20

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 318

Re: [SOLVED] Netctl and interface-specific daemons execution order

seth wrote:
man 7 netctl.special wrote:

       netctl-wait-online.service

That's exactly what i need. Thank you!
Surprised it's not enabled by default.

Offline

Board footer

Powered by FluxBB