Mounting Directory — Connection Refused
I am trying to mount a Directory from my server to my local machine. This is because I want to edit the directory and execute the files without having the manually push the files to the server after each edit. I am using NFS and currently getting: ‘Connection refused’ when I try to mount from a machine on the same network. My server ip is 192.168.0.12.
My local machine ip is 192.168.0.2. And in /etc/exports I have:
/mnt/export 192.168.0.0/24(rw,async,no_subtree_check) /mnt/export *(rw)
where /mnt/export is the directory I want to mount and I have chmod 777 -r the directory On my local machine I execute this command:
mount 192.168.0.12:/mnt/export /Desktop/tes
can't mount /mnt/export from 192.168.0.12 onto /Desktop/tes: Connection refused
@warl0ck Thanks for the reply. Yes. When I run «exportfs» it gives me: /mnt/export 192.168.0.0/24 /mnt/export
7 Answers 7
You can test some of this from the client side. rpcinfo is useful to tell you if rpc calls are making it to the server processes, then you can check mountd specifically, and lastly, showmount will ask the server what volumes are exported:
$ rpcinfo -p nfsserv103 | cut -c30- | sort -u mountd nfs nlockmgr portmapper rquotad status $ rpcinfo -u nfsserv103 mountd program 100005 version 1 ready and waiting program 100005 version 2 ready and waiting program 100005 version 3 ready and waiting $ showmount -e nfsserv103 Export list for nfsserv103: / 10.221.253.101,10.221.252.101,10.221.253.100,10.221.252.100 /mnt_foo/bar (everyone)
(note that «cut» in the first command was just to make the output more concise. you can drop off everything but the first command.)
Additionally, you can use tcpdump to capture the nfs traffic and see what is happening. So for a firewall, you’ll see no server response. Or maybe you’ll see a mountd refusal because the client request comes from a non-priviledged port, etc.
I had this problem on a machine running a standard Ubuntu 14.04 install.
The connection refused message can be misleading: It turns out that all that was required was to install the nfs-common package.
A firewall is preventing the client from reaching the server. At this stage, you can’t know whether NFS is configured properly (so it may well be): the client can’t even see that there is an NFS server.
The most likely location for a firewall is the server. Check that it allows incoming connections on port 111 (rpc) and 2049 (nfs). On a Linux machine, run iptables -nvL as root to see the port blocking configuration.
If you don’t know where the firewall is, you can locate it by running tcptraceroute 192.168.0.12 111 (or 2049, if it’s the nfs port that’s blocked). But given that the machines are in the same subnet, there’s probably a direct connection, so it’s the server (or, less likely, the client) that’s blocking connections.
Oh, and don’t chmod 777 . That never solves anything, and usually breaks something. If the error isn’t “permission denied”, the solution isn’t chmod; and if the error is “permission denied”, the solution may be chmod but not 777.
Не получаетя примонтировать nfs
Какой дистрибутив? Версия ядра? ‘netstat -an4lput’ на сервере? Есть ли на сервере фаервол? Попробуй разрешить доступ сети 192.192.10.0/24.
На серере ubuntu 10.04, разрешил доступ 226 компу через firestarter (гуишный фаервол). Клиент — встраиваемая система.
Приду домой отпишу, уже пора домой с работы топать.
также firewall и portmapper
Он сам к себе не коннектится, по 127.0.0.1
Так для этого разрешить подключение надо. Плюс проверить, не подключается ли он сам к себе по IPv6.
К сожалению логов не будет, что-то с впн. Завтра разве что.
при попытке смонтировать с внешней железки], на сервере.
Aug 3 11:54:04 test-desktop mountd[32369]: authenticated mount request from 192.168.10.226:819 for /home/test/. /install (/home/test/. /hd4-sources/install) Aug 3 11:54:04 test-desktop mountd[32369]: authenticated mount request from 192.168.10.226:822 for /home/test/. /install (/home/test/. /hd4-sources/install)
Aug 3 06:59:17 HD400046 user.warn kernel: svc: failed to register lockdv1 RPC service (errno 111). Aug 3 06:59:17 HD400046 user.warn kernel: svc: failed to register lockdv1 RPC service (errno 111).
Какие еще логи и где брать?
Arch Linux
I run Arch as a desktop OS and also a 2nd PC which acts as file server. I’ve used NFS exclusively to access files on the server via my desktop PC.
Last night I ran the usual
on both machines before retiring. Both completed without issue and both were subsequently rebooted.
On attempting to mount two NFS shares from terminal using
for i in ; do sudo mount -o noacl,nocto,noatime,rsize=32768,wsize=32768 192.168.1.88:/srv/nfs/ext4"$i" /alib/alsd"$i"; done
Created symlink /run/systemd/system/remote-fs.target.wants/rpc-statd.service → /usr/lib/systemd/system/rpc-statd.service.
followed by a long wait then
mount.nfs: Connection refused mount.nfs: Connection refused
dmesg on the client side shows:
[ 189.606468] RPC: Registered named UNIX socket transport module. [ 189.606470] RPC: Registered udp transport module. [ 189.606471] RPC: Registered tcp transport module. [ 189.606471] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 189.642701] FS-Cache: Netfs 'nfs' registered for caching [ 189.826051] NFS: Registering the id_resolver key type [ 189.826060] Key type id_resolver registered [ 189.826061] Key type id_legacy registered [ 189.846981] NFS4: Couldn't follow remote path [ 189.886097] audit: type=1130 audit(1608805444.807:115): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=rpc-statd-notify comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 189.914329] audit: type=1130 audit(1608805444.837:116): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=rpcbind comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 189.954596] audit: type=1130 audit(1608805444.877:117): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=rpc-statd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 189.973726] audit: type=1334 audit(1608805444.897:118): prog-id=8 op=UNLOAD [ 189.973731] audit: type=1334 audit(1608805444.897:119): prog-id=7 op=UNLOAD [ 189.978130] audit: type=1334 audit(1608805444.901:120): prog-id=6 op=UNLOAD [ 191.174759] NFS4: Couldn't follow remote path [ 193.200557] NFS4: Couldn't follow remote path [ 197.227537] NFS4: Couldn't follow remote path [ 205.255323] NFS4: Couldn't follow remote path [ 213.243649] kauditd_printk_skb: 9 callbacks suppressed [ 213.243655] audit: type=1334 audit(1608805468.160:130): prog-id=18 op=LOAD [ 213.243681] audit: type=1334 audit(1608805468.160:131): prog-id=19 op=LOAD [ 213.410704] audit: type=1130 audit(1608805468.330:132): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=upower comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 215.282543] NFS4: Couldn't follow remote path [ 225.310092] NFS4: Couldn't follow remote path [ 235.334947] NFS4: Couldn't follow remote path [ 245.360919] NFS4: Couldn't follow remote path [ 255.387939] NFS4: Couldn't follow remote path [ 265.415115] NFS4: Couldn't follow remote path [ 275.442943] NFS4: Couldn't follow remote path [ 285.465831] NFS4: Couldn't follow remote path [ 295.488142] NFS4: Couldn't follow remote path [ 305.512750] NFS4: Couldn't follow remote path [ 315.530057] NFS4: Couldn't follow remote path [ 315.550480] audit: type=1106 audit(1608805570.487:133): pid=1250 uid=1000 auid=1000 ses=1 msg='op=PAM:session_close grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success' [ 315.550605] audit: type=1104 audit(1608805570.487:134): pid=1250 uid=1000 auid=1000 ses=1 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success' [ 315.561837] audit: type=1101 audit(1608805570.497:135): pid=1790 uid=1000 auid=1000 ses=1 msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="x" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success' [ 315.562112] audit: type=1110 audit(1608805570.497:136): pid=1790 uid=1000 auid=1000 ses=1 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_env,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success' [ 315.566266] audit: type=1105 audit(1608805570.500:137): pid=1790 uid=1000 auid=1000 ses=1 msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success' [ 315.572074] NFS4: Couldn't follow remote path [ 316.592344] NFS4: Couldn't follow remote path [ 318.616869] NFS4: Couldn't follow remote path [ 322.640538] NFS4: Couldn't follow remote path [ 330.663714] NFS4: Couldn't follow remote path [ 340.689184] NFS4: Couldn't follow remote path [ 350.713071] NFS4: Couldn't follow remote path [ 360.736302] NFS4: Couldn't follow remote path [ 370.761847] NFS4: Couldn't follow remote path [ 380.788660] NFS4: Couldn't follow remote path [ 390.814785] NFS4: Couldn't follow remote path [ 400.841064] NFS4: Couldn't follow remote path [ 410.866895] NFS4: Couldn't follow remote path [ 420.891439] NFS4: Couldn't follow remote path [ 430.915726] NFS4: Couldn't follow remote path [ 440.941251] NFS4: Couldn't follow remote path
Config on server side is as follows:
UUID=d57236af-dfeb-4ed4-a056-44a97fdd15d0 /alib/ext4e ext4 defaults,noatime 0 0 UUID=04b2f712-8b00-46ab-8bd5-71adcb68ff0a /alib/ext4f ext4 defaults,noatime 0 0 /alib/ext4e /srv/nfs/ext4e none bind 0 0 /alib/ext4f /srv/nfs/ext4f none bind 0 0
/srv/nfs/ext4e 192.168.1.0/24(rw,no_subtree_check,all_squash,anonuid=1000,anongid=100) /srv/nfs/ext4f 192.168.1.0/24(rw,no_subtree_check,all_squash,anonuid=1000,anongid=100)
Apart from the pacman update nothing has changed on either PC. Anyone else that’s running an up to date Arch now experiencing NFS mount issues?
Last edited by audiomuze (2020-12-24 21:01:45)
connection refused while trying to mount nfs
mount -t nfs -o proto=tcp,port=2049 192.168.243.148:/home/nfs/ /mnt/nfs
mount: mounting 192.168.243.148:/home/nfs/ on /mnt/nfs failed: Connection refused
/home/nfs/ 192.168.243.0/24(rw,sync,fsid=0,anonuid=0,no_root_squash,subtree_check)
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 tcp 2049 nfs 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs 100227 2 tcp 2049 100227 3 tcp 2049 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100227 2 udp 2049 100227 3 udp 2049 100005 1 udp 56039 mountd 100005 1 tcp 50063 mountd 100005 2 udp 34246 mountd 100005 2 tcp 59882 mountd 100005 3 udp 49752 mountd 100005 3 tcp 49991 mountd
Export list for mkoz-10320: /home/nfs 192.168.243.0/24
Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT udp -- 192.168.243.0/24 0.0.0.0/0 ctstate NEW,RELATED,ESTABLISHED udp dpt:111 ACCEPT udp -- 192.168.243.0/24 0.0.0.0/0 ctstate NEW,RELATED,ESTABLISHED udp dpt:111 ACCEPT tcp -- 192.168.243.0/24 0.0.0.0/0 ctstate NEW,RELATED,ESTABLISHED tcp dpt:111 ACCEPT tcp -- 192.168.243.0/24 0.0.0.0/0 ctstate NEW,RELATED,ESTABLISHED tcp dpt:2049 ACCEPT udp -- 192.168.243.0/24 0.0.0.0/0 ctstate NEW,RELATED,ESTABLISHED udp dpt:2049
I’ve disabled ufw. Not sure what else I can do. I’m running Ubuntu 14.04. I don’t have any problem mounting nfs on machine running nfs server.