Error sharing nfs drive

I’ve followed this same steps before successfully, but I had to reinstall the system and now the same steps don’t seem to work.

server $ id -u user
1000
client $ id -u user
1000
client $ showmount -e 192.168.1.122
Export list for 192.168.1.122:
/mnt/V 192.168.1.122/24
client $ sudo systemctl enable --now nfs-client.target
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-client.target → /usr/lib/systemd/system/nfs-client.target.
Created symlink /etc/systemd/system/remote-fs.target.wants/nfs-client.target → /usr/lib/systemd/system/nfs-client.target.
client $ sudo vi /etc/systemd/system/mnt-v.mount
[Unit]
Description=NFS share mount

[Mount]
What=192.168.1.122:/mnt/V
Where=/mnt/v
Type=nfs
Options=_netdev,rw

[Install]
WantedBy=multi-user.target

client $ sudo systemctl start mnt-v.mount
Job failed. See "journalctl -xe" for details.
client $ journalctl -xe
░░ The job identifier is 2173.
sep 14 11:10:47 client mount[22129]: mount.nfs: No such device
sep 14 11:10:47 client systemd[1]: mnt-v.mount: Mount process exited, code=exited, status=32/n/a
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ An n/a= process belonging to unit mnt-v.mount has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 32.
sep 14 11:10:47 client systemd[1]: mnt-v.mount: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ The unit mnt-v.mount has entered the 'failed' state with result 'exit-code'.
sep 14 11:10:47 client systemd[1]: Failed to mount Music.
░░ Subject: A start job for unit mnt-v.mount has failed
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ A start job for unit mnt-v.mount has finished with a failure.
░░
░░ The job identifier is 2173 and the job result is failed.
sep 14 11:10:47 client sudo[22125]: pam_unix(sudo:session): session closed for user root
sep 14 11:10:47 client audit[22125]: USER_END pid=22125 uid=1000 auid=1000 ses=4 subj==unconfined msg='op=PAM:session_c>
sep 14 11:10:47 client audit[22125]: CRED_DISP pid=22125 uid=1000 auid=1000 ses=4 subj==unconfined msg='op=PAM:setcred >
sep 14 11:10:47 client kernel: audit: type=1106 audit(1663146647.993:426): pid=22125 uid=1000 auid=1000 ses=4 subj==unc>
sep 14 11:10:47 client kernel: audit: type=1104 audit(1663146647.993:427): pid=22125 uid=1000 auid=1000 ses=4 subj==unc>

client $ sudo systemctl stop mnt-v.mount
client $ sudo chmod 777 /mnt/v
client $ sudo vi /etc/systemd/system/mnt-v.automount
[Unit]
Description=Automount nfs share
ConditionPathExists=/mnt/v

[Automount]
Where=/mnt/v
TimeoutIdleSec=10

[Install]
WantedBy=multi-user.target
client $ sudo systemctl enable --now mnt-v.automount
client $ ls -l /mnt/v
ls: cannot open directory '/mnt/v': Device does not exist

to me it seems:

it’s supposed to be mounted at /mnt/v

but

that directory does not exist

… create it, so it (the mount point) does exist?

It does exist and I’ve done this without errors

client $ sudo chmod 777 /mnt/v

It’s owned by root though, I don’t know if I should change that too.

Can you mount the NFS share manually?

To bypass automation / SystemD for now…

When you use both mount and automount - the mount unit must be started manually once in order to create the folder to mount in - then stopped.

Only then you can enable and start the automount unit.

Mount unit must be disabled for automount to work, because automount activates the mount unit.

And - for your own sanity’s sake - use a dedicated structure - do not use the system’s temporary mountpoint /mnt - you may find it difficult to control permissions for content of your mountpoint

Use your own strucuture like /a/v.

I’ve changed the folder in mount and automount files to /nfs/v but I still get the same error

