You are not logged in.

#1 2016-12-03 11:56:23

FlowIt
Member
Registered: 2014-10-25
Posts: 239

[Solved] dhcpcd@.service slower than dhcpcd.service

I tried both

systemctl enable dhcpcd.servicee

and

systemctl enable dhcpcd@eth0.service

to bring my wired interface up at boot. The general service for all interfaces is significantly faster looking at systemd-analyze blame. (Signifcantly here means 1 to 2 seconds, which sounds not so much but for dhcpcd.service its only a couple milliseconds) However, if I ever want to switch to a wireless connection using netctl I have to bring my wireless interface down first.
So how comes that dhcpcd@.service is so much slower? It only has to work on a single interface.

Last edited by FlowIt (2016-12-05 12:20:00)

Offline

#2 2016-12-03 12:27:59

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,444
Website

Re: [Solved] dhcpcd@.service slower than dhcpcd.service

It has to work on a single interface, yes.  But why eth0?  I can't help but suspect that systemd might have to wait for your wired interface to be renamed eth0.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2016-12-03 12:53:02

FlowIt
Member
Registered: 2014-10-25
Posts: 239

Re: [Solved] dhcpcd@.service slower than dhcpcd.service

Because my interface is called eth0. Reading through https://wiki.archlinux.org/index.php/Ne … vice_names I don't see much help there. I don't have any udev rules active. My interfaces are not renamed by systemd (otherwise they would we called enpXXX).
Here a dmesg | grep eth0

[    8.238911] r8169 0000:02:00.0 eth0: RTL8168evl/8111evl at 0xffffc90000772000, e8:11:32:6c:9e:77, XID 0c900800 IRQ 28
[    8.238917] r8169 0000:02:00.0 eth0: jumbo features [frames: 9200 bytes, tx checksumming: ko]
[   11.155551] r8169 0000:02:00.0 eth0: link down
[   11.155559] r8169 0000:02:00.0 eth0: link down
[   11.155632] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[   13.002641] r8169 0000:02:00.0 eth0: link up
[   13.002661] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

What can I do to check if your suspicions are correct or not?

Offline

#4 2016-12-03 13:11:36

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,680
Website

Re: [Solved] dhcpcd@.service slower than dhcpcd.service

FlowIt wrote:

My interfaces are not renamed by systemd

Do you have net.ifnames=0 as a kernel command line parameter?

cat /proc/cmdline

Is udev's interface name .link file masked?

ls -l /etc/systemd/network/99-default.link

Do you have any .link files in /etc/systemd/network/?

See systemd.link(5) & https://www.freedesktop.org/wiki/Softwa … faceNames/ for more on this.

Also, what does the journal say?

journalctl -u dhcpcd@eth0.service

Offline

#5 2016-12-03 13:15:43

shulamy
Member
From: israel
Registered: 2010-09-11
Posts: 453

Re: [Solved] dhcpcd@.service slower than dhcpcd.service

you can see it waits 2 seconds for eth0 to be ready  but not why.

and why the other option doesn't wait.

ezik

Offline

#6 2016-12-03 13:19:56

FlowIt
Member
Registered: 2014-10-25
Posts: 239

Re: [Solved] dhcpcd@.service slower than dhcpcd.service

net.ifnames=0 is not set and /etc/systemd/network is completly empty. The journal says:

