nfs挂载文件系统时VFS: Unable to mount root fs on unknown-block的问题解决

在通过nfs启动文件系统过程中会遇到下面的问题,记录下来防止忘掉

[  100.338146] VFS: Unable to mount root fs via NFS, trying floppy.
[  100.345728] VFS: Cannot open root device "nfs" or unknown-block(2,0): error -6
[  100.353202] Please append a correct "root=" boot option; here are the available partitions:

u-boot配置

bootargs=console=ttyO0,115200n8 root=/dev/nfs nfsroot=192.168.2.4:/home/server/nfs/rootfs,nolock rw ip=192.168.2.5

问题描述是没有挂载成功,所以到内核源码根目录

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

打开配置菜单查看是否启动了NFS启动项如下图
nfs挂载文件系统时VFS: Unable to mount root fs on unknown-block的问题解决_第1张图片File systems --->
nfs挂载文件系统时VFS: Unable to mount root fs on unknown-block的问题解决_第2张图片
发现NFS选项是开着的,如果没开按图片选择打开,主机的nfs服务也是开着的配置也都正确,也可以mount上,如果没有配置按照下下面的方法配置
https://www.cnblogs.com/pipci/p/9935572.html

但是还是不能正常启动系统,所以问题关键应该不是在配置问题,因为我用的debian9服务器,网上说debian9的nfs挂载有不兼容,所以将bootargs改成指定NFSv4

set bootargs console=ttyO0,115200n8 root=/dev/nfs nfsroot=192.168.2.4:/home/server/nfs/rootfs,nolock,proto=tcp,nfsvers=4 rw ip=192.168.2.5

成功

## Flattened Device Tree blob at 80000000
   Booting using the fdt blob at 0x80000000
   Loading Device Tree to 8fff4000, end 8ffff7dd ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.19.3 (server@debian) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 79
