我有一个使用 Buildroot 构建的 Linux 嵌入式系统,它有 systemd v250。
在之前的builtroot 版本中,它使用的是systemd v232。
我定义了以下网络文件:
/etc/systemd/network/20-wired.network
[Match]
Name=usb0
[Network]
Address=192.168.89.14/24
此配置在我的旧 buildroot 映像上运行良好,启动后当我检查 IP 地址时:
# ip a
3: usb0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 36:f9:b3:30:8f:b8 brd ff:ff:ff:ff:ff:ff
inet 192.168.90.14/24 brd 192.168.90.255 scope global usb0
valid_lft forever preferred_lft forever
但现在,使用更新的 buildroot,我无法在启动时分配 IP 地址:
# ip a
3: usb0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether 4a:1d:3c:df:39:ea brd ff:ff:ff:ff:ff:ff
当我尝试使用 networkctl 检查发生了什么时,我有以下输出:
● 3: usb0
Link File: /usr/lib/systemd/network/99-default.link
Network File: /etc/systemd/network/20-wired.network
Type: gadget
State: no-carrier (configuring)
Online state: offline
Path: platform-ci_hdrc.0
Driver: g_ether
Hardware Address: 4a:1d:3c:df:39:ea
MTU: 1500
QDisc: pfifo_fast
Number of Queues (Tx/Rx): 1/1
Activation Policy: up
Required For Online: yes
Oct 04 16:48:16 rpi systemd-networkd[229]: usb0: Requesting static route (n/a): dst: n/a, src: n/a, gw: 192.168.89.1, prefsrc: n/a, scope: global, table: main(254), proto: static, type: unicast, nexthop: 0, prioa
Oct 04 16:48:16 rpi systemd-networkd[229]: usb0: Requesting routes
Oct 04 16:48:16 rpi systemd-networkd[229]: usb0: link_check_ready(): link layer is configuring.
Oct 04 16:48:16 rpi systemd-networkd[229]: usb0: Setting master interface
Oct 04 16:48:16 rpi systemd-networkd[229]: usb0: master interface set.
Oct 04 16:48:16 rpi systemd-networkd[229]: usb0: link_check_ready(): link is not activated.
Oct 04 16:48:16 rpi systemd-networkd[229]: usb0: Bringing link up
Oct 04 16:48:16 rpi systemd-networkd[229]: usb0: Flags change: +UP
Oct 04 16:48:16 rpi systemd-networkd[229]: usb0: Link UP
Oct 04 16:48:16 rpi systemd-networkd[229]: usb0: link_check_ready(): static addresses are not configured.
我不太确定这里出了什么问题以及如何解决这个问题,有人有想法吗?
我预先感谢您的帮助。
问候,
阿兹德。