Comment 66 for bug 275451

Revision history for this message
HansHook (hans-hook) wrote :

A FIX for the problem
=============

We have also noticed that for some hosts, more often with multiple cpu cores in our experience, NFS shares are not mounted in time during upstart.

We have tried NFS v3 and v4 with Ubuntu 8.04 servers and Ubuntu 10.04 clients.

If /home is an NFS share this will cause a lot of trouble since a login without a home catalog will result in a locked up gnome session that requires sudo rights and some command line skills to resolve.
(Not the kind of situation you would like your users to find themselves in...)

It is a shame that this problem still persists – we have suffered from its consequences since 10.04 was released and not been able to find its root cause. To help others in the same condition we have decided to publish our fix – even thought it is quite ugly it works and removes the symptoms.

(Most likely the problem is related to DHCP assigned network interfaces not being up when mountall expects them to. This will cause a time out condition that is only resolved after a considerable amount of time and sometimes not at all, I.e the NFS shares remain unmounted when the user logs in.)

The following fix will provide peace of mind and happy users:

1. In /etc/fstab make sure all NFS mounts have the flag “noauto” set like:
10.0.0.250:/home /home nfs4 noauto 0 0

2. Add the attached upstart script /etc/init/nfs-upstart-fixer.
If you use NFS v4, that uses idmapd, uncomment:
'start on (net-device-up and started idmapd)
'
If you use NFS v3, that does not depend on idmapd, uncomment:
'start on (net-device-up)
'

3. Add the attached script /sbin/ensure-nfsshares-mounted.

4. Above will take care of most situations but if you are using gdm and are quick when logging in there is still a chance that the home share may not be mounted.
To be sure add the following line to the script /etc/gdm/PostLogin/Default:
/sbin/ensure-nfsshares-mounted

This will act as a guard.
(Read instructions in /etc/gdm/PostLogin/Default.sample if ther is no /etc/gdm/PostLogin/Default
in your system.)

Note 1:
The “magic” time constant of 8 seconds /etc/init/nfs-upstart-fixer is empiric. It works on all hosts I have seen this far. If it is too small there will be a time out condition which will cause the time between entering password and until the login is completed by quite a long time.
If this happens try with 10, 12, 14 until this does not happen.

Note 2:
For non gdm users there is probably a “hook” corresponding to /etc/gdm/PostLogin/Default.

Note 3.
If you have NFS shares in /etc/fstab that are truly intended to be “noauto” the above solution will
have to be modified a bit.

Hope you may now also enjoy swift boot up and NFS mounted home shares in Ubuntu even though this embarrassing bug remains unfixed!

Best regards