Debian 10 机器不会从 /etc/fstab 挂载 NFS 共享,但执行mount -a
挂载该共享。我注意到启动时间更长了。
# systemctl status home-user-weather-images.mount
● home-user-weather-images.mount - /home/user/weather/images
Loaded: loaded (/etc/fstab; enabled-runtime; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2020-10-23 05:36:34 EDT; 1min 1s ago
Where: /home/user/weather/images
What: 192.168.1.115:/volume1/user/Pictures/NOAA-images/
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Oct 23 05:36:34 host systemd[1]: Mounting /home/user/weather/images...
Oct 23 05:36:34 host mount[529]: mount.nfs: Network is unreachable
Oct 23 05:36:34 host systemd[1]: home-user-weather-images.mount: Mount
process exited, code=exited, status=32/n/a
Oct 23 05:36:34 host systemd[1]: home-user-weather-images.mount: Failed with result
'exit-code'.
Oct 23 05:36:34 host systemd[1]: Failed to mount /home/user/weather/images.
以下是我尝试过的 fstab 条目:
192.168.1.115:/volume1/user/Pictures/NOAA-images/ /home/user/weather/images nfs
ac,user,nfsvers=3,x-systemd.requires=network-online.target,x-systemd.device-timeout=100
0 0
192.168.1.115:/volume1/user/Pictures/NOAA-images/ /home/user/weather/images nfs ac,user,nfsvers=3,_netdev 0 0
也尝试过,但没有成功:
systemctl reenable home-user-weather-images.mount
systemctl daemon-reload
使用 x-systemd 选项时,fstab 条目的服务如下所示:
# Automatically generated by systemd-fstab-generator
[Unit]
SourcePath=/etc/fstab
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
Before=remote-fs.target
After=network-online.target
Requires=network-online.target
[Mount]
Where=/home/user/weather/images
What=192.168.1.115:/volume1/user/Pictures/NOAA-images/
Type=nfs
Options=ac,user,nfsvers=3,x-systemd.requires=network-online.target
# dmesg | grep fstab
[ 5.157559] systemd-fstab-generator[260]: x-systemd.device-timeout ignored for 192.168.1.115:/volume1/user/Pictures/NOAA-images/
[ 114.512926] systemd-fstab-generator[1025]: x-systemd.device-timeout ignored for 192.168.1.115:/volume1/user/Pictures/NOAA-images/
[ 470.095851] systemd-fstab-generator[1162]: x-systemd.device-timeout ignored for 192.168.1.115:/volume1/user/Pictures/NOAA-images/
# dmesg | grep nfs
[no output]
答案1
我建议采取两项行动:
1- 将以下内容添加到挂载选项中以延迟挂载一段时间:
[Mount]
Options=late,nofail,x-systemd.automount,x-systemd.requires=network-online.target,x-systemd.device-timeout=10 0 0
2- 在本节中安装 添加上述内容,以便在到达之前安装 nfs 安装远程文件系统目标。
[Install] WantedBy=remote-fs.target
有时这可能是由于 DNS 解析造成的,但我在这里没有看到它。
编辑:由于您有一个嵌入式 eno0 接口,您必须在 DHCP 配置中用正确的名称声明它,这就是为什么您有找不到 eth0 设备有时启用/禁用 NetworkManager 可能会导致 NIC 命名混淆。
答案2
/etc/network/interfaces.d/setup
需要编辑该文件以反映从 eth0 到 eno1 的正确设备。
networking.service 也失败了(但不知何故 networking 设法工作)。我的 /etc/default/networking 和 /etc/dhcp/* 文件未修改。以下是 的输出journalctl -u networking.service
:
-- Logs begin at Fri 2020-10-23 06:57:31 EDT, end at Fri 2020-10-23 07:00:15 EDT. --
Oct 23 06:57:32 host systemd[1]: Starting Raise network interfaces...
Oct 23 06:57:32 host ifup[425]: Internet Systems Consortium DHCP Client 4.4.1
Oct 23 06:57:32 host ifup[425]: Copyright 2004-2018 Internet Systems Consortium.
Oct 23 06:57:32 host ifup[425]: All rights reserved.
Oct 23 06:57:32 host ifup[425]: For info, please visit https://www.isc.org/software/dhcp/
Oct 23 06:57:32 host dhclient[492]: Internet Systems Consortium DHCP Client 4.4.1
Oct 23 06:57:32 host dhclient[492]: Copyright 2004-2018 Internet Systems Consortium.
Oct 23 06:57:32 host dhclient[492]: All rights reserved.
Oct 23 06:57:32 host dhclient[492]: For info, please visit https://www.isc.org/software/dhcp/
Oct 23 06:57:32 host dhclient[492]:
Oct 23 06:57:32 host ifup[425]: Cannot find device "eth0"
Oct 23 06:57:32 host dhclient[492]: Failed to get interface index: No such device
Oct 23 06:57:32 host ifup[425]: Failed to get interface index: No such device
Oct 23 06:57:32 host ifup[425]: If you think you have received this message due to a bug rather
Oct 23 06:57:32 host ifup[425]: than a configuration issue please read the section on submitting
Oct 23 06:57:32 host ifup[425]: bugs on either our web page at www.isc.org or in the README file
Oct 23 06:57:32 host ifup[425]: before submitting a bug. These pages explain the proper
Oct 23 06:57:32 host ifup[425]: process and the information we find helpful for debugging.
Oct 23 06:57:32 host ifup[425]: exiting.
Oct 23 06:57:32 host dhclient[492]:
Oct 23 06:57:32 host dhclient[492]: If you think you have received this message due to a bug rather
Oct 23 06:57:32 host dhclient[492]: than a configuration issue please read the section on submitting
Oct 23 06:57:32 host dhclient[492]: bugs on either our web page at www.isc.org or in the README file
Oct 23 06:57:32 host dhclient[492]: before submitting a bug. These pages explain the proper
Oct 23 06:57:32 host dhclient[492]: process and the information we find helpful for debugging.
Oct 23 06:57:32 host dhclient[492]:
Oct 23 06:57:32 host dhclient[492]: exiting.
但是我的以太网设备是eno1:
$ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 54:b2:03:8d:53:f6 brd ff:ff:ff:ff:ff:ff
再次检查 dmesg...
# dmesg | grep -i eth
[ 3.170430] e1000e 0000:00:1f.6 eth0: (PCI Express:2.5GT/s:Width x1) 54:b2:03:8d:53:f6
[ 3.170431] e1000e 0000:00:1f.6 eth0: Intel(R) PRO/1000 Network Connection
[ 3.170489] e1000e 0000:00:1f.6 eth0: MAC: 12, PHY: 12, PBA No: FFFFFF-0FF
[ 3.171438] e1000e 0000:00:1f.6 eno1: renamed from eth0
回到 Google,查找 ifup 无法找到重命名接口的原因。偶然发现了这个答案. 检查我的/etc/network/interfaces.d/setup
:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
... 看起来像是确凿的证据。我从未编辑过此文件;这是一周前的安装,所以我不知道为什么会出现此问题。编辑了该文件,将 fstab 恢复为非 x-systemd 条目并重新启动。现在它可以正常工作了。
在我考虑回答我自己的问题之前,如果有人能解释为什么会发生这种混乱,那将会很有趣,那么这可能是“最好的答案”。