Migrating a Business to Linux — 9
NetworkManager (NM) and NFS reared their ugly head to create another challenge in our migration at work.
Because of GTK3 issues when using the SMB protocol and GVFS, I had configured the laptops to connect to the office NAS using NFS. All seemed well until a few days later. I toggled between wireless and Ethernet with the bench laptop. At that point NFS did its normal puke because the connection to the NFS server disappeared.
With my NM dispatcher script the NFS shares mounted without issue with either wireless or Ethernet, but toggling caused the well-known hang.
After establishing the new network connection the laptop was again on the same subnet, but the IP address is different. When connecting to Ethernet and wireless is enabled, NM does not toggle off wireless or disconnect the wireless connection. NM does not use the same IP address for both connections.
The NFS client is anchored to the NFS server by IP address at port 2049. When toggling between the two connection types, the IP address changes. Hence the hang.
The infamous problem with NFS is there are no simple ways to override. For most use cases the solution is as simple as restoring the NFS server connection. In this use case the solution is to restore the first network connection, manually unmount the NFS shares, and connect to the different network connection. I could do this manually but could not find a way to automate because there is no way to predict when the connection type changes.
pre-down option in the dispatcher script should unmount the NFS shares before disabling the first connection and using the second connection. This does not happen, probably because the NFS client needs to perform some kind of good-bye handshake before unmounting.
The manner in which NFS hangs is a proverbial Achilles heel. And a sad long-running decades joke.
After more tinkering, I ended up mounting the NAS shares in
/etc/fstab using CIFS mounts. This required installing the
cifs-utils package. I created a
chmod 600. I removed the NetworkManager dispatcher script. So far so good, but I am holding my breath a little.