Dec 03 12:45:27 me systemd[1]: Starting dhcpcd on eth0...
Dec 03 12:45:28 me dhcpcd[275]: eth0: waiting for carrier
Dec 03 12:45:29 me dhcpcd[275]: eth0: carrier acquired
Dec 03 12:45:29 me dhcpcd[275]: eth0: adding address fe80::d003:9a10:8f4:f4fe
Dec 03 12:45:29 me dhcpcd[275]: DUID 00:01:00:01:1b:ec:16:f0:e8:11:32:6c:9e:77
Dec 03 12:45:29 me dhcpcd[275]: eth0: IAID 32:6c:9e:77
Dec 03 12:45:30 me dhcpcd[275]: eth0: rebinding lease of 192.168.178.30
Dec 03 12:45:30 me dhcpcd[275]: eth0: soliciting an IPv6 router
Dec 03 12:45:30 me dhcpcd[275]: eth0: probing address 192.168.178.30/24
Dec 03 12:45:30 me dhcpcd[275]: eth0: Router Advertisement from fe80::3681:c4ff:fef2:49ee
Dec 03 12:45:30 me dhcpcd[275]: eth0: adding address 2003:72:2d7c:7100:3d18:12ce:92de:cd86/64
Dec 03 12:45:30 me dhcpcd[275]: eth0: adding route to 2003:72:2d7c:7100::/64
Dec 03 12:45:30 me dhcpcd[275]: eth0: adding default route via fe80::3681:c4ff:fef2:49ee
Dec 03 12:45:30 me dhcpcd[275]: eth0: requesting DHCPv6 information
Dec 03 12:45:32 me systemd[1]: Started dhcpcd on eth0.
Dec 03 12:45:35 me dhcpcd[372]: eth0: leased 192.168.178.30 for 864000 seconds
Dec 03 12:45:35 me dhcpcd[372]: eth0: adding route to 192.168.178.0/24
Dec 03 12:45:35 me dhcpcd[372]: eth0: adding default route via 192.168.178.1

Offline

#7 2016-12-03 13:27:28

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,680
Website

Re: [Solved] dhcpcd@.service slower than dhcpcd.service

Is there a symlink at /etc/systemd/network/99-default.link? Sorry, you already answered that.

That interface should not be called eth0 unless it was set up that way.

I don't mean this to sound accusatory in any way but can we please see the output of:

uname -a

Last edited by Head_on_a_Stick (2016-12-03 13:27:53)

Offline

#8 2016-12-03 13:33:50

FlowIt
Member
Registered: 2014-10-25
Posts: 239

Re: [Solved] dhcpcd@.service slower than dhcpcd.service

That interface should not be called eth0 unless it was set up that way.

Why not the other way around? Is this the default Arch Linux configuration? From what I understand, eth0 is the original interface name (but not reliable, hence the systemd renaming).
The system is up-to-date via pacman -Syu, no AUR packages. uname -a

Linux me 4.8.11-1-ARCH #1 SMP PREEMPT Sun Nov 27 09:26:14 CET 2016 x86_64 GNU/Linux

Offline

#9 2016-12-04 21:10:47

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,680
Website

Re: [Solved] dhcpcd@.service slower than dhcpcd.service

FlowIt wrote:

Is this the default Arch Linux configuration?

Yes, in a stock Arch installation the kernel will assign the interface names which will subsequently be renamed by systemd; further user configuration must be performed to change this behaviour.

I have no idea why systemd is not renaming the interface in your case but it may be related to the delay you experience.

You could try enabling dhcpcd@.service for the "predictable" interface name that should have been generated for your card -- use `lspci` to obtain the bus addresses that constitute the newer nomenclature.

For example, on my system the wireless card is:

02:00.0 Network controller: Intel Corporation Centrino Wireless-N 135 (rev c4)

So the interface name is wlp2s0 wink

Offline

#10 2016-12-05 12:19:17

FlowIt
Member
Registered: 2014-10-25
Posts: 239

Re: [Solved] dhcpcd@.service slower than dhcpcd.service

The reason why I don't have those predictable names is that I removed that functionality from the systemd package. Don't ask me why, it was a long time ago. Probably because I thought the respective files were related to system-networkd, which I disabled in the build. I never experienced any issues after the removal so I thought I was correct in my assumption.
But it has nothing to do with the delay. I looked at differenced between dhcpcd.service and dhcpcd@.service and found these lines:

ExecStart=/usr/bin/dhcpcd -q -w %I

in the dhcpcd@.service file and

ExecStart=/usr/bin/dhcpcd -q -b

in the dhcpcd.service file.
Note the difference in the options. -b forks immediately to the background, -w waits until an address is assigned. I changed the dhcpcd@.service file to use -b instead and now the delay is gone.
However, there might be good reasons why the files are distributed with these options. But when I login, wait for my DE to come up, wait for a terminal to start - this time is enough that an address is assigned so at least for my setup this change works fine. SoI'll mark this as solved.

Offline

#11 2016-12-05 12:56:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,444
Website

Re: [Solved] dhcpcd@.service slower than dhcpcd.service

If you use your own versions of such essential components as the init system, please be sure to note that at the start of any help thread - it will prevent a lot of confusion and wasted effort.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB