Author Topic: How to setup NFS? (LXDE - server, KDE - client)  (Read 1442 times)

Offline gseaman

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3789
How to setup NFS? (LXDE - server, KDE - client)
« on: November 11, 2011, 11:40:46 AM »
I've tried this unsuccessfully several times over the last few years.  :-[

I haven't asked for help, because I've had a non-standard install (custom kernels, packages from source or from testing, etc.). I've decided I want to solve this, so I put the latest LXDE on one machine and am fully updated. I read everything I could find on the forum, but have had no success.

The server is on an older hp pavilion dv1000. It has a wifi connection to my router. The router sets up the ip with dhcp, but it is always on, so the address never changes.

I am trying to connect to it with the laptop that I carry with me, a Toshiba Satellite A205. It uses a fully updated KDE4. I have a custom kernel, but I can go back to the standard kernel if appears to affect the outcome. All of the hardware works without issue on both machines.

I used PCC to setup a shared folder and to start nfs-server. I used PCC on my client to access the shared folder. It does not ever find a server.

I've read several threads and followed all of the instructions. I will give more details, as requested. ;) Thanks, in advance, for any suggestions!

Galen



Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 10613
  • MLUs Forever!
Re: How to setup NFS? (LXDE - server, KDE - client)
« Reply #1 on: November 11, 2011, 03:51:49 PM »
There are a few services that need to be running .....  PCC - System - Services ..... network, network-up, nfs-server, portreserve.

I believe I saw a post about portreserve not being automatically turned on for some reason.

Other than that, check your /etc/fstab file to see if it has entries relating to the shares that should be mounted to view the remote share.

I have found that I had to change the entry from the PC 'name' to its IP address to get things to work properly for me.

After that try in a terminal - as root

mount

to see what is mounted

and then try

mount -a

to mount all entries in fstab if not mounted.

If it hangs or fails you may get some feedback which would be helpful.

regards
MLUs rule the roost!

Linux XPS 3.2.18-pclos2.pae.bfs  32 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline gseaman

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3789
Re: How to setup NFS? (LXDE - server, KDE - client)
« Reply #2 on: November 11, 2011, 09:51:47 PM »
There are a few services that need to be running .....  PCC - System - Services ..... network, network-up, nfs-server, portreserve.

I believe I saw a post about portreserve not being automatically turned on for some reason.
network, nfs-server and portreserve were set to run on the server and client.

network-up was off and would not turn on in pcc, but I could start it with 'service network-up start' as root.
Quote
Other than that, check your /etc/fstab file to see if it has entries relating to the shares that should be mounted to view the remote share.
/etc/fstab had no entries for the shared folder on the server. It is a folder on a mounted partition, though.
There is no /etc/fstab entry on the client as pcc just sits there looking for a server, so the setup does not finish. I can look up how to do this manually, but I want to understand the PCLinuxOS way to do this.

Quote
I have found that I had to change the entry from the PC 'name' to its IP address to get things to work properly for me.

After that try in a terminal - as root

mount

to see what is mounted

and then try

mount -a

to mount all entries in fstab if not mounted.
I can't mount anything until I get entries in /etc/fstab.

Quote
If it hangs or fails you may get some feedback which would be helpful.

regards
Thanks for taking time to help.

Galen

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6214
Re: How to setup NFS? (LXDE - server, KDE - client)
« Reply #3 on: November 11, 2011, 10:09:59 PM »

do you have a firewall running on the server? if yes then turn it off first and then try again.
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline gseaman

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3789
Re: How to setup NFS? (LXDE - server, KDE - client)
« Reply #4 on: November 11, 2011, 10:20:09 PM »

do you have a firewall running on the server? if yes then turn it off first and then try again.

I turned it off on both computers, no luck.

Offline CY087

  • Full Member
  • ***
  • Posts: 62
Re: How to setup NFS? (LXDE - server, KDE - client)
« Reply #5 on: November 12, 2011, 02:02:26 AM »
This happened to me some moths ago too.

I'm relying on my usually fallable memory here, but Just18'comment:
Quote
I have found that I had to change the entry from the PC 'name' to its IP address to get things to work properly for me.
rang a bell.

I think it was adding a line to the hosts file on the client for the server.
i.e. on the laptop I added the server to /etc/hosts 192.168.1.blah and gave it a full domain and hostname, eg 192.168.1.104 joeblow.joenet
Then in pcc nfs clients it could find joeblow.joenet

Once it finds it once, it "just works" for some reason and the domain seems to no longer be necessary, i.e. your can just search for the server as "joeblow".
arp tables? something else? mystic incantation?

