Comment 23 for bug 213444

Revision history for this message
bill (hammack) wrote : Details of Workaround

This post explains how to implement a workaround. The process below creates a .deb; I have attached that file ...
if it works for you then no need to go through all this. To test it implement STEP #1 and then go to STEP #6 and continue from there.
Use, of course, at your own risk.

This bug is the same
as debian bug #477503 as described at
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477503 entitled
"nfs-common: tcp mount require udp." At that URL Frank Kingswood
(message #40) noted the correction that needs to be made in the source
code, although he did not give details how to implement it. In this post
I explain how to change the code and then recreate the deb for your
system. If you are doing ssh tunnelling this should be a completely
functional workaround.

The basic idea is this: 1) the problem is in the file mount.c that
creates /sbin/mount.nfs -- this mount.nfs doesn't work for nfs using
only tcp - the version of NFS implemented in Hardy errs in requiring
that both UDP and TCP ports be used. This isn't necessary; and in fact
in the case of using an ssh tunnel over tcp using udp is forbidden. 2)
To fix this one needs to download the source code, amend the code in
mount.c, then recreate the *.deb package and reinstall. I've spelled
out the steps fully below so that any level user should be able to do
this ... there is nothing difficult in it at all, it is just
lengthy. The package affected is called nfs-common .... specifically
nfs-common-_1.1.2-2ubuntu2.1_i386.deb. (See
http://packages.ubuntu.com/hardy/net/nfs-common for details on the
package if you like.)

STEP 1: REMOVE nfs-common [Note # indicates superuser; $ regular user]

     As superuser (or use sudo)

     # apt-get remove nfs-common

STEP 2: DOWNLOAD SOURCE

     a. Make a directory nfs-correct

 Go to the directory of your choice and type

 $ mkdir nfs-correct

     b. Download source

 $ cd nfs-correct [you should now be in nfs-correct, type pwd
         to check if you like]

        $ apt-get source nfs-common

STEP 3: DOWNLOAD TOOLS NEEDED FOR REBUILDING .DEB

     a. As superuser type [or use sudo]

 # apt-get install devscripts build-essential fakeroot

    b. Create dependencies

         as superuser type this (or use sudo)

  # apt-get build-dep nfs-common

  [For details on rebuilding debian packages see
  http://www.debian-administration.org/articles/20]

STEP 4: AMEND SOURCE CODE

     a. You will see a subdirectory nfs-utils-1.1.2 under nfs-correct

 type:

 cd nfs-utils-1.1.2/utils/mount

     b. Open mount.c with your favorite text editor [I use emacs]

        Find this sequence of lines:

 nfs_mount_data_version = NFS_MOUNT_VERSION;
    else
        if (kernel_version > MAKE_VERSION(2, 6, 22))
             string++;
}

 Change it so it reads:

        nfs_mount_data_version = NFS_MOUNT_VERSION;
    else
        if (kernel_version > MAKE_VERSION(2, 6, 22))
             printf("/usr/local/sbin/mount.nfs: not using string\n");
             /* string++; */
}

     c. Save this file

STEP 5: CREATE NEW .DEB

     Return to the subdirectory nfs-utils-1.1.2

     Within this subdirectory type as root (or using sudo)

     # debuild -us -uc

     Wait as it builds the package -- it takes a few minutes. My
     machine has four processors and it takes maybe two minutes. Just
     relax!

     The new deb is in subdirectory nfs-correct and is called
     nfs-common_1.1.2-2ubuntu2.1_i386.deb. [Note: This also creates
     nfs-kernel-server_1.1.2-2ubuntu2.1_i386.deb -- I have no clue if
     this bug needs to be fixed for the kernel server to work. My
     nfs server runs an older version of Debian; I have only tried this fix
     on the client side.]

STEP 6: INSTALL NEWLY CREATED & CORRECTED DEB

     As superuser (or using sudo)

     # dpkg -i nfs-common_1.1.2-2ubuntu2.1_i386.deb

STEP 7: Create symbolic link [optional?]

Kingswood seems to recommend this last step, but my system works fine
without it - still I've gone ahead and done it.

     As superuser do the following

     # cd /sbin
     # ln -s mount.nfs /usr/local/sbin/mount.nfs

Note: My system work fine now. When I connect to the shares via an ssh
tunnel it gives me the message "not using string" .... one can just
ignore this message. Note, too, that you can change the message
reported by editing the printf statement inserted into mount.c -- I
actually changed mine to read "using self-patched" to serve as a
reminder in case nfs-common is upgraded and I don't note the
update. This will tell me clearly whether I'm running the self-patched
version, and reveal to me whether to revert to use this .deb or patch the
new one if that one doesn't correct the problem.

I have attached the deb I created: Use at your own risk!