您尚未登录。

#1 2024-03-30 22:24:02

暗影翔
会员
注册时间: 2024-03-30
帖子: 2

如何实现开机启动自动挂载nfs

本人只是闲来瞎折腾的非超能力者,瞎折腾linux。
有一台aib的服务器,运行omv系统共享nfs。原先大奶使用manjaro,在fstab里设置可以挂载服务器里的资源,在dolphin里点一下远程位置里的挂载文件夹即可访问。
后来折腾把manjaro换成了arch,依然是在fstab里设置,但是启动时可以看到mount failed的日志。通过journalctl -b | grep mount查询到在执行mount.nfs时,网络不可达。
fstab里的设置是

192.168.0.105:/export   /mnt            nfs             defaults,timeo=900,retrans=5,_netdev            0 0

查询日志

    3月 30 21:18:51 Main-PC kernel: mlx4_en: eth0: Link Up
    3月 30 21:18:51 Main-PC kernel: NFS: Registering the id_resolver key type
    3月 30 21:18:51 Main-PC kernel: Key type id_resolver registered
    3月 30 21:18:51 Main-PC kernel: Key type id_legacy registered
    3月 30 21:18:51 Main-PC mount[689]: mount.nfs: Network is unreachable for 192.168.0.105:/export on /mnt
    3月 30 21:18:51 Main-PC systemd[1]: mnt.mount: Mount process exited, code=exited, status=32/n/a
    3月 30 21:18:51 Main-PC systemd[1]: mnt.mount: Failed with result 'exit-code'.
    3月 30 21:18:51 Main-PC systemd[1]: Failed to mount /mnt.
    3月 30 21:18:51 Main-PC systemd[1]: Dependency failed for /mnt/video.
    3月 30 21:18:51 Main-PC systemd[1]: Dependency failed for Remote File Systems.
    3月 30 21:18:51 Main-PC systemd[1]: remote-fs.target: Job remote-fs.target/start failed with result 'dependency'.
    3月 30 21:18:51 Main-PC systemd[1]: mnt-video.mount: Job mnt-video.mount/start failed with result 'dependency'.
    3月 30 21:18:51 Main-PC systemd[1]: Dependency failed for /mnt/download.
    3月 30 21:18:51 Main-PC systemd[1]: mnt-download.mount: Job mnt-download.mount/start failed with result 'dependency'.
    3月 30 21:18:51 Main-PC systemd[1]: Dependency failed for /mnt/Music.
    3月 30 21:18:51 Main-PC systemd[1]: mnt-Music.mount: Job mnt-Music.mount/start failed with result 'dependency'.
    3月 30 21:18:51 Main-PC systemd[1]: Dependency failed for /mnt/photo.
    3月 30 21:18:51 Main-PC systemd[1]: mnt-photo.mount: Job mnt-photo.mount/start failed with result 'dependency'.
    3月 30 21:18:51 Main-PC systemd[1]: Dependency failed for /mnt/PT.
    3月 30 21:18:51 Main-PC systemd[1]: mnt-PT.mount: Job mnt-PT.mount/start failed with result 'dependency'.
    3月 30 21:18:51 Main-PC systemd[1]: Dependency failed for /mnt/winstorge.
    3月 30 21:18:51 Main-PC systemd[1]: mnt-winstorge.mount: Job mnt-winstorge.mount/start failed with result 'dependency'.
    3月 30 21:18:51 Main-PC kernel: <mlx4_ib> mlx4_ib_probe: mlx4_ib: Mellanox ConnectX InfiniBand driver v4.0-0
    3月 30 21:18:51 Main-PC systemd[1]: TPM2 PCR Barrier (User) was skipped because of an unmet condition check (ConditionSecurity=measured-uki).
    3月 30 21:18:51 Main-PC kernel: <mlx4_ib> mlx4_ib_probe: counter index 1 for port 1 allocated 1
    3月 30 21:18:51 Main-PC kernel: mlx4_core 0000:0c:00.0 enp12s0: renamed from eth0
    3月 30 21:18:51 Main-PC systemd[1]: Starting Permit User Sessions...
    3月 30 21:18:51 Main-PC systemd[1]: Finished Permit User Sessions.
    3月 30 21:18:51 Main-PC systemd[1]: Reached target Multi-User System.
    3月 30 21:18:51 Main-PC systemd[1]: Started Simple Desktop Display Manager.
    3月 30 21:18:51 Main-PC systemd[1]: Reached target Graphical Interface.
    3月 30 21:18:51 Main-PC systemd[1]: Startup finished in 18.052s (firmware) + 7.552s (loader) + 6.305s (kernel) + 8.001s (userspace) = 39.911s.
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.4174] device (eth0): interface index 3 renamed iface from 'eth0' to 'enp12s0'
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.4208] device (enp12s0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
    3月 30 21:18:51 Main-PC kernel: mlx4_en: enp12s0: Steering Mode 1
    3月 30 21:18:51 Main-PC kernel: mlx4_en: enp12s0: Link Up
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.4640] settings: (enp12s0): created default wired connection 'Wired connection 2'
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.4642] device (enp12s0): carrier: link connected
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.4651] device (enp12s0): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.4654] policy: auto-activating connection 'Wired connection 2' (11e70bbe-e8f7-3b41-bc80-cd0b2a20ba79)
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.4656] device (enp12s0): Activation: starting connection 'Wired connection 2' (11e70bbe-e8f7-3b41-bc80-cd0b2a20ba79)
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.4656] device (enp12s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.4657] manager: NetworkManager state is now CONNECTING
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.4658] device (enp12s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.4660] device (enp12s0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.4662] dhcp4 (enp12s0): activation: beginning transaction (timeout in 45 seconds)
    3月 30 21:18:51 Main-PC sddm[713]: Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8.
                                        Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
                                        If this causes problems, reconfigure your locale. See the locale(1) manual
                                        for more information.
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.4683] dhcp4 (enp12s0): state changed new lease, address=192.168.0.101, acd pending
    3月 30 21:18:51 Main-PC sddm[713]: Initializing...
    3月 30 21:18:51 Main-PC sddm[713]: Starting...
    3月 30 21:18:51 Main-PC sddm[713]: Logind interface found
    3月 30 21:18:51 Main-PC sddm[713]: Adding new display...
    3月 30 21:18:51 Main-PC sddm[713]: Loaded empty theme configuration
    3月 30 21:18:51 Main-PC sddm[713]: Xauthority path: "/run/sddm/xauth_syoTia"
    3月 30 21:18:51 Main-PC sddm[713]: Using VT 2
    3月 30 21:18:51 Main-PC sddm[713]: Display server starting...
    3月 30 21:18:51 Main-PC sddm[713]: Writing cookie to "/run/sddm/xauth_syoTia"
    3月 30 21:18:51 Main-PC sddm[713]: Running: /usr/bin/X -nolisten tcp -background none -seat seat0 vt2 -auth /run/sddm/xauth_syoTia -noreset -displayfd 16
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.6282] dhcp4 (enp12s0): state changed new lease, address=192.168.0.101
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.6283] policy: set 'Wired connection 2' (enp12s0) as default for IPv4 routing and DNS
    3月 30 21:18:51 Main-PC dbus-broker-launch[631]: Activation request for 'org.freedesktop.resolve1' failed: The systemd unit 'dbus-org.freedesktop.resolve1.service' could not be found.
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.6662] device (enp12s0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.6668] device (enp12s0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.6669] device (enp12s0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.6670] manager: NetworkManager state is now CONNECTED_SITE
    3月 30 21:18:51 Main-PC NetworkManager[633]: <info>  [1711804731.6671] device (enp12s0): Activation: successful, device activated.

虽然最初内核里mlx4 link up了,但是网络启动未完成,后续networkmanager接手才完成了网络启动。
想知道这该如何处理。

离线

#2 2024-03-30 23:02:12

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,821
个人网站

Re: 如何实现开机启动自动挂载nfs

noauto,x-systemd.automount

离线

#3 2024-03-30 23:02:49

依云
会员
所在地: a.k.a. 百合仙子
注册时间: 2011-08-21
帖子: 8,821
个人网站

Re: 如何实现开机启动自动挂载nfs

离线

#4 2024-04-04 20:49:45

暗影翔
会员
注册时间: 2024-03-30
帖子: 2

Re: 如何实现开机启动自动挂载nfs

非常感谢,我去试试

离线

页脚