You are not logged in.

#1 2015-04-12 08:17:30

xiaoju
Member
Registered: 2015-03-21
Posts: 3

dhcpcd fails when ethernet cable not plugged before boot

Hello,
on my laptop, dhcpcd fails to automatically setup the ethernet connection whenever I plug the ethernet cable *after* booting:
- if I plug the ethernet cable, and *then* boot the laptop, then internet connection works,
- if I plug the ethernet cable *after* booting, then the ethernet connection doesn't work:

ping -c 3 www.baidu.com
ping: unknown host www.baidu.com 

- restarting dhcpcd manually fixes the internet connection:

systemctl restart dhcpcd 

But dhcpcd is supposed to support hotplug out of the box, according to the wiki:
    https://wiki.archlinux.org/index.php/Ne … or_laptops
How can I get the hotplug feature of dhcpcd work for me?
Thanks for support!

Here the outputs of:

systemctl status dhcpcd@eth0.service
dmesg | grep eth0
ip link
ip a
cat /etc/dhcpcd.conf

systemctl status dhcpcd@eth0.service

● dhcpcd@eth0.service - dhcpcd on eth0
   Loaded: loaded (/usr/lib/systemd/system/dhcpcd@.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2015-04-12 14:28:17 CST; 1h 37min ago
  Process: 202 ExecStart=/usr/bin/dhcpcd -q -w %I (code=exited, status=1/FAILURE)

Apr 12 14:27:46 arch dhcpcd[202]: eth0: adding address fe80::5304:a77d:4722:689d
Apr 12 14:27:47 arch dhcpcd[202]: eth0: waiting for carrier
Apr 12 14:28:17 arch dhcpcd[202]: timed out
Apr 12 14:28:17 arch systemd[1]: dhcpcd@eth0.service: control process exited, code=exited status=1
Apr 12 14:28:17 arch systemd[1]: Failed to start dhcpcd on eth0.
Apr 12 14:28:17 arch systemd[1]: Unit dhcpcd@eth0.service entered failed state.
Apr 12 14:28:17 arch systemd[1]: dhcpcd@eth0.service failed.

dmesg | grep eth0

[   10.340773] b44 ssb0:0 eth0: Broadcom 44xx/47xx 10/100 PCI ethernet driver 00:18:8b:bb:d0:9d
[   12.068174] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[  190.336966] b44 ssb0:0 eth0: Link is up at 100 Mbps, full duplex
[  190.336977] b44 ssb0:0 eth0: Flow control is off for TX and off for RX
[  190.337120] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready

ip link (before plugging in the eth0 cable)

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: wlp12s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:19:d2:8f:8e:28 brd ff:ff:ff:ff:ff:ff
3: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:18:8b:bb:d0:9d brd ff:ff:ff:ff:ff:ff

ip link (after plugging in)

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: wlp12s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:19:d2:8f:8e:28 brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 00:18:8b:bb:d0:9d brd ff:ff:ff:ff:ff:ff

ip a (before plugging in)

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: wlp12s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:19:d2:8f:8e:28 brd ff:ff:ff:ff:ff:ff
3: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 00:18:8b:bb:d0:9d brd ff:ff:ff:ff:ff:ff
    inet6 fe80::5304:a77d:4722:689d/64 scope link tentative 
       valid_lft forever preferred_lft forever

ip a (after plugging in)

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: wlp12s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:19:d2:8f:8e:28 brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:18:8b:bb:d0:9d brd ff:ff:ff:ff:ff:ff
    inet6 fe80::5304:a77d:4722:689d/64 scope link 
       valid_lft forever preferred_lft forever

cat /etc/dhcpcd.conf

#controlgroup wheel
hostname
#clientid
duid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
#option interface_mtu
require dhcp_server_identifier
slaac private
nohook lookup-hostname
noipv4ll

Last edited by xiaoju (2015-04-12 08:24:33)

Offline

#2 2015-04-12 08:24:09

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: dhcpcd fails when ethernet cable not plugged before boot

xiaoju wrote:

- restarting dhcpcd manually fixes the internet connection:

systemctl restart dhcpcd 

[..]
Here the outputs of:
    systemctl status dhcpcd@eth0.service

Those are two different services (so you're starting another service and not restarting the failed one). I'm pretty sure you should be using dhcpcd.service for your hotplugging scenario anyway (and disable the other).

Offline

#3 2015-04-13 14:40:37

xiaoju
Member
Registered: 2015-03-21
Posts: 3

Re: dhcpcd fails when ethernet cable not plugged before boot

Raynman, thank you for your advice, this worked!

systemctl stop dhcpcd@eth0.service
systemctl disable dhcpcd@eth0.service
systemctl start dhcpcd.service
systemctl enable dhcpcd.service 

Unplug eth0, reboot, wait a while, plug eth0, internet working! :-)

Wheras dhcpcd@.service doesn't support hotplugging:

systemctl stop dhcpcd.service
systemctl disable dhcpcd.service
systemctl start dhcpcd@eth0.service
systemctl enable dhcpcd@eth0.service

Unplug eth0, reboot, wait a while, plug eth0, internet not working. :-(

You solved my problem, THANK YOU!!!

Offline

Board footer

Powered by FluxBB