Linux | nfs挂载根文件系统失败-230712

Linux | nfs挂载根文件系统失败-230712

[    5.571613] DBUG_PORT must not use AFC!
[    5.575352] VFS: Cannot open root device "nfs" or unknown-block(0,255)
[    5.580499] Please append a correct "root=" boot option; here are the available partitions:
[    5.588832] b300         3817472 mmcblk0 driver: mmcblk
[    5.593988]   b301          264759 mmcblk0p1
[    5.598233]   b302          264759 mmcblk0p2
[    5.602479]   b303          104412 mmcblk0p3
[    5.606726]   b304         3158463 mmcblk0p4
[    5.610973] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,255)
[    5.619396] Backtrace:
[    5.621819] [<c0034fb8>] (dump_backtrace+0x0/0x110) from [<c0501498>] (dump_stack+0x18/0x1c)
[    5.630361]  r6:00008000 r5:dfecc000 r4:c06f5b6c r3:00000002
[    5.635845] [<c0501480>] (dump_stack+0x0/0x1c) from [<c0501514>] (panic+0x78/0xf8)
[    5.643408] [<c050149c>] (panic+0x0/0xf8) from [<c0008f6c>] (mount_block_root+0x25c/0x2ac)
[    5.651630]  r3:00000002 r2:00000001 r1:dfc37f60 r0:c06464fa
[    5.657249] [<c0008d10>] (mount_block_root+0x0/0x2ac) from [<c0009010>] (mount_root+0x54/0x68)
[    5.665850] [<c0008fbc>] (mount_root+0x0/0x68) from [<c0009188>] (prepare_namespace+0x164/0x1bc)
[    5.674594]  r5:c00290cd r4:c0731740
[    5.678133] [<c0009024>] (prepare_namespace+0x0/0x1bc) from [<c00084fc>] (kernel_init+0x128/0x170)
[    5.687075]  r5:c00083d4 r4:c0731500
[    5.690616] [<c00083d4>] (kernel_init+0x0/0x170) from [<c0058894>] (do_exit+0x0/0x5f0)
[    5.698511]  r4:00000000 r3:00000000
[    5.702049] Rebooting in 5 seconds..

img

更多

https://so.csdn.net/so/search?q=%E6%A0%B9%E6%96%87%E4%BB%B6%E7%B3%BB%E7%BB%9F&t=blog&u=I_feige

重新编译了一个支持nfs的内核后:

Starting logging: OK
Starting mdev...



