You are not logged in.

#1 2012-08-02 18:53:41

Lennie
Member
From: Sweden
Registered: 2011-10-12
Posts: 146

[Solved] Systemd: dhcpcd causes slow boot

I have migrated to pure systemd, no mix with sysvinit, rc.conf is commented out. Big disappointment, the boot is slower than with sysvinit...

$ systemd-analyze
Startup finished in 6544ms (kernel) + 8446ms (userspace) = 14990ms

$ systemd-analyze blame
 6435ms dhcpcd@eth0.service

With sysvinit it takes less than 12 s from that I press enter in grub menu, until Slim login-screen. The problem with systemd is that it waits for the network to be up before it lets me login. Sysvinit didn't wait for that, and I had to put dropbox and conky (because of paconky) to sleep a few seconds. And I'd prefer that.

Is there a way to get systemd to continue, and let me login, without waiting for network to be up?

Last edited by Lennie (2012-08-03 18:33:34)

Offline

#2 2012-08-02 19:04:04

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [Solved] Systemd: dhcpcd causes slow boot

I dont use systemd, but since updating last night my 10-network.rules is being ignored and the wrong eth is trying to get a lease (which takes longer).


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#3 2012-08-03 07:03:00

Lennie
Member
From: Sweden
Registered: 2011-10-12
Posts: 146

Re: [Solved] Systemd: dhcpcd causes slow boot

In systemd one specifies which eth should be used, in the name of the symlink, dhcpcd@eth0.service, and that is correct. I don't think it takes longer than to start the network daemon in sysvinit. What takes time is that the boot stops and wait for it.

I tried to use static ip although my router uses dhcp. I couldn't find anywhere to change this in the router. I always get the same ip. But it didn't work, no internet connection. But without internet service I get the exact same boot time as with sysvinit, 11.91 s from grub to Slim,  systemd-analyze: Startup finished in 6474ms (kernel) + 2531ms (userspace) = 9006ms

So if that's the best boot time I can get with systemd, and that's without internet - then I for sure go back to sysvinit. Now I have tried it out myself.

My daemons array, as a comparision:
#DAEMONS=(@syslog-ng @hwclock @network dbus @vnstat @alsa @cupsd @crond slim)

Offline

#4 2012-08-03 12:03:52

89c51
Member
Registered: 2012-06-05
Posts: 741

Re: [Solved] Systemd: dhcpcd causes slow boot

You can try NetworkManager. At least on my system it "behaved" better.

Also there is an optimization guide (http://freedesktop.org/wiki/Software/sy … imizations) you might want to read. I am not sure you can apply everything in it but might make a difference in your boot times.

Offline

#5 2012-08-03 14:41:29

andy_v
Member
From: Estonia
Registered: 2012-04-27
Posts: 31

Re: [Solved] Systemd: dhcpcd causes slow boot

Your /etc/resolv.conf file was probably blank. Dhcpcd usually writes DNS related information to said file, but when configuring your machine to use a static ip address, one needs to edit the resolv.conf file manually. You need to point it to your router, since it (most likely) handles and forwards your DNS queries. You had a semi-wroking internet connection where your browser couldn't find 'http://www.google.com', but it would have worked with 'http://ip_address_of_google'. If that happens again, cat your /etc/resolv.conf file, if it's empty, add 'nameserver ip_address_of_your_router' and restart your network service (# systemctl restart network.service).

Offline

#6 2012-08-03 15:48:51

Lennie
Member
From: Sweden
Registered: 2011-10-12
Posts: 146

Re: [Solved] Systemd: dhcpcd causes slow boot

Thanks. Networkmanager is definately better.

$ systemd-analyze 
Startup finished in 6837ms (kernel) + 3462ms (userspace) = 10300ms

Then network is up when I log in. But still 1s slower than the initscripts... It's not much, but it's the principle.

I just checked /etc/resolv.conf on my other Arch partition, and yes it's empty. (Strange that it's under /etc and not /run.) I'll give it another try with static ip and see if it works.

Offline

#7 2012-08-03 16:53:09

Lennie
Member
From: Sweden
Registered: 2011-10-12
Posts: 146

Re: [Solved] Systemd: dhcpcd causes slow boot

Hm, strange. I tried again with static ip, but I didn't change anything from last time I tried it. This time it worked:

$ systemd-analyze 
Startup finished in 6485ms (kernel) + 2507ms (userspace) = 8993ms

This is actually a little faster than with initscripts.
First I rebooted to my other Arch partition (I made backup to another partition for this experiment.), just to check /etc/resolv.conf on the systemd-partition, when it's not up. It was not empty:

$ cat /etc/resolv.conf 
# Generated by resolvconf
domain lan
nameserver 192.168.1.1

Now when I checked my "initscript-Arch"-partition, /etc/resolv.conf was still there. Sometimes it gets deleted at shutdown, and sometimes not... Is there a way to make sure it's not deleted?

Offline

#8 2012-08-03 18:01:44

andy_v
Member
From: Estonia
Registered: 2012-04-27
Posts: 31

Re: [Solved] Systemd: dhcpcd causes slow boot

My guess is that upon invocation dhcpcd and NetworkManager create a resolv.conf file based on the information they get from the dhcp server, upon exit they re-create an empty (well, actually with simple comments on how to edit the file) resolv.conf. That's why it was empty the first time you tried it and that's exactly what happend to me. After editing it manually though its contents should not change under normal circumstances. If for some reason they do, you could try the resolv.conf.head approach.

Offline

#9 2012-08-03 18:32:50

Lennie
Member
From: Sweden
Registered: 2011-10-12
Posts: 146

Re: [Solved] Systemd: dhcpcd causes slow boot

Thanks. I did:

chattr +i /etc/resolv.conf

So now no-one can overwrite it. I also uninstalled networkmanager and dhcpcd.

I guess I can mark this thread as solved now. Boot time is approximately the same with systemd and initscripts, It's not the exact  same every time i boot, it varies +/- 1 sec.

I haven't decided yet if I want to continue to use systemd. My impression so far is that I get much less control over what services are started and run in the background. I will read more about it before I decide what to use. My original Arch with initscripts, as from yesterday, is only a reboot away...

Offline

#10 2012-08-03 18:57:29

89c51
Member
Registered: 2012-06-05
Posts: 741

Re: [Solved] Systemd: dhcpcd causes slow boot

Try readahead if you are not. It might improve it further.

Offline

Board footer

Powered by FluxBB