wiki:TipAndDoc/Linux/LXC/ArchLinux

Version 1 (modified by mitty, 8 years ago) (diff)

--

DHCP

no valid interfaces found

  • Arch Linux 4.4.5-1
  • lxc 1:1.1.5-4
  • dhcpcd 6.10.1-1
  • # dhcpcd
    dev: loaded udev
    no valid interfaces found
    no interfaces have a carrier
    forked to background, child pid 65
    
  • # dhcpcd eth0
    DUID 00:01:00:01:1e:8a:6a:5e:ba:4a:37:94:4a:9d
    eth0: IAID 16:b6:47:44
    eth0: rebinding lease of 192.168.0.185
    eth0: NAK: address in use from 192.168.0.1
    eth0: message: address in use
    eth0: soliciting a DHCP lease
    eth0: soliciting an IPv6 router
    eth0: offered 192.168.0.172 from 192.168.0.1
    eth0: probing address 192.168.0.172/24
    eth0: leased 192.168.0.172 for 86400 seconds
    eth0: adding route to 192.168.0.0/24
    eth0: adding default route via 192.168.0.1
    forked to background, child pid 123
    
  • LXCコンテナ内で、udevdが起動しないことが原因の模様
  • strace -f dhcpcd
    • コンテナホスト(検証はKVMゲストで行った)
      access("/run/udev/control", F_OK) = 0
      
      open("/sys/devices/virtual/net/lo/uevent", O_RDONLY|O_CLOEXEC) = 9
      fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
      fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
      read(9, "INTERFACE=lo\nIFINDEX=1\n", 4096) = 23
      read(9, "", 4096)                 = 0
      read(9, "", 4096)                 = 0
      close(9)                          = 0
      open("/run/udev/data/n1", O_RDONLY|O_CLOEXEC) = 9
      
      open("/sys/devices/pci0000:00/0000:00:03.0/virtio0/net/ens3/uevent", O_RDONLY|O_CLOEXEC) = 9
      fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
      fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
      read(9, "INTERFACE=ens3\nIFINDEX=2\n", 4096) = 25
      read(9, "", 4096)                 = 0
      read(9, "", 4096)                 = 0
      close(9)                          = 0
      open("/run/udev/data/n2", O_RDONLY|O_CLOEXEC) = 9
      
    • LXCコンテナ
      access("/run/udev/control", F_OK) = -1 ENOENT (No such file or directory)
      
      open("/sys/devices/virtual/net/lo/uevent", O_RDONLY|O_CLOEXEC) = 9
      fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
      fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
      read(9, "INTERFACE=lo\nIFINDEX=1\n", 4096) = 23
      read(9, "", 4096)                 = 0
      read(9, "", 4096)                 = 0
      close(9)                          = 0
      open("/run/udev/data/n1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
      
      open("/sys/devices/virtual/net/eth0/uevent", O_RDONLY|O_CLOEXEC) = 9
      fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
      fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
      read(9, "INTERFACE=eth0\nIFINDEX=6\n", 4096) = 25
      read(9, "", 4096)                 = 0
      read(9, "", 4096)                 = 0
      close(9)                          = 0
      open("/run/udev/data/n6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
      write(2, "no valid interfaces found", 25) = 25
      write(2, "\n", 1)                 = 1
      
      write(1, "no interfaces have a carrier\n", 29) = 29
      
      • [root@test /]# systemctl status systemd-udevd
        ● systemd-udevd.service - udev Kernel Device Manager
           Loaded: loaded (/usr/lib/systemd/system/systemd-udevd.service; static; vendor preset: disabled)
           Active: inactive (dead)
        Condition: start condition failed at Sat 2016-04-02 08:30:59 UTC; 5h 9min ago
                   ConditionPathIsReadWrite=/sys was not met
             Docs: man:systemd-udevd.service(8)
                   man:udev(7)
        
  • arch:Linux_Containers#Systemd_considerations_.28required.29
    • 上記を参考にsystemdの設定を行ったが効果なし
  • arch:dhcpcd#dhcpcd_and_systemd_network_interfaces

    dhcpcd.service can be Enabled without specifying an interface. This may, however, create a race condition at boot with systemd-udevd trying to apply a predictable network interface name:

    error changing net interface name wlan0 to wlp4s0: Device or resource busy" 
    

    To avoid it, enable dhcpcd per interface it should bind to as described in dhcpcd#Running. The downside of the template unit is, however, that it does not support hot-plugging of a wired connection and will fail if the network cable is not connected. To work-around the failure, see dhcpcd#Timeout_delay.

    とのことなので、いずれにせよdhcpcd.serviceを使用しないのがよさそう
  • 古い情報
    • Odd Bits dhcpcd[492]: eth0: if_init: Read-only file system

Dependency failed for dhcpcd on eth0.

  • # systemctl start dhcpcd@eth0
    A dependency job for dhcpcd@eth0.service failed. See 'journalctl -xe' for details.
    
  • # journalctl -xe
    Apr 10 20:00:56 test3 systemd[1]: Starting of sys-subsystem-net-devices-eth0.device not supported.
    -- Subject: Unit sys-subsystem-net-devices-eth0.device has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit sys-subsystem-net-devices-eth0.device has failed.
    --
    -- The result is unsupported.
    Apr 10 20:00:56 test3 systemd[1]: Dependency failed for dhcpcd on eth0.
    -- Subject: Unit dhcpcd@eth0.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    --
    -- Unit dhcpcd@eth0.service has failed.
    --
    -- The result is dependency.
    Apr 10 20:00:56 test3 systemd[1]: dhcpcd@eth0.service: Job dhcpcd@eth0.service/start failed with result 'dependency'.
    
  • /usr/lib/systemd/system/dhcpcd@.service
    [Unit]
    Description=dhcpcd on %I
    Wants=network.target
    Before=network.target
    BindsTo=sys-subsystem-net-devices-%i.device
    After=sys-subsystem-net-devices-%i.device
    
    [Service]
    Type=forking
    PIDFile=/run/dhcpcd-%I.pid
    ExecStart=/usr/bin/dhcpcd -q -w %I
    ExecStop=/usr/bin/dhcpcd -x %I
    
    [Install]
    WantedBy=multi-user.target
    
    • BindsTo=, After=の行を削除することで対応可能

Attachments (1)

Download all attachments as: .zip