使用 Ubuntu 22.04 进行 BBB 的 NFS 启动

使用 Ubuntu 22.04 进行 BBB 的 NFS 启动

我最近将系统更新为 Ubuntu 18.04.5 至 22.04(全新安装)。在旧系统上,我有一个 Yocto 项目,用于我的 BBB,使用 TFTP 和 NFS 从我的机器启动。一切正常,但自从更新以来,我无法启动 NFS,而 TFPT 工作正常。我搜索了互联网几天,尝试了很多方法,但仍然无法从 NFS 服务器启动我的 BBB。加载内核后,它卡住了。这是我的 BBB 启动日志:

U-Boot SPL 2021.01-g15769936a5 (Dec 06 2021 - 21:28:58 +0000)
Trying to boot from MMC1


U-Boot 2021.01-g15769936a5 (Dec 06 2021 - 21:28:58 +0000)

CPU  : AM335X-GP rev 2.1
Model: TI AM335x BeagleBone Black
DRAM:  512 MiB
WDT:   Started with servicing (60s timeout)
NAND:  0 MiB
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from FAT... OK
Net:   eth2: ethernet@4a100000, eth3: usb_ether
Hit any key to stop autoboot:  0 
link up on port 0, speed 100, full duplex
Using ethernet@4a100000 device
TFTP from server 192.168.5.1; our IP address is 192.168.5.10
Filename 'zImage'.
Load address: 0x81000000
Loading: #################################################################
     #################################################################
     #################################################################
     #################################################################
     #################################################################
     #############
     752.9 KiB/s
done
Bytes transferred = 4956672 (4ba200 hex)
link up on port 0, speed 100, full duplex
Using ethernet@4a100000 device
TFTP from server 192.168.5.1; our IP address is 192.168.5.10
Filename 'am335x-boneblack-rootbot.dtb'.
Load address: 0x82000000
Loading: #######
     3.1 MiB/s