Initializing random number generator... done.
Starting network...
ip: RTNETLINK answers: File exists
udhcpc (v1.21.0) started
Sending discover...
[   45.689568] nfs: server 192.168.1.9 not responding, still trying
[  194.884853] eth0: link down
[  196.529385] eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
[  234.252041] eth0: link down
[  235.896580] eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
[  241.119230] INFO: task udhcpc:79 blocked for more than 120 seconds.
[  241.124030] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  241.131833] udhcpc          D c050a034     0    79     73 0x00000000
[  241.138135] Backtrace:
[  241.140576] [<c0509dc4>] (schedule+0x0/0x2e8) from [<c050a0f4>] (io_schedule+0x48/0x74)
[  241.148564] [<c050a0ac>] (io_schedule+0x0/0x74) from [<c0094444>] (sync_page+0x40/0x48)
[  241.156530]  r6:c0bfdf48 r5:df421d6c r4:df421d64 r3:00000000
[  241.162164] [<c0094404>] (sync_page+0x0/0x48) from [<c050a594>] (__wait_on_bit_lock+0x5c/0xa4)
[  241.170746] [<c050a538>] (__wait_on_bit_lock+0x0/0xa4) from [<c00943dc>] (__lock_page+0x6c/0x7c)
[  241.179618] [<c0094370>] (__lock_page+0x0/0x7c) from [<c00945a8>] (find_lock_page+0x60/0x8c)
[  241.187895]  r6:000000fa r5:df82a21c r4:c08649a0
[  241.192476] [<c0094548>] (find_lock_page+0x0/0x8c) from [<c0094dc8>] (filemap_fault+0x248/0x440)
[  241.201240]  r6:000000fa r5:00000000 r4:df4009c0 r3:00000000
[  241.206867] [<c0094b80>] (filemap_fault+0x0/0x440) from [<c00a7cc8>] (__do_fault+0x54/0x438)
[  241.215290] [<c00a7c74>] (__do_fault+0x0/0x438) from [<c00a8a6c>] (handle_mm_fault+0x36c/0xc3c)
[  241.223956] [<c00a8700>] (handle_mm_fault+0x0/0xc3c) from [<c003a9f8>] (do_page_fault+0x10c/0x1fc)
[  241.232887] [<c003a8ec>] (do_page_fault+0x0/0x1fc) from [<c0033254>] (do_PrefetchAbort+0x3c/0xa0)
[  241.241716] [<c0033218>] (do_PrefetchAbort+0x0/0xa0) from [<c0033f64>] (ret_from_exception+0x0/0x10)
[  241.251889] Exception stack(0xdf421fb0 to 0xdf421ff8)
[  241.255842] 1fa0:                                     0a01a8c0 000a59f0 000002e0 beb626bc
[  241.264022] 1fc0: 0a01a8c0 0101a8c0 694fe995 694fe995 00000000 00000000 0a01a8c0 000a800b
[  241.272161] 1fe0: 401250dc beb626b8 0002b5b4 401250dc 60000010 ffffffff
[  241.278829]  r7:694fe995 r6:694fe995 r5:0101a8c0 r4:ffffffff
[  360.490313] eth0: link down
[  361.283287] INFO: task udhcpc:79 blocked for more than 120 seconds.
[  361.288085] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  361.295998] udhcpc          D c050a034     0    79     73 0x00000000
[  361.302194] Backtrace:
[  361.304626] [<c0509dc4>] (schedule+0x0/0x2e8) from [<c050a0f4>] (io_schedule+0x48/0x74)
[  361.312616] [<c050a0ac>] (io_schedule+0x0/0x74) from [<c0094444>] (sync_page+0x40/0x48)
[  361.320581]  r6:c0bfdf48 r5:df421d6c r4:df421d64 r3:00000000
[  361.326218] [<c0094404>] (sync_page+0x0/0x48) from [<c050a594>] (__wait_on_bit_lock+0x5c/0xa4)
[  361.334798] [<c050a538>] (__wait_on_bit_lock+0x0/0xa4) from [<c00943dc>] (__lock_page+0x6c/0x7c)
[  361.343553] [<c0094370>] (__lock_page+0x0/0x7c) from [<c00945a8>] (find_lock_page+0x60/0x8c)
[  361.351950]  r6:000000fa r5:df82a21c r4:c08649a0
[  361.356532] [<c0094548>] (find_lock_page+0x0/0x8c) from [<c0094dc8>] (filemap_fault+0x248/0x440)
[  361.365299]  r6:000000fa r5:00000000 r4:df4009c0 r3:00000000
[  361.370920] [<c0094b80>] (filemap_fault+0x0/0x440) from [<c00a7cc8>] (__do_fault+0x54/0x438)
[  361.379341] [<c00a7c74>] (__do_fault+0x0/0x438) from [<c00a8a6c>] (handle_mm_fault+0x36c/0xc3c)
[  361.388011] [<c00a8700>] (handle_mm_fault+0x0/0xc3c) from [<c003a9f8>] (do_page_fault+0x10c/0x1fc)
[  361.397053] [<c003a8ec>] (do_page_fault+0x0/0x1fc) from [<c0033254>] (do_PrefetchAbort+0x3c/0xa0)
[  361.405774] [<c0033218>] (do_PrefetchAbort+0x0/0xa0) from [<c0033f64>] (ret_from_exception+0x0/0x10)
[  361.414864] Exception stack(0xdf421fb0 to 0xdf421ff8)
[  361.419887] 1fa0:                                     0a01a8c0 000a59f0 000002e0 beb626bc
[  361.428048] 1fc0: 0a01a8c0 0101a8c0 694fe995 694fe995 00000000 00000000 0a01a8c0 000a800b
[  361.436184] 1fe0: 401250dc beb626b8 0002b5b4 401250dc 60000010 ffffffff
[  361.442761]  r7:694fe995 r6:694fe995 r5:0101a8c0 r4:ffffffff
[  362.150476] eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
[  392.544994] eth0: link down
[  394.189533] eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
[  481.447343] INFO: task udhcpc:79 blocked for more than 120 seconds.
[  481.452140] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  481.459942] udhcpc          D c050a034     0    79     73 0x00000000
[  481.466246] Backtrace:
[  481.468680] [<c0509dc4>] (schedule+0x0/0x2e8) from [<c050a0f4>] (io_schedule+0x48/0x74)
[  481.476674] [<c050a0ac>] (io_schedule+0x0/0x74) from [<c0094444>] (sync_page+0x40/0x48)
[  481.484636]  r6:c0bfdf48 r5:df421d6c r4:df421d64 r3:00000000
[  481.490273] [<c0094404>] (sync_page+0x0/0x48) from [<c050a594>] (__wait_on_bit_lock+0x5c/0xa4)
[  481.498857] [<c050a538>] (__wait_on_bit_lock+0x0/0xa4) from [<c00943dc>] (__lock_page+0x6c/0x7c)
[  481.507606] [<c0094370>] (__lock_page+0x0/0x7c) from [<c00945a8>] (find_lock_page+0x60/0x8c)
[  481.516128]  r6:000000fa r5:df82a21c r4:c08649a0
[  481.520588] [<c0094548>] (find_lock_page+0x0/0x8c) from [<c0094dc8>] (filemap_fault+0x248/0x440)
[  481.529351]  r6:000000fa r5:00000000 r4:df4009c0 r3:00000000
[  481.534974] [<c0094b80>] (filemap_fault+0x0/0x440) from [<c00a7cc8>] (__do_fault+0x54/0x438)
[  481.543400] [<c00a7c74>] (__do_fault+0x0/0x438) from [<c00a8a6c>] (handle_mm_fault+0x36c/0xc3c)
[  481.552063] [<c00a8700>] (handle_mm_fault+0x0/0xc3c) from [<c003a9f8>] (do_page_fault+0x10c/0x1fc)
[  481.560993] [<c003a8ec>] (do_page_fault+0x0/0x1fc) from [<c0033254>] (do_PrefetchAbort+0x3c/0xa0)
[  481.569831] [<c0033218>] (do_PrefetchAbort+0x0/0xa0) from [<c0033f64>] (ret_from_exception+0x0/0x10)
[  481.578924] Exception stack(0xdf421fb0 to 0xdf421ff8)
[  481.583943] 1fa0:                                     0a01a8c0 000a59f0 000002e0 beb626bc
[  481.592101] 1fc0: 0a01a8c0 0101a8c0 694fe995 694fe995 00000000 00000000 0a01a8c0 000a800b
[  481.600244] 1fe0: 401250dc beb626b8 0002b5b4 401250dc 60000010 ffffffff
[  481.606817]  r7:694fe995 r6:694fe995 r5:0101a8c0 r4:ffffffff