Who knows, I certainly cant remember what worked.
But you may as well give it a try.

seriously hth
CY087




Offline yodelu

  • PCLinuxOS Tester
  • Sr. Member
  • *******
  • Posts: 317
Re: How to setup NFS? (LXDE - server, KDE - client)
« Reply #6 on: November 12, 2011, 04:59:24 PM »
several years for nfs :o .. that is too much  :)
in my example i choose server as 192.168.0.100   (assigned by DHCP)
temporary disable firewall on server and client
first of all let's see what server says
rpcinfo -p
    if are daemons (portreserve and nfsd) listening on ports 111 and 2049 then is ok there
    if are not then check
    service portreserve status
    /etc/rc.d/init.d/nfs-server status
    if rpc.mountd is running and nfsd is not, then leave exports as it is, make sure the exported dir is automountable at next reboot (eg. home dir)
    reboot server
    then check again the status of services
    also be sure that rcpbind service is running

then go to client and check the server's open ports
nmap -sS -O 192.168.0.100
if you see rpcbind 111 and nfs 2049 then is ok  
also rcpbind and netfs needs to be running on client side

now let's try to see the exported(shared) dir
showmount -e 192.168.0.100
 and try to mount exported directory (eg home) to test directory
mkdir /test
mount -o soft,intr,rsize=8192,wsize=8192 192.168.0.100:/home /test

if all is OK then something's wrong with the GUI

Offline gseaman

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3789
Re: How to setup NFS? (LXDE - server, KDE - client)
« Reply #7 on: November 12, 2011, 05:16:25 PM »
Thank you, everybody! I've been away from home all day today, but I'll check out these tips in the next hour or two and report back.

Galen

Offline gseaman

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3789
Re: How to setup NFS? (LXDE - server, KDE - client)
« Reply #8 on: November 12, 2011, 07:07:40 PM »
several years for nfs :o .. that is too much  :)
I never pursued it because I was constantly re-installing, testing, etc. on at least one of my machines. Even if I had figured it out, I was constantly changing everything. Lately, I've just been working.  :'(

Quote
mkdir /test
mount -o soft,intr,rsize=8192,wsize=8192 192.168.0.100:/home /test
Thanks!

This works, although pcc setup the directories with root permissions, which I had to change, of course. Is it possible to set this up with the gui? Also, do I put this mount command in /etc/fstab?

Galen

Offline gseaman

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 3789
Re: How to setup NFS? (LXDE - server, KDE - client)
« Reply #9 on: November 12, 2011, 11:31:10 PM »
Ok, it is working fine, except I have permission problems. How do I get the files on each machine to be owned by the user on that machine. I use the same user name on both machines, but I apparently have different ID numbers. On the server my main user is 500 w/ group 500, and on the client it is 501 with group 502.

I can change the ownership of the files as root, but I would like a more seamless solution.

Galen

Offline yodelu

  • PCLinuxOS Tester
  • Sr. Member
  • *******
  • Posts: 317
Re: How to setup NFS? (LXDE - server, KDE - client)
« Reply #10 on: November 13, 2011, 01:52:47 AM »
if you have problem with permisions then check /etc/exports file
in my example i exported home directory and in exports file you should see a line (generated by draknfs)
/home *(no_all_squash,sync,insecure,subtree_check,ro)
* means access to everyone
however, to avoid any problems with mount, even if * is specified ,the exported folder must be owned by root

Offline Just17

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 10613
  • MLUs Forever!
Re: How to setup NFS? (LXDE - server, KDE - client)
« Reply #11 on: November 13, 2011, 02:07:11 AM »
Ok, it is working fine, except I have permission problems. How do I get the files on each machine to be owned by the user on that machine. I use the same user name on both machines, but I apparently have different ID numbers. On the server my main user is 500 w/ group 500, and on the client it is 501 with group 502.

I can change the ownership of the files as root, but I would like a more seamless solution.

Galen


I recall having similar problems some time ago and decided on a 'dirty' solution for me -- I am not recommending this, just FYI.

I changed the ownership/permissions of the shared files so they retained the correct ownership but gave them the group of the accessing owner.

So you have 500/500  and  501/502

I changed the shared files from 500/500  to 500/501 and gave owner and group full access (R/W)

Some time later I corrected the 'wrong' account - 501/502 - and after that was carefull when setting up accounts on all PCs, so I did not have to muck about with this again.

I think you might be better served by changing the 501/502 account completely to 500/500 if another account does not interfere.

Maybe someone else would have a better idea ......

MLUs rule the roost!

Linux XPS 3.2.18-pclos2.pae.bfs  32 bit
Intel Core2 Quad CPU Q9450 @ 2.66GHz
4 GB RAM
MCP51 High Def Audio
GeForce GTX 550 Ti
PHILIPS  ‎DVD+-RW DVD8701
‎Logitech ‎BT Mini-Receiver
Afatech DTT

Offline yodelu

  • PCLinuxOS Tester
  • Sr. Member
  • *******
  • Posts: 317
Re: How to setup NFS? (LXDE - server, KDE - client)
« Reply #12 on: November 20, 2011, 05:26:39 AM »
ok after several days of testing here is the results (tested in kde and lxde):
i've noticed that in lxde nfs-server works fine and in kde is not ( = lsnetdrake --nfs can/can't discover the nfs server = PCC Access NFS Shared drives is working/not working)
Case 1
 LXDE, as server, is working because in the config files (/etc/sysconfig/nfs-server and /etc/sysconfig/nfs-common) ports are not specified = the ports  for mountd and nlockmgr are dynamically assigned
