| 1 | [[PageOutline]] |
| 2 | |
| 3 | * [http://unix.stackexchange.com/questions/71527/arch-linux-pacman-does-not-work-when-chrooting grub2 - Arch linux : pacman does not work when chrooting - Unix & Linux Stack Exchange] |
| 4 | > Remember to {{{arch-chroot}}} and not simply {{{chroot}}} - that way {{{/proc}}} will be populated and pacman will function as expected. |
| 5 | |
| 6 | * [http://bryanalves.github.io/2015/07/02/enabling-lxc-archlinux-with-systemd-networkd/ Enabling LXC on Archlinux with systemd-networkd – Bryan's Blah Blog] |
| 7 | > I’m on a laptop with wireless, so I can’t just create a bridge and give IPs to containers from an upstream DHCP server. I needed to do NAT and essentially simulate/replicate how docker networking works. |
| 8 | |
| 9 | = DHCP = |
| 10 | |
| 11 | == no valid interfaces found == |
| 12 | * Arch Linux 4.4.5-1 |
| 13 | * lxc 1:1.1.5-4 |
| 14 | * dhcpcd 6.10.1-1 |
| 15 | |
| 16 | * # dhcpcd |
| 17 | {{{ |
| 18 | dev: loaded udev |
| 19 | no valid interfaces found |
| 20 | no interfaces have a carrier |
| 21 | forked to background, child pid 65 |
| 22 | }}} |
| 23 | * # dhcpcd eth0 |
| 24 | {{{ |
| 25 | DUID 00:01:00:01:1e:8a:6a:5e:ba:4a:37:94:4a:9d |
| 26 | eth0: IAID 16:b6:47:44 |
| 27 | eth0: rebinding lease of 192.168.0.185 |
| 28 | eth0: NAK: address in use from 192.168.0.1 |
| 29 | eth0: message: address in use |
| 30 | eth0: soliciting a DHCP lease |
| 31 | eth0: soliciting an IPv6 router |
| 32 | eth0: offered 192.168.0.172 from 192.168.0.1 |
| 33 | eth0: probing address 192.168.0.172/24 |
| 34 | eth0: leased 192.168.0.172 for 86400 seconds |
| 35 | eth0: adding route to 192.168.0.0/24 |
| 36 | eth0: adding default route via 192.168.0.1 |
| 37 | forked to background, child pid 123 |
| 38 | }}} |
| 39 | |
| 40 | * LXCコンテナ内で、udevdが起動しないことが原因の模様 |
| 41 | * strace -f dhcpcd |
| 42 | * コンテナホスト(検証はKVMゲストで行った) |
| 43 | {{{ |
| 44 | access("/run/udev/control", F_OK) = 0 |
| 45 | |
| 46 | open("/sys/devices/virtual/net/lo/uevent", O_RDONLY|O_CLOEXEC) = 9 |
| 47 | fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0 |
| 48 | fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0 |
| 49 | read(9, "INTERFACE=lo\nIFINDEX=1\n", 4096) = 23 |
| 50 | read(9, "", 4096) = 0 |
| 51 | read(9, "", 4096) = 0 |
| 52 | close(9) = 0 |
| 53 | open("/run/udev/data/n1", O_RDONLY|O_CLOEXEC) = 9 |
| 54 | |
| 55 | open("/sys/devices/pci0000:00/0000:00:03.0/virtio0/net/ens3/uevent", O_RDONLY|O_CLOEXEC) = 9 |
| 56 | fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0 |
| 57 | fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0 |
| 58 | read(9, "INTERFACE=ens3\nIFINDEX=2\n", 4096) = 25 |
| 59 | read(9, "", 4096) = 0 |
| 60 | read(9, "", 4096) = 0 |
| 61 | close(9) = 0 |
| 62 | open("/run/udev/data/n2", O_RDONLY|O_CLOEXEC) = 9 |
| 63 | }}} |
| 64 | * LXCコンテナ |
| 65 | {{{ |
| 66 | access("/run/udev/control", F_OK) = -1 ENOENT (No such file or directory) |
| 67 | |
| 68 | open("/sys/devices/virtual/net/lo/uevent", O_RDONLY|O_CLOEXEC) = 9 |
| 69 | fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0 |
| 70 | fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0 |
| 71 | read(9, "INTERFACE=lo\nIFINDEX=1\n", 4096) = 23 |
| 72 | read(9, "", 4096) = 0 |
| 73 | read(9, "", 4096) = 0 |
| 74 | close(9) = 0 |
| 75 | open("/run/udev/data/n1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) |
| 76 | |
| 77 | open("/sys/devices/virtual/net/eth0/uevent", O_RDONLY|O_CLOEXEC) = 9 |
| 78 | fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0 |
| 79 | fstat(9, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0 |
| 80 | read(9, "INTERFACE=eth0\nIFINDEX=6\n", 4096) = 25 |
| 81 | read(9, "", 4096) = 0 |
| 82 | read(9, "", 4096) = 0 |
| 83 | close(9) = 0 |
| 84 | open("/run/udev/data/n6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) |
| 85 | write(2, "no valid interfaces found", 25) = 25 |
| 86 | write(2, "\n", 1) = 1 |
| 87 | |
| 88 | write(1, "no interfaces have a carrier\n", 29) = 29 |
| 89 | }}} |
| 90 | * [root@test /]# systemctl status systemd-udevd |
| 91 | {{{ |
| 92 | ● systemd-udevd.service - udev Kernel Device Manager |
| 93 | Loaded: loaded (/usr/lib/systemd/system/systemd-udevd.service; static; vendor preset: disabled) |
| 94 | Active: inactive (dead) |
| 95 | Condition: start condition failed at Sat 2016-04-02 08:30:59 UTC; 5h 9min ago |
| 96 | ConditionPathIsReadWrite=/sys was not met |
| 97 | Docs: man:systemd-udevd.service(8) |
| 98 | man:udev(7) |
| 99 | }}} |
| 100 | * arch:Linux_Containers#Systemd_considerations_.28required.29 |
| 101 | * 上記を参考にsystemdの設定を行ったが効果なし |
| 102 | |
| 103 | * arch:dhcpcd#dhcpcd_and_systemd_network_interfaces |
| 104 | > {{{dhcpcd.service}}} can be [arch: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: |
| 105 | > {{{ |
| 106 | > error changing net interface name wlan0 to wlp4s0: Device or resource busy" |
| 107 | > }}} |
| 108 | > To avoid it, enable dhcpcd per interface it should bind to as described in [arch: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 [arch:dhcpcd#Timeout_delay]. |
| 109 | とのことなので、いずれにせよ{{{dhcpcd.service}}}を使用しないのがよさそう |
| 110 | |
| 111 | * 古い情報 |
| 112 | * [http://blog.oddbit.com/2013/02/01/dhcpcd-under-lxc/ Odd Bits] {{{dhcpcd[492]: eth0: if_init: Read-only file system}}} |
| 113 | |
| 114 | == Dependency failed for dhcpcd on eth0. == |
| 115 | * # systemctl start dhcpcd@eth0 |
| 116 | {{{ |
| 117 | A dependency job for dhcpcd@eth0.service failed. See 'journalctl -xe' for details. |
| 118 | }}} |
| 119 | * # journalctl -xe |
| 120 | {{{ |
| 121 | Apr 10 20:00:56 test3 systemd[1]: Starting of sys-subsystem-net-devices-eth0.device not supported. |
| 122 | -- Subject: Unit sys-subsystem-net-devices-eth0.device has failed |
| 123 | -- Defined-By: systemd |
| 124 | -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel |
| 125 | -- |
| 126 | -- Unit sys-subsystem-net-devices-eth0.device has failed. |
| 127 | -- |
| 128 | -- The result is unsupported. |
| 129 | Apr 10 20:00:56 test3 systemd[1]: Dependency failed for dhcpcd on eth0. |
| 130 | -- Subject: Unit dhcpcd@eth0.service has failed |
| 131 | -- Defined-By: systemd |
| 132 | -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel |
| 133 | -- |
| 134 | -- Unit dhcpcd@eth0.service has failed. |
| 135 | -- |
| 136 | -- The result is dependency. |
| 137 | Apr 10 20:00:56 test3 systemd[1]: dhcpcd@eth0.service: Job dhcpcd@eth0.service/start failed with result 'dependency'. |
| 138 | }}} |
| 139 | |
| 140 | * /usr/lib/systemd/system/dhcpcd@.service |
| 141 | {{{ |
| 142 | [Unit] |
| 143 | Description=dhcpcd on %I |
| 144 | Wants=network.target |
| 145 | Before=network.target |
| 146 | BindsTo=sys-subsystem-net-devices-%i.device |
| 147 | After=sys-subsystem-net-devices-%i.device |
| 148 | |
| 149 | [Service] |
| 150 | Type=forking |
| 151 | PIDFile=/run/dhcpcd-%I.pid |
| 152 | ExecStart=/usr/bin/dhcpcd -q -w %I |
| 153 | ExecStop=/usr/bin/dhcpcd -x %I |
| 154 | |
| 155 | [Install] |
| 156 | WantedBy=multi-user.target |
| 157 | }}} |
| 158 | * {{{BindsTo=}}}, {{{After=}}}の行を削除することで対応可能 |
| 159 | |
| 160 | * see also |
| 161 | * [https://bbs.archlinux.org/viewtopic.php?id=164753 Netctl doesn't work in LXC (Linux containers) due to udev dependency / Networking, Server, and Protection / Arch Linux Forums] |
| 162 | * [https://bugs.archlinux.org/task/35715 FS#35715 : (netctl) fails to start network inside Linux Container] |