不知道你这个问题是否已经解决, 如果还没有解决的话:
  • 你可以参考下这个问题的回答, 看看是否对你有帮助, 链接: https://ask.csdn.net/questions/7629284
  • 这篇博客也不错, 你可以看下Linux驱动学习-开发板nfs挂载-20220404
  • 除此之外, 这篇博客: 嵌入式linux开发,开机NFS文件系统启动,使用nfs挂载根文件系统中的 2、直接重新启动系统。 部分也许能够解决你的问题, 你可以仔细阅读以下内容或者直接跳转源博客中阅读:

            首次系统会进行ip适配。

    VFS: Mounted root (nfs filesystem) on device 0:11.
    devtmpfs: mounted
    Freeing unused kernel memory: 272K (c0560000 - c05a4000)
    nfs: server 198.168.1.18 not responding, still trying
    nfs: server 198.168.1.18 not responding, still trying
    nfs: server 198.168.1.18 OK
    nfs: server 198.168.1.18 OK
    
    
    BusyBox v1.22.1 (2016-02-03 14:11:04 CST) built-in shell (ash)
    Enter 'help' for a list of built-in commands.
    
    ~ #
    

             第二次启动系统。

    VFS: Mounted root (nfs filesystem) on device 0:11.
    devtmpfs: mounted
    Freeing unused kernel memory: 272K (c0560000 - c05a4000)
    
    
    BusyBox v1.22.1 (2016-02-03 14:11:04 CST) built-in shell (ash)
    Enter 'help' for a list of built-in commands.
    
    ~ #
    

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^

编译rootfs报错:

