我試圖透過 systemd-networkd 設定靜態 IP,一切正常,在我刪除自訂檔案並重新啟動裝置後,eth0 和 wlan0 都無法啟動。我希望他們能再次從 DHCP 取得地址,檢查我看到的偵錯日誌:
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/network1/link/_33 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=12 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.10 path=n/a interface=n/a member=n/a cookie=1 reply_cookie=1 signature=s error-name=n/a error-message=n/a
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Bus bus-api-network: changing state HELLO → RUNNING
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Got message type=signal sender=org.freedesktop.DBus.Local destination=n/a path=/org/freedesktop/DBus/Local interface=org.freedesktop.DBus.Local member=Connected cookie=4294967295 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Got message type=signal sender=org.freedesktop.DBus destination=:1.10 path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=NameAcquired cookie=2 reply_cookie=0 signature=s error-name=n/a error-message=n/a
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Got message type=signal sender=org.freedesktop.DBus destination=:1.10 path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=NameAcquired cookie=3 reply_cookie=0 signature=s error-name=n/a error-message=n/a
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.10 path=n/a interface=n/a member=n/a cookie=4 reply_cookie=2 signature=u error-name=n/a error-message=n/a
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Successfully acquired requested service name.
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Got message type=method_return sender=org.freedesktop.DBus destination=:1.10 path=n/a interface=n/a member=n/a cookie=5 reply_cookie=3 signature=n/a error-name=n/a error-message=n/a
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Match type='signal',sender='org.freedesktop.login1',path='/org/freedesktop/login1',interface='org.freedesktop.login1.Manager',member='PrepareForSleep' successfully installed.
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: eth0: Link state is up-to-date
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: eth0: found matching network '/lib/systemd/network/80-wired.network'
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Setting '/proc/sys/net/ipv6/conf/eth0/disable_ipv6' to '0'
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: eth0: IPv6 successfully enabled
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Setting '/proc/sys/net/ipv6/conf/eth0/proxy_ndp' to '0'
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Setting '/proc/sys/net/ipv6/conf/eth0/use_tempaddr' to '0'
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Setting '/proc/sys/net/ipv6/conf/eth0/accept_ra' to '0'
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: DHCPv6 CLIENT: Failed to set DUID-EN: No medium found
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: eth0: DHCP6 CLIENT: Failed to set DUID: No medium found
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: eth0: Failed
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: eth0: State changed: initialized -> failed
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: Sent message type=signal sender=n/a destination=n/a path=/org/freedesktop/network1/link/_32 interface=org.freedesktop.DBus.Properties member=PropertiesChanged cookie=13 reply_cookie=0 signature=sa{sv}as error-name=n/a error-message=n/a
Dec 16 17:27:56 raspberrypi4 systemd-networkd[339]: DHCP CLIENT (0x0): STOPPED
然而在過去,ipv6位址是成功分配的。我找不到任何對該Failed to set DUID: No medium found
錯誤的引用
答案1
問題是我們在 /etc 上使用了 overridefs,它覆蓋了/etc/machine-id
使用預設空檔產生的 systemd,因為 systemd 掛載的 tmpfs/ets/machine-id
正在被重寫。
因此,DHCP6 用戶端無法設定 DUID,因為該 DUID/etc/machine-id
為空。我透過將 /etc/machine-id 複製到覆蓋分區(如果不存在)來修復它,使其在重新啟動後保持不變。