mount: mounting on /mnt failed: Connection refused

文章描述了在尝试将Imx6ull开发板挂载到Ubuntu服务器上的NFS共享时遇到的三个问题及解决方案。首先,由于未配置/etc/exports,导致挂载失败,通过安装nfs-kernel-server和配置exports文件解决了问题。其次,更新内核后开发板无法ping通服务器,发现eth1网络接口消失,通过运行udhcpc获取IP并修复。最后,挂载失败的权限问题是因为NFS共享目录路径改变,更新exports文件并重启服务后解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

目录

1 mount: mounting 192.168.1.10:/data1/chw/imx6ull_20230512/nfs_rootfs on /mnt failed: Connection refused

2  mount -t nfs -o nolock,vers=3 192.168.1.10:/data1/chw/imx6ull_20230512/nfs_rootfs /mntmount: mounting 192.168.1.10:/data1/chw/imx6ull_20230512/nfs_rootfs on /mnt failed: No route to host

3 mount: mounting 192.168.1.10:/data/chw/imx6ull_20230512/nfs_rootfs on /mnt failed: Permission denied


1 mount: mounting 192.168.1.10:/data1/chw/imx6ull_20230512/nfs_rootfs on /mnt failed: Connection refused

想把Imx6ull开发板挂载到ubuntu上,韦东山老师是挂载到vmware虚拟机上,我不用虚拟机,直接用ubuntu服务器,在使用如下命令挂载时提示

mount -t nfs -o nolock,vers=3 192.168.1.10:/data1/chw/imx6ull_20230512/nfs_rootfs  /mnt
mount: mounting 192.168.1.10:/data1/chw/imx6ull_20230512/nfs_rootfs on /mnt failed: Connection refused

我再ubuntu服务器和Linux开发板上相互ping是可以通的,问题不在这,查了下发现忘记配置/etc/exports,操作如下

sudo apt-get install nfs-kernel-server

vim /etc/exports  #然后在/etc/exports增加如下一行内容
/data1/chw/imx6ull_20230512/  *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)

sudo /etc/init.d/nfs-kernel-server restart

然后再次挂载成功。

2  mount -t nfs -o nolock,vers=3 192.168.1.10:/data1/chw/imx6ull_20230512/nfs_rootfs /mnt
mount: mounting 192.168.1.10:/data1/chw/imx6ull_20230512/nfs_rootfs on /mnt failed: No route to host

当我编译了内核、设备树和驱动模块,然后把imx6ull开发板的内核和驱动都替换掉,然后重启开发板,再次挂载出现如下错误

 mount -t nfs -o nolock,vers=3 192.168.1.10:/data1/chw/imx6ull_20230512/nfs_rootfs /mnt
mount: mounting 192.168.1.10:/data1/chw/imx6ull_20230512/nfs_rootfs on /mnt failed: No route to host

看了下发现在开发板上ping 192.168.1.10已经不通了,这时候在开发板上ifconfig发现没有eth1了,

 这时候使用如下命令

udhcpc  -i  eth1

这样就可以获取eth1的IP地址。然后ifconfig

 然后再次挂载就可以了。

3 mount: mounting 192.168.1.10:/data/chw/imx6ull_20230512/nfs_rootfs on /mnt failed: Permission denied

某一次再次执行命令

mount -t nfs -o nolock,vers=3 192.168.1.10:/data/chw/imx6ull_20230512/nfs_rootfs /mnt

报下面的错误:

[root@imx6ull:/mnt]# mount -t nfs -o nolock,vers=3 192.168.1.10:/data/chw/imx6ull_20230512/nfs_rootfs /mnt
mount: mounting 192.168.1.10:/data/chw/imx6ull_20230512/nfs_rootfs on /mnt failed: Permission denied

报错原因是服务器上我的rootfs换了路径,之前是/data1/chw/imx6ull_20230512/nfs_rootfs,现在是/data/chw/imx6ull_20230512/nfs_rootfs,所以我要重新修改/etc/exports文件,

修改完之后要用下面的命令重启nfs服务器,否则挂载还是报错 

sudo /etc/init.d/nfs-kernel-server restart

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

陈 洪 伟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值