Meu laptop tem um adaptador Ethernet USB. Aparentemente, a rede não aparece até mais tarde no processo de inicialização do que o normal. Meus compartilhamentos NFS não estão montando na inicialização. No entanto, assim que o laptop é inicializado, posso montar todos os compartilhamentos com este comando:
mount -a -t nfs,nfs4
Não há erros e está tudo bem nesse momento. No entanto, gostaria que os compartilhamentos fossem montados no momento da inicialização automaticamente. Portanto, isso é não uma questão de configuração do NFS. Eu acredito que este problema está relacionado ao systemd, o processo de inicialização e talvez o tempo de disponibilidade do adaptador Ethernet USB.
Aqui está tudo o que sei verificar, incluindo as partes relevantes da revista, mostrando que a rede surge depois que os compartilhamentos NFS desistiram de tentar montar. Eu incluí os arquivos de configuração relevantes, mas eles não foram alterados dos padrões (até onde eu sei).
Jul 31 21:22:32 host systemd[1]: Mounted /var/log.
...
Jul 31 21:22:33 host mount[898]: mount.nfs: Network is unreachable
...
Jul 31 21:22:34 host mount[880]: mount.nfs: Resource temporarily unavailable
Jul 31 21:22:34 host systemd[1]: share1.mount: Mount process exited, code=exited status=32
Jul 31 21:22:34 host systemd[1]: share1.mount: Failed with result 'exit-code'.
Jul 31 21:22:34 host autossh[896]: starting ssh (count 9)
Jul 31 21:22:34 host autossh[896]: ssh child pid is 1033
Jul 31 21:22:34 host systemd[1]: Failed to mount /share1.
...
Jul 31 21:22:37 host autossh[899]: ssh: connect to host 10.10.0.201 port 22: Network is unreachable
Jul 31 21:22:37 host autossh[899]: ssh exited with error status 255; restarting ssh
...
Jul 31 21:22:38 host NetworkManager[792]: <info> [1533086558.3237] manager: NetworkManager state is now CONNECTING
...
Jul 31 21:22:38 host NetworkManager[792]: <info> [1533086558.3487] manager: NetworkManager state is now CONNECTED_LOCAL
Jul 31 21:22:38 host NetworkManager[792]: <info> [1533086558.3492] manager: NetworkManager state is now CONNECTED_SITE
Jul 31 21:22:38 host NetworkManager[792]: <info> [1533086558.3493] policy: set 'Wired connection 1' (eth1) as default for IPv4 routing and DNS
Jul 31 21:22:38 host NetworkManager[792]: <info> [1533086558.3497] device (eth1): Activation: successful, device activated.
Jul 31 21:22:38 host nm-dispatcher[1017]: req:3 'up' [eth1]: new request (0 scripts)
# systemctl status NetworkManager.service
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/NetworkManager.service.d
└─NetworkManager-ovs.conf
Active: active (running) since Tue 2018-07-31 21:22:33 EDT; 42min ago
Docs: man:NetworkManager(8)
Main PID: 792 (NetworkManager)
Tasks: 3 (limit: 4915)
Memory: 33.4M
CGroup: /system.slice/NetworkManager.service
└─792 /usr/bin/NetworkManager --no-daemon
Jul 31 22:00:59 host NetworkManager[792]: <info> [1533088859.6259] dhcp4 (eth1): gateway 192.168.0.1
Jul 31 22:00:59 host NetworkManager[792]: <info> [1533088859.6334] dhcp4 (eth1): state changed bound -> bound
Jul 31 22:03:12 host NetworkManager[792]: <info> [1533088992.7755] dhcp4 (eth1): address 192.168.0.237
Jul 31 22:03:12 host NetworkManager[792]: <info> [1533088992.7756] dhcp4 (eth1): plen 24
Jul 31 22:03:12 host NetworkManager[792]: <info> [1533088992.7756] dhcp4 (eth1): expires in 300 seconds
Jul 31 22:03:12 host NetworkManager[792]: <info> [1533088992.7757] dhcp4 (eth1): nameserver '192.168.0.1'
Jul 31 22:03:12 host NetworkManager[792]: <info> [1533088992.7758] dhcp4 (eth1): domain name 'oaks'
Jul 31 22:03:12 host NetworkManager[792]: <info> [1533088992.7758] dhcp4 (eth1): hostname 'host'
Jul 31 22:03:12 host NetworkManager[792]: <info> [1533088992.7759] dhcp4 (eth1): gateway 192.168.0.1
Jul 31 22:03:12 host NetworkManager[792]: <info> [1533088992.7769] dhcp4 (eth1): state changed bound -> bound
# systemctl status share1.mount
● share1.mount - /share1
Loaded: loaded (/etc/fstab; generated)
Active: failed (Result: exit-code) since Tue 2018-07-31 21:22:34 EDT; 25min ago
Where: /share1
What: server:/share1/
Docs: man:fstab(5)
man:systemd-fstab-generator(8)
Jul 31 21:22:33 host systemd[1]: Mounting /share1...
Jul 31 21:22:34 host mount[880]: mount.nfs: Resource temporarily unavailable
Jul 31 21:22:34 host systemd[1]: share1.mount: Mount process exited, code=exited status=32
Jul 31 21:22:34 host systemd[1]: share1.mount: Failed with result 'exit-code'.
Jul 31 21:22:34 host systemd[1]: Failed to mount /share1.
# cat /usr/lib/systemd/system/NetworkManager.service
[Unit]
Description=Network Manager
Documentation=man:NetworkManager(8)
Wants=network.target
After=network-pre.target dbus.service
Before=network.target
[Service]
Type=dbus
BusName=org.freedesktop.NetworkManager
ExecReload=/usr/bin/dbus-send --print-reply --system --type=method_call --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager.Reload uint32:0
#ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/bin/NetworkManager --no-daemon
Restart=on-failure
# NM doesn't want systemd to kill its children for it
KillMode=process
CapabilityBoundingSet=CAP_NET_ADMIN CAP_DAC_OVERRIDE CAP_NET_RAW CAP_NET_BIND_SERVICE CAP_SETGID CAP_SETUID CAP_SYS_MODULE CAP_AUDIT_WRITE CAP_KILL CAP_SYS_CHROOT
# ibft settings plugin calls iscsiadm which needs CAP_SYS_ADMIN
#CapabilityBoundingSet=CAP_SYS_ADMIN
ProtectSystem=true
ProtectHome=read-only
[Install]
WantedBy=multi-user.target
Alias=dbus-org.freedesktop.NetworkManager.service
Also=NetworkManager-dispatcher.service
# We want to enable NetworkManager-wait-online.service whenever this service
# is enabled. NetworkManager-wait-online.service has
# WantedBy=network-online.target, so enabling it only has an effect if
# network-online.target itself is enabled or pulled in by some other unit.
Also=NetworkManager-wait-online.service
# cat /usr/lib/systemd/system/NetworkManager.service.d/NetworkManager-ovs.conf
[Unit]
After=openvswitch.service
# cat /etc/NetworkManager/NetworkManager.conf
# Configuration file for NetworkManager.
# See "man 5 NetworkManager.conf" for details.
# tree /etc/NetworkManager/conf.d/
/etc/NetworkManager/conf.d/
0 directories, 0 files
# cat /usr/lib/systemd/system/NetworkManager-wait-online.service
[Unit]
Description=Network Manager Wait Online
Documentation=man:nm-online(1)
Requires=NetworkManager.service
After=NetworkManager.service
Before=network-online.target
[Service]
Type=oneshot
ExecStart=/usr/bin/nm-online -s -q --timeout=30
RemainAfterExit=yes
[Install]
WantedBy=network-online.target
Arch Linux 4.17.11-arch1 #1 SMP PREEMPT Sun Jul 29 10:11:16 UTC 2018 x86_64 GNU/Linux
KDE
ATUALIZAÇÃO: aqui está a informação solicitada sobre o fstab:
Todas as montagens do nfs têm estas opções:
nfs _netdev,defaults,noatime,nodiratime,soft,retrans=6,timeo=20,retry=0,rsize=32768,wsize=32768,proto=tcp 0 0
Estou realmente usando o _netdev junto com o systemd. Depois de ler o comentário de Filipe Brandenburger, não tenho a certeza se esta opção não tem sentido em systemd ou prejudicial.
systemctl cat share1.mount
# /run/systemd/generator/share1.mount
# Automatically generated by systemd-fstab-generator
[Unit]
SourcePath=/etc/fstab
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
Before=remote-fs.target
[Mount]
Where=/share1
What=server:/share1/
Type=nfs
Options=_netdev,defaults,noatime,nodiratime,soft,retrans=6,timeo=20,retry=0,rsize=32768,wsize=32768,proto=tcp
# systemctl show -p Wants network-online.target
Wants=NetworkManager-wait-online.service
(Em relação ao meu uso controverso da opção soft
mount, a decisão de usá-lo foi feita após anos de problemas com a opção hard
. Com a opção difícil, qualquer perda de conectividade congela o sistema e as forças uma reinicialização forçada. Estou executando o BTRFS e não quero arriscar isso. Decidi que meu soft
é o melhor para minha situação. No entanto, junto com soft
, ajustei os retrans, timeo e tentei novamente. Não tenho certeza se os tenho otimizado, mas no geral a experiência tem sido muito melhor do que com a opção hard
.)