[    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] cma: Reserved 16 MiB at 0x9e800000
[    0.000000] CPU: All CPU(s) started in SVC mode.
[    0.000000] AM335X ES2.1 (sgx neon)
[    0.000000] random: get_random_bytes called from start_kernel+0x8c/0x498 with crng_init=0
[    0.000000] percpu: Embedded 18 pages/cpu @(ptrval) s42088 r8192 d23448 u73728
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 129412
[    0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/nfs nfsroot=192.168.2.4:/home/server/nfs/rootfs,nolock,proto=tcp,nfsvers=4 rw ip=192.168.2.5
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 480012K/522240K available (8192K kernel code, 789K rwdata, 2616K rodata, 1024K init, 7475K bss, 25844K reserved, 16384K cma-reserved, 0K high)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xe0000000 - 0xff800000   ( 504 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xdfe00000   ( 510 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (9184 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   (1024 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 790 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   (7476 kB)
[    0.000000] Running RCU self tests
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000] rcu:     RCU lockdep checking is enabled.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    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] OMAP clockevent source: timer2 at 24000000 Hz
[    0.000021] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000053] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000111] OMAP clocksource: timer1 at 24000000 Hz
[    0.000624] timer_probe: no matching timers found
[    0.001596] Console: colour dummy device 80x30
[    0.001663] WARNING: Your 'console=ttyO0' has been replaced by 'ttyS0'
[    0.001681] This ensures that you still see kernel messages. Please
[    0.001696] update your kernel commandline.
[    0.001714] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
[    0.001730] ... MAX_LOCKDEP_SUBCLASSES:  8
[    0.001745] ... MAX_LOCK_DEPTH:          48
[    0.001761] ... MAX_LOCKDEP_KEYS:        8191
[    0.001776] ... CLASSHASH_SIZE:          4096
[    0.001792] ... MAX_LOCKDEP_ENTRIES:     32768
[    0.001808] ... MAX_LOCKDEP_CHAINS:      65536
[    0.001824] ... CHAINHASH_SIZE:          32768
[    0.001839]  memory used by lock dependency info: 4655 kB
[    0.001855]  per task-struct memory footprint: 1536 bytes
[    0.001945] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
[    0.078552] pid_max: default: 32768 minimum: 301
[    0.079013] Security Framework initialized
[    0.079156] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.079183] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.082548] CPU: Testing write buffer coherency: ok
[    0.082737] CPU0: Spectre v2: using BPIALL workaround
[    0.084267] CPU0: thread -1, cpu 0, socket -1, mpidr 0
[    0.086704] Setting up static identity map for 0x80100000 - 0x80100078
[    0.087361] rcu: Hierarchical SRCU implementation.
[    0.089520] smp: Bringing up secondary CPUs ...
[    0.089551] smp: Brought up 1 node, 1 CPU
[    0.089571] SMP: Total of 1 processors activated (996.14 BogoMIPS).
[    0.089589] CPU: All CPU(s) started in SVC mode.
[    0.093661] devtmpfs: initialized
[    0.120594] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[    0.121406] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.121476] futex hash table entries: 256 (order: 2, 16384 bytes)
[    0.123190] pinctrl core: initialized pinctrl subsystem
[    0.128212] NET: Registered protocol family 16
[    0.135609] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.196772] l4_wkup_cm:clk:0010:0: failed to disable
[    0.250719] audit: initializing netlink subsys (disabled)
[    0.253597] cpuidle: using governor menu
[    0.267546] audit: type=2000 audit(0.250:1): state=initialized audit_enabled=0 res=1
[    0.269141] OMAP GPIO hardware version 0.1
[    0.294559] No ATAGs?
[    0.294586] hw-breakpoint: debug architecture 0x4 unsupported.
[    0.295038] omap4_sram_init:Unable to allocate sram needed to handle errata I688
[    0.295064] omap4_sram_init:Unable to get sram pool needed to handle errata I688
[    0.333258] edma 49000000.edma: TI EDMA DMA engine driver
[    0.339828] vgaarb: loaded
[    0.340944] SCSI subsystem initialized
[    0.342967] pps_core: LinuxPPS API ver. 1 registered
[    0.342993] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti 
[    0.343052] PTP clock support registered
[    0.347196] clocksource: Switched to clocksource timer1
[    0.505787] VFS: Disk quotas dquot_6.6.0
[    0.505993] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.533679] NET: Registered protocol family 2
[    0.535953] tcp_listen_portaddr_hash hash table entries: 256 (order: 1, 10240 bytes)
[    0.536046] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    0.536144] TCP bind hash table entries: 4096 (order: 5, 147456 bytes)
[    0.536707] TCP: Hash tables configured (established 4096 bind 4096)
[    0.537321] UDP hash table entries: 256 (order: 2, 20480 bytes)
[    0.537443] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)
[    0.537922] NET: Registered protocol family 1
[    0.540939] RPC: Registered named UNIX socket transport module.
[    0.541024] RPC: Registered udp transport module.
[    0.541043] RPC: Registered tcp transport module.
[    0.541062] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.544451] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
[    0.550066] Initialise system trusted keyrings
[    0.551150] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[    0.554578] NFS: Registering the id_resolver key type
[    0.554760] Key type id_resolver registered
[    0.554832] Key type id_legacy registered
[    0.555021] jffs2: version 2.2. (NAND) (SUMMARY)  ▒© 2001-2006 Red Hat, Inc.
[    0.563194] Key type asymmetric registered
[    0.563423] Asymmetric key parser 'x509' registered
[    0.563612] io scheduler noop registered
[    0.563638] io scheduler deadline registered
[    0.563833] io scheduler cfq registered (default)
[    0.563861] io scheduler mq-deadline registered
[    0.563881] io scheduler kyber registered
[    0.566735] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[    0.574996] Serial: 8250/16550 driver, 6 ports, IRQ sharing enabled
[    0.588424] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 30, base_baud = 3000000) is a 8250
[    1.303999] console [ttyS0] enabled
[    1.340912] brd: module loaded
[    1.372496] loop: module loaded
[    1.378585] mtdoops: mtd device (mtddev=name/number) must be supplied
[    1.388467] libphy: Fixed MDIO Bus: probed
[    1.467181] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
[    1.474940] davinci_mdio 4a101000.mdio: detected phy mask fffffffe
[    1.486070] libphy: 4a101000.mdio: probed
[    1.490381] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
[    1.501368] cpsw 4a100000.ethernet: Detected MACID = c4:f3:12:6a:23:4e
[    1.508530] cpsw 4a100000.ethernet: initialized cpsw ale version 1.4
[    1.514939] cpsw 4a100000.ethernet: ALE Table size 1024
[    1.520389] cpsw 4a100000.ethernet: cpts: overflow check period 500 (jiffies)
[    1.531224] i2c /dev entries driver
[    1.538418] sdhci: Secure Digital Host Controller Interface driver
[    1.544659] sdhci: Copyright(c) Pierre Ossman
[    1.550594] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
[    1.559490] omap_hsmmc 48060000.mmc: Got CD GPIO
[    1.565900] omap_hsmmc 48060000.mmc: Linked as a consumer to regulator.1
[    1.600774] omap_hsmmc 481d8000.mmc: Linked as a consumer to regulator.1
[    1.633139] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.640183] ledtrig-cpu: registered to indicate activity on CPUs
[    1.649516] oprofile: using arm/armv7
[    1.654017] Initializing XFRM netlink socket
[    1.659085] NET: Registered protocol family 10
[    1.668345] Segment Routing with IPv6
[    1.672205] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    1.680479] NET: Registered protocol family 17
[    1.685042] NET: Registered protocol family 15
[    1.690065] Key type dns_resolver registered
[    1.694513] ThumbEE CPU extension supported.
[    1.698949] Registering SWP/SWPB emulation handler
[    1.703783] omap_voltage_late_init: Voltage driver support not added
[    1.710262] sr_dev_init: Unknown instance smartreflex0
[    1.715889] SmartReflex Class3 initialized
[    1.724048] Loading compiled-in X.509 certificates
[    1.729460] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.786410] mmc0: new SDHC card at address 0001
[    1.795259] mmcblk0: mmc0:0001 SD8GB 7.28 GiB
[    1.814503]  mmcblk0: p1 p2
[    1.841577] random: fast init done
[    1.858386] mmc1: new high speed MMC card at address 0001
[    1.866540] mmcblk1: mmc1:0001 M62704 3.56 GiB
[    1.873184] mmcblk1boot0: mmc1:0001 M62704 partition 1 2.00 MiB
[    1.880952] mmcblk1boot1: mmc1:0001 M62704 partition 2 2.00 MiB
[    1.888596] mmcblk1rpmb: mmc1:0001 M62704 partition 3 512 KiB, chardev (248:0)
[    1.899865]  mmcblk1: p1
[    1.920306] tps65217 0-0024: TPS65217 ID 0xe version 1.2
[    1.926724] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[    1.936873] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
[    1.944333] hctosys: unable to open rtc device (rtc0)
[    1.949590] sr_init: No PMIC hook to init smartreflex
[    1.973961] net eth0: initializing cpsw version 1.12 (0)
[    2.078506] SMSC LAN8710/LAN8720 4a101000.mdio:00: attached PHY driver [SMSC LAN8710/LAN8720] (mii_bus:phy_addr=4a101000.mdio:00, irq=POLL)
[    2.102814] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    6.248551] cpsw 4a100000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx
[    6.277282] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[    6.307119] IP-Config: Guessing netmask 255.255.255.0
[    6.312225] IP-Config: Complete:
[    6.315484]      device=eth0, hwaddr=c4:f3:12:6a:23:4e, ipaddr=192.168.2.5, mask=255.255.255.0, gw=255.255.255.255
[    6.327636]      host=192.168.2.5, domain=, nis-domain=(none)
[    6.333443]      bootserver=255.255.255.255, rootserver=192.168.2.4, rootpath=
[    6.419468] VFS: Mounted root (nfs4 filesystem) on device 0:16.
[    6.447652] devtmpfs: mounted
[    6.453218] Freeing unused kernel memory: 1024K
[    6.460022] Run /sbin/init as init process

Please press Enter to activate this console.

Processing /etc/profile... Done

你可能感兴趣的:(nfs挂载文件系统时VFS: Unable to mount root fs on unknown-block的问题解决)