but these dynamically ports  is not good for firewall

Case 2
KDE as server.
here is rpcinfo -p with default config files
rpcinfo -p
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    2   udp   2049  nfs_acl
    100227    3   udp   2049  nfs_acl
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    2   tcp   2049  nfs_acl
    100227    3   tcp   2049  nfs_acl
    100021    1   udp  40619  nlockmgr
    100021    3   udp  40619  nlockmgr
    100021    4   udp  40619  nlockmgr
    100021    1   tcp  48258  nlockmgr
    100021    3   tcp  48258  nlockmgr
    100021    4   tcp  48258  nlockmgr
    100005    1   udp   4003  mountd
    100005    1   tcp   4003  mountd
and here we have two errors
1. mountd runs as version 1 and that is not good at all (should be 2 or 3 or 4 according with nfs version)
2. nlockmgr does not bind the port specified in /etc/sysconfig/nfs-common ( LOCKD_TCPPORT=4002 )
The sollution is:
1. for mountd, in /etc/sysconfig/nfs-server, replace RPCMOUNTD_OPTIONS="--port 4003" with RPCMOUNTD_OPTIONS="--no-nfs-version 2 --port 4003"
2. for nlockmgr, to bind the correct port, replace the code in /etc/rc.d/init.d/nfs-common like this

   # Set the ports lockd should listen on
   if [ -n "$LOCKD_TCPPORT" ]; then
       /sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
   fi
   if [ -n "$LOCKD_UDPPORT" ]; then
       /sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
   fi

with

  # Set the ports lockd should listen on
      if [ -n "$LOCKD_TCPPORT" -o -n "$LOCKD_UDPPORT" ]; then
        [ -x /sbin/modprobe ] && /sbin/modprobe lockd $LOCKDARG
        [ -n "$LOCKD_TCPPORT" ] && \
            /sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
        [ -n "$LOCKD_UDPPORT" ] && \
            /sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1

     fi

Save, reboot and ..done
now see what rpcinfo -p says  

[root@localhost ~]# rpcinfo -p
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100024    1   udp   4001  status
    100024    1   tcp   4001  status
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    2   tcp   2049  nfs_acl
    100227    3   tcp   2049  nfs_acl
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    2   udp   2049  nfs_acl
    100227    3   udp   2049  nfs_acl
    100021    1   udp   4002  nlockmgr
    100021    3   udp   4002  nlockmgr
    100021    4   udp   4002  nlockmgr
    100021    1   tcp   4002  nlockmgr
    100021    3   tcp   4002  nlockmgr
    100021    4   tcp   4002  nlockmgr
    100005    3   udp   4003  mountd
    100005    3   tcp   4003  mountd

then go to client and run lsnetdrake --nfs
P.S.
 1.for more accurate results is a good ideea to clear ARP cache from your router before lsnetdrake
2. there is patch  for rpc.mountd
https://build.pub.meego.com/package/view_file?file=nfs-utils-1.2.3-libnfs-multiports.patch&package=nfs-utils&project=home%3Atschak909&srcmd5=2c870d729a10cf10cb06b456bca5ae30
which solve the -p parameter in conjuction with another parameter for example/usr/sbin/rpc.mountd --nfs-version 3 --port 32555 don't work
I don't know if the latest version of nfs-utils (now as 1.2.5) solve this problem

Hope it helps !
« Last Edit: November 20, 2011, 12:19:22 PM by yodelu »