0

I have a couple of servers in a VPC in Amazon EC2. One of them acts as a NFS server, and one of them as a client.

I recently noticed a problem in the client that after a reboot, it would reject all SSH connections, presumably because SSH was not running. After transferring the EBS volume to another instance and taking a peek inside, I commented out the NFS line in /etc/fstab and tried attaching it back to the server and booting it. Lo and behold, I was able to connect with SSH.

It seems that having the following line in my fstab is breaking everything on boot:

10.0.0.1:/export/share /mnt/shared nfs auto 0 0

Why is this causing SSH to fail to start? How can I have NFS automatically mount on boot without breaking networking/SSH on the system?

I've checked that sudo mount -a works properly, so it seems that there isn't an inherent problem in the fstab command. What's breaking and how can I fix it?

  • Does disabling automounting, then manually mounting it after SSH has loaded successfully also break SSH? – Chris Down Apr 18 '13 at 4:13
  • Nope, it only breaks on boot when it's in fstab. – Naftuli Kay Apr 18 '13 at 4:32
  • Does the SSH init script actually run? – Chris Down Apr 18 '13 at 5:04
  • What ami are you using? The latest RHEL or something else? I found a bug in the latest RHEL image in rc.local that was causing ssh to fail to start on reboot. After I fixed that things were good. A bad nfs config should not conflict with SSH as long as you're not clobbering your home directory preventing access to your ssh credentials – John Apr 18 '13 at 15:56
  • Ubuntu 12.04 64bit. – Naftuli Kay Apr 18 '13 at 17:56
1

You need to add one more option when mounting nfs , we always use this

Example

10.0.0.1:/export/share /mnt/shared nfs _netdev,noatime,intr,auto 0 0

These are mount options : 'noatime' improves access rate, and 'auto' tells the Rpi to aumount the NFS shares on startup.

from man mount

_netdev The filesystem resides on a device that requires network access (used to prevent the system from attempting to mount these filesystems until the network has been enabled on the system).

  • Even with that exact line in my fstab, SSH doesn't start up. Comment it out, and it starts. – Naftuli Kay Apr 18 '13 at 21:55
  • what is sequence in fstab, is that nfs entry at last ? – Rahul Patil Apr 19 '13 at 3:25
  • Yes, it's at the last entry in fstab. – Naftuli Kay Apr 19 '13 at 4:24
  • have you find any error in logs /var/log/syslog or /var/log/messages – Rahul Patil Apr 19 '13 at 4:38
  • Nope, nothing significant in there. – Naftuli Kay Apr 19 '13 at 23:02
0

Try using nobootwait or nofail as mount options in the fstab.

0

Same problem with nfs shares mounted on a remote server. nfs is going through openvpn.

I tried load of things, nothing worked, included hints above. options in fstab like _netdev,ro,noauto,nofail,x-systemd.automount,x-systemd.requires=openvpn.service,x-systemd.device-timeout=30 0 0 did not work.

In rc3.d I tried different services order...

The only very dirty solution I found was to use _netdev,ro,noauto,nofail 0 0 option in fstab just to make sure it ignores those nfs shares if they do not mount correctly at boot up and added a line in rc.local to mount the shares like mount 192.168.0.1:/myshare

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.