done
Bytes transferred = 93887 (16ebf hex)
## Flattened Device Tree blob at 82000000
   Booting using the fdt blob at 0x82000000
   Loading Device Tree to 8ffe6000, end 8ffffebe ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.10.65-gdcc6bedb2c (oe-user@oe-host) (arm-poky-linux-gnueabi-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 PREEMPT Fri Dec 3 15:28:30 UTC 2021
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: TI AM335x BeagleBone Black
[    0.000000] Memory policy: Data cache writeback
[    0.000000] efi: UEFI not found.
[    0.000000] cma: Reserved 48 MiB at 0x9c800000
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000080000000-0x000000009fefffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080000000-0x000000009fefffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x000000009fefffff]
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] AM335X ES2.1 (sgx neon)
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 129666
[    0.000000] Kernel command line: rw root=/dev/nfs nfsroot=192.168.5.1:/opt/nfs ip=192.168.5.10 console=ttyO0,115200n8
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 452328K/523264K available (10240K kernel code, 692K rwdata, 3344K rodata, 1024K init, 282K bss, 21784K reserved, 49152K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000]  Trampoline variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] IRQ: Found an INTC at 0x(ptrval) (revision 5.0) with 128 interrupts
[    0.000000] random: get_random_bytes called from start_kernel+0x30c/0x4c8 with crng_init=0
[    0.000000] TI gptimer clocksource: always-on /ocp/interconnect@44c00000/segment@200000/target-module@31000
[    0.000010] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000027] clocksource: dmtimer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000341] TI gptimer clockevent: 24000000 Hz at /ocp/interconnect@48000000/segment@0/target-module@40000
[    0.001311] Console: colour dummy device 80x30
[    0.001350] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
[    0.001357] This ensures that you still see kernel messages. Please
[    0.001363] update your kernel commandline.
[    0.001415] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
[    0.090407] pid_max: default: 32768 minimum: 301
[    0.090563] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.090577] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.091408] CPU: Testing write buffer coherency: ok
[    0.091480] CPU0: Spectre v2: using BPIALL workaround
[    0.092291] Setting up static identity map for 0x80100000 - 0x80100060
[    0.092426] rcu: Hierarchical SRCU implementation.
[    0.092513] EFI services will not be available.
[    0.092867] devtmpfs: initialized
[    0.103912] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[    0.104157] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.104180] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.107573] pinctrl core: initialized pinctrl subsystem
[    0.108487] DMI not present or invalid.
[    0.108921] NET: Registered protocol family 16
[    0.111120] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.128713] l3-aon-clkctrl:0000:0: failed to disable
[    0.129895] thermal_sys: Registered thermal governor 'fair_share'
[    0.129908] thermal_sys: Registered thermal governor 'bang_bang'
[    0.129921] thermal_sys: Registered thermal governor 'step_wise'
[    0.129928] thermal_sys: Registered thermal governor 'user_space'
[    0.130275] cpuidle: using governor ladder
[    0.130313] cpuidle: using governor menu
[    1.157033] No ATAGs?
[    1.157062] hw-breakpoint: debug architecture 0x4 unsupported.
[    1.181241] iommu: Default domain type: Translated 
[    1.183363] SCSI subsystem initialized
[    1.183821] mc: Linux media interface: v0.10
[    1.183873] videodev: Linux video capture interface: v2.00
[    1.183976] pps_core: LinuxPPS API ver. 1 registered
[    1.183985] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[    1.184007] PTP clock support registered
[    1.184066] EDAC MC: Ver: 3.0.0
[    1.185230] Advanced Linux Sound Architecture Driver Initialized.
[    1.186505] clocksource: Switched to clocksource dmtimer
[    1.193711] NET: Registered protocol family 2
[    1.193926] IP idents hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    1.194892] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    1.194931] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    1.194974] TCP bind hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    1.195013] TCP: Hash tables configured (established 4096 bind 4096)
[    1.195127] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    1.195148] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    1.195288] NET: Registered protocol family 1
[    1.195826] RPC: Registered named UNIX socket transport module.
[    1.195841] RPC: Registered udp transport module.
[    1.195848] RPC: Registered tcp transport module.
[    1.195855] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    1.195872] PCI: CLS 0 bytes, default 64
[    1.197160] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
[    1.198370] Initialise system trusted keyrings
[    1.198729] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[    1.202443] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    1.203224] NFS: Registering the id_resolver key type
[    1.203274] Key type id_resolver registered
[    1.203282] Key type id_legacy registered
[    1.203365] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    1.203377] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    1.203412] ntfs: driver 2.1.32 [Flags: R/O].
[    1.204002] Key type asymmetric registered
[    1.204022] Asymmetric key parser 'x509' registered
[    1.204070] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 243)
[    1.204082] io scheduler mq-deadline registered
[    1.204091] io scheduler kyber registered
[    1.558544] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
[    1.632765] debugfs: Directory '49000000.dma' with parent 'dmaengine' already present!
[    1.632812] edma 49000000.dma: TI EDMA DMA engine driver
[    1.652632] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[    1.702226] Serial: 8250/16550 driver, 10 ports, IRQ sharing enabled
[    1.706837] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 20, base_baud = 3000000) is a 8250
[    2.368230] printk: console [ttyS0] enabled
[    2.374244] 48022000.serial: ttyS1 at MMIO 0x48022000 (irq = 26, base_baud = 3000000) is a 8250
[    2.385917] omap_rng 48310000.rng: Random Number Generator ver. 20
[    2.392253] random: fast init done
[    2.395884] random: crng init done
[    2.417103] brd: module loaded
[    2.426871] loop: module loaded
[    2.434415] libphy: Fixed MDIO Bus: probed
[    2.496534] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
[    2.504241] libphy: 4a101000.mdio: probed
[    2.510742] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
[    2.520650] cpsw-switch 4a100000.switch: initialized cpsw ale version 1.4
[    2.527601] cpsw-switch 4a100000.switch: ALE Table size 1024
[    2.533402] cpsw-switch 4a100000.switch: cpts: overflow check period 500 (jiffies)
[    2.541089] cpsw-switch 4a100000.switch: CPTS: ref_clk_freq:250000000 calc_mult:2147483648 calc_shift:29 error:0 nsec/sec
[    2.552183] cpsw-switch 4a100000.switch: Detected MACID = e4:15:f6:f7:07:be
[    2.560055] cpsw-switch 4a100000.switch: initialized (regs 0x4a100000, pool size 256) hw_ver:0019010C 1.12 (0)
[    2.571238] i2c /dev entries driver
[    2.577413] cpuidle: enable-method property 'ti,am3352' found operations
[    2.584773] sdhci: Secure Digital Host Controller Interface driver
[    2.591040] sdhci: Copyright(c) Pierre Ossman
[    2.596368] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.604789] ledtrig-cpu: registered to indicate activity on CPUs
[    2.612751] remoteproc remoteproc0: wkup_m3 is available
[    2.621365] NET: Registered protocol family 10
[    2.627256] Segment Routing with IPv6
[    2.631016] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    2.637742] NET: Registered protocol family 17
[    2.642563] Key type dns_resolver registered
[    2.647592] omap_voltage_late_init: Voltage driver support not added
[    2.654611] Loading compiled-in X.509 certificates
[    2.671766] OMAP GPIO hardware version 0.1
[    2.707089] tps65217-pmic: Failed to locate of_node [id: -1]
[    2.718992] tps65217-bl: Failed to locate of_node [id: -1]
[    2.727311] tps65217 0-0024: TPS65217 ID 0xe version 1.2
[    2.733111] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[    2.742060] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
[    2.756252] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
[    2.768202] sdhci-omap 48060000.mmc: Got CD GPIO
[    2.773151] sdhci-omap 48060000.mmc: supply vqmmc not found, using dummy regulator
[    2.856868] mmc0: SDHCI controller on 48060000.mmc [48060000.mmc] using External DMA
[    2.866038] cpsw-switch 4a100000.switch: starting ndev. mode: dual_mac
[    2.932507] mmc0: new high speed SDHC card at address aaaa
[    2.941266] mmcblk0: mmc0:aaaa SL32G 29.7 GiB 
[    2.948250]  mmcblk0: p1 p2
[    2.958235] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=4a101000.mdio:00, irq=POLL)
[    7.127371] cpsw-switch 4a100000.switch eth0: Link is Up - 100Mbps/Full - flow control off
[    7.136654] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    7.166698] IP-Config: Guessing netmask 255.255.255.0
[    7.171785] IP-Config: Complete:
[    7.175036]      device=eth0, hwaddr=e4:15:f6:f7:07:be, ipaddr=192.168.5.10, mask=255.255.255.0, gw=255.255.255.255
[    7.185639]      host=192.168.5.10, domain=, nis-domain=(none)
[    7.191670]      bootserver=255.255.255.255, rootserver=192.168.5.1, rootpath=
[    7.192950] ALSA device list:
[    7.203397]   No soundcards found.
[  103.540846] VFS: Unable to mount root fs via NFS.
[  103.545779] devtmpfs: mounted
[  103.554404] Freeing unused kernel memory: 1024K
[  103.588598] Run /sbin/init as init process
[  103.594497] Run /etc/init as init process
[  103.599034] Run /bin/init as init process
[  103.603361] Run /bin/sh as init process
[  103.608831] Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
[  103.623124] ---[ end Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. ]---

