全志V3s之NFS连接ubuntu22.04

2023-12-14 22:41:54

1、问题一:

[  100.329728] VFS: Unable to mount root fs via NFS, trying floppy.
[  100.336262] VFS: Cannot open root device "nfs" or unknown-block(2,0): error -6
[  100.343580] Please append a correct "root=" boot option; here are the available partitions:
[  100.351978] b300        15558144 mmcblk0
[  100.351982]  driver: mmcblk
[  100.358777]   b301           32768 mmcblk0p1 0edd73af-01
[  100.358779]
[  100.365591]   b302        15523840 mmcblk0p2 0edd73af-02
[  100.365593]
[  100.372399] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)
[  100.380655] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.0-licheepi-zero+ #4
[  100.387777] Hardware name: Allwinner sun8i Family
[  100.392510] [<c010ed14>] (unwind_backtrace) from [<c010b72c>] (show_stack+0x10/0x14)
[  100.400251] [<c010b72c>] (show_stack) from [<c0734290>] (dump_stack+0x84/0x98)
[  100.407472] [<c0734290>] (dump_stack) from [<c011dddc>] (panic+0x110/0x2fc)
[  100.414431] [<c011dddc>] (panic) from [<c0a0136c>] (mount_block_root+0x1a0/0x288)
[  100.421908] [<c0a0136c>] (mount_block_root) from [<c0a01598>] (mount_root+0x144/0x160)
[  100.429817] [<c0a01598>] (mount_root) from [<c0a01704>] (prepare_namespace+0x150/0x194)
[  100.437815] [<c0a01704>] (prepare_namespace) from [<c074c6e4>] (kernel_init+0x8/0x10c)
[  100.445727] [<c074c6e4>] (kernel_init) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
[  100.453284] Exception stack(0xc3833fb0 to 0xc3833ff8)
[  100.458331] 3fa0:                                     00000000 00000000 00000000 00000000
[  100.466498] 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  100.474664] 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[  100.481283] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0) ]---

出现以上问题,主要是NFS版本的问题。
NFS是一种网络文件系统,它允许计算机通过网络共享文件和目录。
在Linux内核中,NFS实现作为内核模块存在,可以在需要时加载。NFS在Linux内核的许多版本中都得到了支持,从2.0版本开始就有了NFSv2,2.2版本开始支持NFSv3,2.6版本开始支持NFSv4。此外,还有一些可选的NFS相关内核模块,例如nfsd(NFS服务器),nfs_acl(NFS访问控制列表)和lockd(NFS文件锁定)。这些模块可以通过编译内核或者作为模块编译后加载到内核中,以提供支持NFS所需的功能。因此,具体使用哪个版本的内核取决于您的应用程序和环境需要的功能和兼容性。
默认情况下,在 Ubuntu 22.04 上禁用 NFS 版本 2。 版本 3 和 4 已启用。为使用NFS进行连接,可以使用以下指令进行设置:

console=ttyS0,115200 root=/dev/nfs nfsroot=XXXXXXXXX:XXXXXXXXX/nfs/rootfs,v3 proto=tcp rw ip=XXXXXXXXXXXXXXXXXXX::eth0:off init=/linuxrc 

xxxxxx改为自己的IP即可。

2、问题二:

[    4.610226] Run /linuxrc as init process
[    4.662182] random: fast init done
mount: you must be root
mount: you must be root
mkdir: can't create directory '/dev/pts': Permission denied
mkdir: can't create directory '/dev/shm': Permission denied
mount: you must be root
hostname: sethostname: Operation not permitted
Starting logging: OK
Initializing random number generator... [    5.634798] random: dd: uninitialized urandom read (512 bytes read)
done.
Starting network: ip: RTNETLINK answers: Operation not permitted
FAIL
can't open /dev/console: Permission denied
can't open /dev/console: Permission denied
can't open /dev/console: Permission denied
can't open /dev/console: Permission denied
can't open /dev/console: Permission denied
can't open /dev/console: Permission denied

出现以上问题,主要是由于初始化时权限不够造成的,可以在U-Boot环境变量的bootargs变量中添加init=/linuxrc 并将linuxrc文件的权限设置为777

文章来源:https://blog.csdn.net/a_qwq_a/article/details/135004949
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。