[samsung@samsung system]$ journalctl -xe
sep 16 18:56:10 samsung systemd[1]: nfs-v.mount: Unit process 1440 (mount.nfs) remains running after unit stopped.
sep 16 18:56:10 samsung systemd[1]: Failed to mount Demo NFS share mount.
░░ Subject: A start job for unit nfs-v.mount has failed
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ A start job for unit nfs-v.mount has finished with a failure.
░░
░░ The job identifier is 1489 and the job result is failed.
sep 16 18:56:10 samsung audit[1436]: USER_END pid=1436 uid=1000 auid=1000 ses=4 subj=unconfined msg='op=PAM:session_clo>
sep 16 18:56:10 samsung sudo[1436]: pam_unix(sudo:session): session closed for user root
sep 16 18:56:10 samsung kernel: audit: type=1106 audit(1663347370.703:197): pid=1436 uid=1000 auid=1000 ses=4 subj=unco>
sep 16 18:56:10 samsung kernel: audit: type=1104 audit(1663347370.703:198): pid=1436 uid=1000 auid=1000 ses=4 subj=unco>
sep 16 18:56:10 samsung audit[1436]: CRED_DISP pid=1436 uid=1000 auid=1000 ses=4 subj=unconfined msg='op=PAM:setcred gr>
sep 16 18:56:28 samsung NetworkManager[629]: <info>  [1663347388.0094] device (wlp2s0): set-hw-addr: set MAC address to>
sep 16 18:56:28 samsung NetworkManager[629]: <info>  [1663347388.0270] device (wlp2s0): supplicant interface state: dis>
sep 16 18:56:28 samsung NetworkManager[629]: <info>  [1663347388.0274] device (p2p-dev-wlp2s0): supplicant management i>
sep 16 18:56:28 samsung NetworkManager[629]: <info>  [1663347388.0520] device (wlp2s0): supplicant interface state: int>
sep 16 18:56:28 samsung NetworkManager[629]: <info>  [1663347388.0521] device (p2p-dev-wlp2s0): supplicant management i>
sep 16 19:01:01 samsung CROND[1474]: (root) CMD (run-parts /etc/cron.hourly)
sep 16 19:01:01 samsung anacron[1483]: Anacron started on 2022-09-16
sep 16 19:01:01 samsung CROND[1473]: (root) CMDEND (run-parts /etc/cron.hourly)
sep 16 19:01:01 samsung anacron[1483]: Will run job `cron.daily' in 36 min.
sep 16 19:01:01 samsung anacron[1483]: Jobs will be executed sequentially
sep 16 19:03:20 samsung NetworkManager[629]: <info>  [1663347800.9132] device (wlp2s0): set-hw-addr: set MAC address to>
sep 16 19:03:20 samsung NetworkManager[629]: <info>  [1663347800.9297] device (wlp2s0): supplicant interface state: ina>
sep 16 19:03:20 samsung NetworkManager[629]: <info>  [1663347800.9298] device (p2p-dev-wlp2s0): supplicant management i>
sep 16 19:03:20 samsung NetworkManager[629]: <info>  [1663347800.9317] device (wlp2s0): supplicant interface state: int>
sep 16 19:03:20 samsung NetworkManager[629]: <info>  [1663347800.9320] device (p2p-dev-wlp2s0): supplicant management i>
lines 2826-2854/2854 (END)
sep 16 18:56:10 samsung syste>
sep 16 18:56:10 samsung syste>
░░ Subject: A start job for u>
░░ Defined-By: systemd
░░ Support: https://forum.man>
░░
░░ A start job for unit nfs-v>
░░
░░ The job identifier is 1489>
sep 16 18:56:10 samsung audit>
sep 16 18:56:10 samsung sudo[>
sep 16 18:56:10 samsung kerne>
sep 16 18:56:10 samsung kerne>
lines 2826-2838/2854 99%
sep 16 18:56:10 samsung systemd[1]: nfs-v.mount: Unit process 1440 (mount.nfs) remains running after unit stopped.
sep 16 18:56:10 samsung systemd[1]: Failed to mount Demo NFS share mount.
░░ Subject: A start job for unit nfs-v.mount has failed
░░ Defined-By: systemd
░░ Support: https://forum.manjaro.org/c/support
░░
░░ A start job for unit nfs-v.mount has finished with a failure.
░░
░░ The job identifier is 1489 and the job result is failed.
sep 16 18:56:10 samsung audit[1436]: USER_END pid=1436 uid=1000 auid=1000 ses=4 subj=unconfined msg='op=PAM:session_clo>
sep 16 18:56:10 samsung sudo[1436]: pam_unix(sudo:session): session closed for user root
sep 16 18:56:10 samsung kernel: audit: type=1106 audit(1663347370.703:197): pid=1436 uid=1000 auid=1000 ses=4 subj=unco>
sep 16 18:56:10 samsung kernel: audit: type=1104 audit(1663347370.703:198): pid=1436 uid=1000 auid=1000 ses=4 subj=unco>
sep 16 18:56:10 samsung audit[1436]: CRED_DISP pid=1436 uid=1000 auid=1000 ses=4 subj=unconfined msg='op=PAM:setcred gr>
sep 16 18:56:28 samsung NetworkManager[629]: <info>  [1663347388.0094] device (wlp2s0): set-hw-addr: set MAC address to>
sep 16 18:56:28 samsung NetworkManager[629]: <info>  [1663347388.0270] device (wlp2s0): supplicant interface state: dis>
sep 16 18:56:28 samsung NetworkManager[629]: <info>  [1663347388.0274] device (p2p-dev-wlp2s0): supplicant management i>
sep 16 18:56:28 samsung NetworkManager[629]: <info>  [1663347388.0520] device (wlp2s0): supplicant interface state: int>
sep 16 18:56:28 samsung NetworkManager[629]: <info>  [1663347388.0521] device (p2p-dev-wlp2s0): supplicant management i>
sep 16 19:01:01 samsung CROND[1474]: (root) CMD (run-parts /etc/cron.hourly)
sep 16 19:01:01 samsung anacron[1483]: Anacron started on 2022-09-16
sep 16 19:01:01 samsung CROND[1473]: (root) CMDEND (run-parts /etc/cron.hourly)
sep 16 19:01:01 samsung anacron[1483]: Will run job `cron.daily' in 36 min.
sep 16 19:01:01 samsung anacron[1483]: Jobs will be executed sequentially
sep 16 19:03:20 samsung NetworkManager[629]: <info>  [1663347800.9132] device (wlp2s0): set-hw-addr: set MAC address to>
sep 16 19:03:20 samsung NetworkManager[629]: <info>  [1663347800.9297] device (wlp2s0): supplicant interface state: ina>
sep 16 19:03:20 samsung NetworkManager[629]: <info>  [1663347800.9298] device (p2p-dev-wlp2s0): supplicant management i>
sep 16 19:03:20 samsung NetworkManager[629]: <info>  [1663347800.9317] device (wlp2s0): supplicant interface state: int>
sep 16 19:03:20 samsung NetworkManager[629]: <info>  [1663347800.9320] device (p2p-dev-wlp2s0): supplicant management i>

