Ubuntu Server 18.04 启动时只有 wifi,在 eth0 上等待 2 分钟

Ubuntu Server 18.04 启动时只有 wifi,在 eth0 上等待 2 分钟

我在运行于 RPi 3B+ 上的 Ubuntu Server 18.04 时遇到问题。当仅使用 wifi 连接启动时,系统会挂起 2 分钟,等待 eth0 连接。我添加了可选:true,但它被忽略了。

我的/etc/netplan:

# This file is generated from information provided by
# the datasource.  Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
    version: 2
    renderer: networkd
    ethernets:
        eth0:
            dhcp4: true
            match:
                macaddress: b8:27:eb:db:7f:54
            set-name: eth0
            optional: true
    wifis:
        wlan0:
            dhcp4: true
            access-points:
                "Lagrange Point 5G":
                     password: "*****"
            nameservers:
                addresses: [10.0.1.1, 8.8.8.8]

以下是 dmesg 的结尾:

[   19.540586] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[   19.540603] brcmfmac: power management disabled
[   19.546500] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[  145.054536] new mount options do not match the existing superblock, will be ignored
[  152.587186] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

有谁知道我做错了什么?

编辑:已添加所需信息...

$ sudo lshw -C network
  *-network:0               
       description: Wireless interface
       physical id: 2
       logical name: wlan0
       serial: b8:27:eb:9f:ba:34
       capabilities: ethernet physical wireless
       configuration: broadcast=yes driver=brcmfmac driverversion=7.45.154 firmware=01-4fbe0b04 ip=10.0.1.38 multicast=yes wireless=IEEE 802.11
  *-network:1 DISABLED
       description: Ethernet interface
       physical id: 3
       logical name: eth0
       serial: b8:27:eb:ca:ef:61
       capacity: 1Gbit/s
       capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=lan78xx driverversion=1.0.6 link=no multicast=yes port=MII

并确认 netplan 配置:

$ cat /etc/network/interfaces
# ifupdown has been replaced by netplan(5) on this system.  See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
#    sudo apt install ifupdown

顺便说一句,我已经确认在两个不同的 Raspberry Pi 3B+ 上存在完全相同的行为,只是为了排除硬件故障。

编辑#2:我按照@heynnema 的建议更新了我的 netplan 并运行:

$ sudo netplan --debug generate
DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:2077): DEBUG: 19:40:02.567: Processing input file /etc/netplan/50-cloud-init.yaml..
** (generate:2077): DEBUG: 19:40:02.567: starting new processing pass
** (generate:2077): DEBUG: 19:40:02.568: wlan0: adding wifi AP 'Lagrange Point 5G'
** (generate:2077): DEBUG: 19:40:02.568: wlan0: setting default backend to 1
** (generate:2077): DEBUG: 19:40:02.568: eth0: setting default backend to 1
** (generate:2077): DEBUG: 19:40:02.568: Generating output files..
** (generate:2077): DEBUG: 19:40:02.568: wlan0: Creating wpa_supplicant configuration file run/netplan/wpa-wlan0.conf
** (generate:2077): DEBUG: 19:40:02.569: Creating wpa_supplicant service enablement link /run/systemd/system/multi-user.target.wants/[email protected]
** (generate:2077): DEBUG: 19:40:02.569: NetworkManager: definition wlan0 is not for us (backend 1)
** (generate:2077): DEBUG: 19:40:02.569: NetworkManager: definition eth0 is not for us (backend 1)

答案1

您的 eth0 的 MAC 地址错误。

试试这个 .yaml 文件...保留间距、缩进,并且无制表符...

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: true
      optional: true
  wifis:
    wlan0:
      dhcp4: true
      access-points:
        "Lagrange Point 5G":
          password: "*****"
      nameservers:
        addresses: [10.0.1.1, 8.8.8.8]

sudo netplan --debug generate# 生成配置文件

sudo netplan apply# 应用新配置

reboot# 重新启动,并确认操作正确

更新#1:

最终安装了 Ubuntu Server 19.04,它为 RPi 3B+ 提供直接支持,并编辑 .yaml 文件以包含optional: true。现在启动时间约为 30 秒!

答案2

好吧,我就是不能不管这个……为了一分钱而付出代价,等等。我听从了@heynnema 的建议,尝试了 Ubuntu Server 19.04,效果很好。所以,如果你在 Raspberry Pi 3B+ 上遇到了这个问题,那么答案就是去买它,忘掉 18.04。

我没有尝试 Ubuntu Server 18.10,因为 19.04 有声明声称完全支持 Raspberry Pi。

编辑:我保留了 Ubuntu 19 设置添加的 mac 地址匹配。此外,“可选:true”是必需的。它现在在 30 秒内启动!

相关内容