rm -f /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/build/_fakeroot.fs
rm -f /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/target/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
echo "chown -R 0:0 /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/target" >> /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/build/_fakeroot.fs
cat system/device_table.txt  > /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/build/_device_table.txt
printf '\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n /bin/busybox                     f 4755 0 0 - - - - -\n/usr/share/udhcpc/default.script f 755  0 0 - - - - -\n \n \n \n \n \n \n \n /dev/console c 622 0 0 5 1 - - -\n' >> /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/build/_device_table.txt
echo "/home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/host/usr/bin/makedevs -d /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/build/_device_table.txt /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/target" >> /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/build/_fakeroot.fs
echo " tar -c""f /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/images/rootfs.tar -C /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/target ." >> /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/build/_fakeroot.fs
chmod a+x /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/build/_fakeroot.fs
/home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/host/usr/bin/fakeroot -- /home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/build/_fakeroot.fs
fakeroot: preload library `libfakeroot.so' not found, aborting.
fs/tar/tar.mk:13: recipe for target '/home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/images/rootfs.tar' failed
make: *** [/home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/images/rootfs.tar] Error 1

【问题解决】报错:fakeroot: preload library libfakeroot.so‘ not found, aborting_fakeroot: preload library libfakeroot.so' not fou_JavonPeng的博客-CSDN博客

重新编译报其他错误:

 -c ../ncurses/./base/lib_initscr.c -o ../objects/lib_initscr.o
In file included from ../ncurses/curses.priv.h:283:0,
                 from ../ncurses/lib_gen.c:19:
_91844.c:835:15: error: expected ‘)’ before ‘int’
../include/curses.h:1594:56: note: in definition of macro ‘mouse_trafo’
 #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen)
                                                        ^
Makefile:785: recipe for target '../objects/lib_gen.o' failed
make[2]: *** [../objects/lib_gen.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/build/host-ncurses-5.9/ncurses'
Makefile:307: recipe for target '../lib/libncurses.a' failed
make[1]: *** [../lib/libncurses.a] Error 2
make[1]: Leaving directory '/home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/build/host-ncurses-5.9/progs'
package/pkg-generic.mk:114: recipe for target '/home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/build/host-ncurses-5.9/.stamp_built' failed
make: *** [/home/fly/project/x210bv3s/qt_x210v3s_160307/buildroot/output/build/host-ncurses-5.9/.stamp_built] Error 2


[    6.103604] eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
[    7.111547] IP-Config: Complete:
[    7.113117]      device=eth0, addr=192.168.1.100, mask=255.255.255.0, gw=192.168.1.1,
[    7.120832]      host=192.168.1.100, domain=, nis-domain=(none),
[    7.126823]      bootserver=192.168.1.9, rootserver=192.168.1.9, rootpath=
[    7.134047] DBUG_PORT must not use AFC!
[    7.137800] Looking up port of RPC 100003/2 on 192.168.1.9
[    7.228237] Looking up port of RPC 100005/1 on 192.168.1.9
[    7.365995] Root-NFS: Server returned error -13 while mounting /opt/rootfs
[    7.371435] VFS: Unable to mount root fs via NFS, trying floppy.
[    7.377664] VFS: Cannot open root device "nfs" or unknown-block(2,0)
[    7.383832] Please append a correct "root=" boot option; here are the available partitions:
[    7.392051] b300         3817472 mmcblk0 driver: mmcblk
[    7.397231]   b301          264759 mmcblk0p1
[    7.401455]   b302          264759 mmcblk0p2
[    7.405701]   b303          104412 mmcblk0p3
[    7.409947]   b304         3158463 mmcblk0p4
[    7.414194] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
[    7.422444] Backtrace:
[    7.424873] [<c0037fb8>] (dump_backtrace+0x0/0x110) from [<c0509828>] (dump_stack+0x18/0x1c)
[    7.433275]  r6:00008000 r5:dfecc000 r4:c0701b6c r3:00000002
[    7.438894] [<c0509810>] (dump_stack+0x0/0x1c) from [<c05098a4>] (panic+0x78/0xf8)
[    7.446454] [<c050982c>] (panic+0x0/0xf8) from [<c0008fa8>] (mount_block_root+0x1d8/0x218)
[    7.454679]  r3:00000002 r2:00000001 r1:dfc37f60 r0:c064f8aa
[    7.460297] [<c0008dd0>] (mount_block_root+0x0/0x218) from [<c00090ac>] (mount_root+0xc4/0xf8)
[    7.468895] [<c0008fe8>] (mount_root+0x0/0xf8) from [<c0009244>] (prepare_namespace+0x164/0x1bc)
[    7.477642]  r5:c002b331 r4:c073d900
[    7.481181] [<c00090e0>] (prepare_namespace+0x0/0x1bc) from [<c00084fc>] (kernel_init+0x128/0x170)
[    7.490121]  r5:c00083d4 r4:c073d6c0
[    7.493665] [<c00083d4>] (kernel_init+0x0/0x170) from [<c005b894>] (do_exit+0x0/0x5f0)
[    7.501563]  r4:00000000 r3:00000000
[    7.505098] Rebooting in 5 seconds..

img

还没到nfs的挂载,内核已经挂了!要检查下内核的配置!