这是我的 /etc/defaults/nfs-kernel-server 配置

# Number of servers to start up
RPCNFSDCOUNT=8

# Runtime priority of server (see nice(1))
RPCNFSDPRIORITY=0

# Options for rpc.mountd.
# If you have a port-based firewall, you might want to set up
# a fixed port here using the --port option. For more information, 
# see rpc.mountd(8) or http://wiki.debian.org/SecuringNFS
# To disable NFSv4 on the server, specify '--no-nfs-version 4' here
RPCMOUNTDOPTS="--manage-gids"

# Do you want to start the svcgssd daemon? It is only required for Kerberos
# exports. Valid alternatives are "yes" and "no"; the default is "no".
NEED_SVCGSSD=""

# Options for rpc.svcgssd.
RPCSVCGSSDOPTS=""

RPCNFSDOPTS="--nfs-version 2,3,4 --debug --syslog"

我的 /etc/defaults/tftp-hpa 配置(运行良好)

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/opt/tftp/tftpboot"
TFTP_ADDRESS=":69"
TFTP_OPTIONS="--secure --create"

最后是我的 /etc/exports 文件:

# /etc/exports: the access control list for filesystems which may be exported
#       to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#

/opt/nfs 192.168.5.1/24(rw,async,no_subtree_check)

我的防火墙已禁用(在意向内),并且 IP 地址是静态配置的(在 BBB 上的 u-boot 和我的 nfs 服务器机器上的接口中)。我可以在本地安装 nfs 并拥有完全访问权限。nfs 文件夹的所有权设置为 nobody:nogroup,具有完全权限(777)。

有关服务器服务的更多信息:

$ cat /proc/fs/nfs/exports 
# Version 1.1
# Path Client(Flags) # IPs
/opt/nfs    192.168.5.1/24(rw,root_squash,async,wdelay,no_subtree_check,uuid=be9ef652:a58c4750:bdf20f7e:72b03c73,sec=1)

systemctl 的一个片段:

systemctl --type=service --state=running
...
  nfs-blkmap.service            loaded active running pNFS block layout mapping daemon
  nfs-idmapd.service            loaded active running NFSv4 ID-name mapping service
  nfs-mountd.service            loaded active running NFS Mount Daemon
...
  tftpd-hpa.service             loaded active running LSB: HPA's tftp server
...

我最终使用 wireshark 跟踪了启动过程,在 TFTP 启动完成后,我看到了一些 NFS 数据包。不幸的是,我对 NFS 或 MOUNT 协议的细节不够熟悉,无法进一步分析它们的含义,但 MOUNT 似乎试图连接到正确的地址和路径: 在此处输入图片描述

再次,同样的配置在 18.04 上工作得很好,也许有些东西发生了变化,或者我忽略了一些东西。我所做的任何研究都指出了我遗漏的另一个步骤,所以我不知道哪里出了问题。我束手无策……有人能帮忙吗?

提前致谢!

答案1

像往常一样,在这里发帖让我有了新的想法:查看 wireshark 跟踪,NFS 数据包显示“V2 NULL Call”。因此,我在本地主机上安装了 nfs,但指定版本也为 V2:

$ mount -t nfs -o vers=2 192.168.5.1:/opt/nfs /mnt/
mount.nfs: requested NFS version or transport protocol is not supported

开始吧:看来 Ubuntu 18.04 仍然支持 NFS 版本 2,但 22.04 不再支持。因此,以前有效的相同配置和图像不再受支持!我从 uboot 中更新了 bootargs 环境变量

bootargs=rw root=/dev/nfs nfsroot=192.168.5.1:/opt/nfs ip=192.168.5.10 console=ttyO0,115200n8

bootargs=rw root=/dev/nfs nfsroot=192.168.5.1:/opt/nfs,vers=4 ip=192.168.5.10 console=ttyO0,115200n8

并且它成功了。

我留下此帖子和我的答案给所有不知道所支持的 NFS 协议版本支持变化的人。

相关内容