Doing it manually works fine

client $ sudo mount -t nfs 192.168.1.122:/mnt/V /nfs/V

Since manually mounting works, looks like it’s related to what @linux-aarhus said in the previous post:

Which means you should stop/unmount any instance of this NFS share, then safely remove the empty /mnt/v directory (using the rmdir command), then proceed as he explained above.

I tried again mounting somewhere else than in /mnt and it worked.

$c: client, $s: server
$c sudo rm -rf /nfs /mnt/V /etc/systemd/system/mnt-v.mount /etc/systemd/system/mnt-v.automount
$c showmount -e 192.168.1.122
Export list for 192.168.1.122:
/mnt/V 192.168.1.122/24
$c sudo cat /etc/systemd/system/nfs-V.mount
[Unit]
Description=Demo NFS share mount

[Mount]
What=192.168.1.122:/mnt/V
Where=/nfs/V
Type=nfs
Options=_netdev,rw

[Install]
WantedBy=multi-user.target

$c sudo cat /etc/systemd/system/nfs-V.automount
[Unit]
Description=Demo NFS client mount

[Automount]
Where=/nfs/V
TimeoutIdleSec=10

[Install]
WantedBy=multi-user.target

$c sudo systemctl start nfs-V.mount
$c sudo systemctl stop nfs-V.mount
$c sudo chmod 777 /a/nfs
$c sudo systemctl enable --now nfs-V.automount
$c ls /nfs/V

Tutorial

1 Like

I tried again with another computer just in case and it works:

$c: client, $s: server
$s sudo chmod 777 /mnt/hdd1
$s sudo cat /etc/fstab
UUID=301e3d8d-6c0a-4f7c-864b-4185a70efbb0 /mnt/hdd1 auto nosuid,nodev,nofail,x-gvfs-show 0 0
$s sudo vi /etc/exports
/mnt/hdd1  192.168.1.45/24(rw,sync,no_subtree_check)
$s sudo exportfs -arv
$s sudo systemctl enable --now nfs-server.service

$c sudo systemctl enable --now nfs-client.target
$c showmount -e 192.168.1.45
Export list for 192.168.1.45:
/mnt/hdd1 192.168.1.45/24
$c sudo cat /etc/fstab
192.168.1.45:/mnt/hdd1   /nfs/hdd1  nfs auto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,x-systemd.idle-timeout=1min 0 0
$c sudo mkdir -p /nfs/hdd1
$c sudo chmod 755 /nfs/hdd1
$c sudo systemctl daemon-reload
$c sudo mount -a
$c ls /nfs/hdd1