Problem mounting Nas (NFS) with systemd

Hi,
I tried to mount my Qnap Nas using the mount unit with this topic: [root tip] [How To] Use systemd to mount ANY device but i obtain error when i verify the service.

I have 3 disks in the Nas named 2025, data and Multimedia, i choose at random data/2022 (which is a folder of the disk named data).

I did this:

[Unit]
Description=Mount NAS Video share using NFS

[Mount]
What=192.168.1.10/data/2022
Where=/home/marc/qnap/
Type=nfs
Options=_netdev,auto

[Install]
WantedBy=multi-user.target

Then:

marc@marc-pc ~]$ sudo nano /etc/systemd/system/home-marc-qnap.mount
[sudo] Mot de passe de marc : 
[marc@marc-pc ~]$ sudo systemctl daemon-reload
[marc@marc-pc ~]$ systemctl show -p ActiveState -p SubState --value home-marc-qnap.mount
failed
failed
[marc@marc-pc ~]$ sudo systemctl start home-marc-qnap.mount
Job failed. See "journalctl -xe" for details.
[marc@marc-pc ~]$ journalctl -xe
déc. 14 10:53:10 marc-pc sudo[25675]: pam_unix(sudo:session): session opened for user root(uid=0) by marc(u>
déc. 14 10:53:27 marc-pc sudo[25675]: pam_unix(sudo:session): session closed for user root
déc. 14 10:54:01 marc-pc sudo[25724]:     marc : TTY=pts/1 ; PWD=/home/marc ; USER=root ; COMMAND=/usr/bin/>
déc. 14 10:54:01 marc-pc sudo[25724]: pam_unix(sudo:session): session opened for user root(uid=0) by marc(u>
déc. 14 10:54:01 marc-pc systemd[1]: Reload requested from client PID 25728 ('systemctl') (unit user@1000.s>
déc. 14 10:54:01 marc-pc systemd[1]: Reloading...
déc. 14 10:54:01 marc-pc systemd[1]: Reloading finished in 261 ms.
déc. 14 10:54:01 marc-pc sudo[25724]: pam_unix(sudo:session): session closed for user root
déc. 14 10:54:22 marc-pc kwin_x11[903]: kwin_core: XCB error: 152 (BadDamage), sequence: 20103, resource id>
déc. 14 10:54:22 marc-pc kwin_x11[903]: kwin_core: XCB error: 3 (BadWindow), sequence: 20104, resource id: >
déc. 14 10:54:25 marc-pc sudo[25832]:     marc : TTY=pts/1 ; PWD=/home/marc ; USER=root ; COMMAND=/usr/bin/>
déc. 14 10:54:25 marc-pc sudo[25832]: pam_unix(sudo:session): session opened for user root(uid=0) by marc(u>
déc. 14 10:54:25 marc-pc systemd[1]: Mounting Mount NAS Video share using NFS...
░░ Subject: L'unité (unit) home-marc-qnap.mount a commencé à démarrer
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://forum.manjaro.org/c/support
â–‘â–‘ 
░░ L'unité (unit) home-marc-qnap.mount a commencé à démarrer.
déc. 14 10:54:25 marc-pc mount[25838]: mount.nfs: remote share not in 'host:dir' format
déc. 14 10:54:25 marc-pc systemd[1]: home-marc-qnap.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 home-marc-qnap.mount has exited.
â–‘â–‘ 
â–‘â–‘ The process' exit code is 'exited' and its exit status is 32.
déc. 14 10:54:25 marc-pc systemd[1]: home-marc-qnap.mount: Failed with result 'exit-code'.
â–‘â–‘ Subject: Unit failed
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://forum.manjaro.org/c/support
â–‘â–‘ 
â–‘â–‘ The unit home-marc-qnap.mount has entered the 'failed' state with result 'exit-code'.
déc. 14 10:54:25 marc-pc systemd[1]: Failed to mount Mount NAS Video share using NFS.
░░ Subject: L'unité (unit) home-marc-qnap.mount a échoué
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://forum.manjaro.org/c/support
â–‘â–‘ 
░░ L'unité (unit) home-marc-qnap.mount a échoué, avec le résultat failed.
déc. 14 10:54:25 marc-pc sudo[25832]: pam_unix(sudo:session): session closed for user root
lines 1315-1354/1354 (END)

NB: "a commencé à démarrer" means "began to start"

I searched on the forum but i didn't find why it failed.

Thanks.

Not sure why it failed but the usual place for the mount info is

/etc/systemd/system then use a command like

sudo systemctl enable --now Data-Documents.mount

Not working.

[marc@marc-pc ~]$ sudo systemctl enable --now  home-marc-qnap.mount
Created symlink '/etc/systemd/system/multi-user.target.wants/home-marc-qnap.mount' → '/etc/systemd/system/home-marc-qnap.mount'.
Job failed. See "journalctl -xe" for details.
[marc@marc-pc ~]$ journalctl -xe
déc. 14 12:07:48 marc-pc nmbd[660]: [2024/12/14 12:07:48.330172,  0] ../../source3/nmbd/nmbd_namequery.c:109(query_name_response)
déc. 14 12:07:48 marc-pc nmbd[660]:   query_name_response: Multiple (2) responses received for a query on subnet 192.168.1.13 for name WORKGROUP<1d>.
déc. 14 12:07:48 marc-pc nmbd[660]:   This response was from IP 192.168.1.30, reporting an IP address of 192.168.1.30.
déc. 14 12:07:48 marc-pc sudo[34998]:     marc : TTY=pts/1 ; PWD=/home/marc ; USER=root ; COMMAND=/usr/bin/systemctl enable --now
déc. 14 12:07:48 marc-pc sudo[34998]: pam_unix(sudo:session): session opened for user root(uid=0) by marc(uid=1000)
déc. 14 12:07:48 marc-pc sudo[34998]: pam_unix(sudo:session): session closed for user root
déc. 14 12:09:48 marc-pc sudo[35082]:     marc : TTY=pts/1 ; PWD=/home/marc ; USER=root ; COMMAND=/usr/bin/systemctl enable --now home-marc-qnap.mount
déc. 14 12:09:48 marc-pc sudo[35082]: pam_unix(sudo:session): session opened for user root(uid=0) by marc(uid=1000)
déc. 14 12:09:48 marc-pc systemd[1]: Reload requested from client PID 35085 ('systemctl') (unit user@1000.service)...
déc. 14 12:09:48 marc-pc systemd[1]: Reloading...
déc. 14 12:09:49 marc-pc systemd[1]: Reloading finished in 328 ms.
déc. 14 12:09:49 marc-pc systemd[1]: Mounting Mount NAS Video share using NFS...
░░ Subject: L'unité (unit) home-marc-qnap.mount a commencé à démarrer
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://forum.manjaro.org/c/support
â–‘â–‘ 
░░ L'unité (unit) home-marc-qnap.mount a commencé à démarrer.
déc. 14 12:09:49 marc-pc mount[35170]: mount.nfs: remote share not in 'host:dir' format
déc. 14 12:09:49 marc-pc systemd[1]: home-marc-qnap.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 home-marc-qnap.mount has exited.
â–‘â–‘ 
â–‘â–‘ The process' exit code is 'exited' and its exit status is 32.
déc. 14 12:09:49 marc-pc systemd[1]: home-marc-qnap.mount: Failed with result 'exit-code'.
â–‘â–‘ Subject: Unit failed
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://forum.manjaro.org/c/support
â–‘â–‘ 
â–‘â–‘ The unit home-marc-qnap.mount has entered the 'failed' state with result 'exit-code'.
déc. 14 12:09:49 marc-pc systemd[1]: Failed to mount Mount NAS Video share using NFS.
░░ Subject: L'unité (unit) home-marc-qnap.mount a échoué
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://forum.manjaro.org/c/support
â–‘â–‘ 
░░ L'unité (unit) home-marc-qnap.mount a échoué, avec le résultat failed.
déc. 14 12:09:49 marc-pc sudo[35082]: pam_unix(sudo:session): session closed for user root
lines 384-422/422 (END)

should that not be the address?
would that not be be rather written like this (with a colon)?:
What=192.168.1.10:/data/2022

1 Like

I think you’re right but same result (i modify the file):

[Unit]
Description=Mount NAS Video share using NFS

[Mount]
What=192.168.1.10:/data/2022
Where=/home/marc/qnap/
Type=nfs
Options=_netdev,auto

[Install]
WantedBy=multi-user.target

[marc@marc-pc ~]$ sudo nano /etc/systemd/system/home-marc-qnap.mount
[sudo] Mot de passe de marc : 
[marc@marc-pc ~]$ sudo systemctl daemon-reload
[marc@marc-pc ~]$ systemctl show -p ActiveState -p SubState --value home-marc-qnap.mount
failed
failed
[marc@marc-pc ~]$ sudo systemctl start home-marc-qnap.mount
Job failed. See "journalctl -xe" for details.
[marc@marc-pc ~]$ journalctl -xe
déc. 14 12:16:04 marc-pc sudo[35840]: pam_unix(sudo:session): session opened for user root(uid=0) by marc(uid=1000)
déc. 14 12:16:04 marc-pc systemd[1]: Reload requested from client PID 35843 ('systemctl') (unit user@1000.service)...
déc. 14 12:16:04 marc-pc systemd[1]: Reloading...
déc. 14 12:16:05 marc-pc systemd[1]: Reloading finished in 270 ms.
déc. 14 12:16:05 marc-pc sudo[35840]: pam_unix(sudo:session): session closed for user root
déc. 14 12:16:25 marc-pc sudo[35950]:     marc : TTY=pts/1 ; PWD=/home/marc ; USER=root ; COMMAND=/usr/bin/systemctl start home-marc-qnap.mount
déc. 14 12:16:25 marc-pc sudo[35950]: pam_unix(sudo:session): session opened for user root(uid=0) by marc(uid=1000)
déc. 14 12:16:25 marc-pc systemd[1]: Mounting Mount NAS Video share using NFS...
░░ Subject: L'unité (unit) home-marc-qnap.mount a commencé à démarrer
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://forum.manjaro.org/c/support
â–‘â–‘ 
░░ L'unité (unit) home-marc-qnap.mount a commencé à démarrer.
déc. 14 12:16:25 marc-pc kernel: Key type dns_resolver registered
déc. 14 12:16:25 marc-pc kernel: NFS: Registering the id_resolver key type
déc. 14 12:16:25 marc-pc kernel: Key type id_resolver registered
déc. 14 12:16:25 marc-pc kernel: Key type id_legacy registered
déc. 14 12:16:25 marc-pc mount[35956]: mount.nfs: access denied by server while mounting 192.168.1.10:/data/2022
déc. 14 12:16:25 marc-pc systemd[1]: home-marc-qnap.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 home-marc-qnap.mount has exited.
â–‘â–‘ 
â–‘â–‘ The process' exit code is 'exited' and its exit status is 32.
déc. 14 12:16:25 marc-pc systemd[1]: home-marc-qnap.mount: Failed with result 'exit-code'.
â–‘â–‘ Subject: Unit failed
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://forum.manjaro.org/c/support
â–‘â–‘ 
â–‘â–‘ The unit home-marc-qnap.mount has entered the 'failed' state with result 'exit-code'.
déc. 14 12:16:25 marc-pc systemd[1]: Failed to mount Mount NAS Video share using NFS.
░░ Subject: L'unité (unit) home-marc-qnap.mount a échoué
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://forum.manjaro.org/c/support
â–‘â–‘ 
░░ L'unité (unit) home-marc-qnap.mount a échoué, avec le résultat failed.
déc. 14 12:16:25 marc-pc sudo[35950]: pam_unix(sudo:session):

I would rather try it “by hand” first - to see whether it works in principle:

sudo mount -t nfs 192.168.1.10:/data/2022 /home/marc/qnap

Only then would I try to translate that to a systemd mount unit.

I’d also not mount the share to somewhere in /home but rather to a dedicated mount point below /
like:
/mnt/my_nfs_share
or just
/my_nfs_share
because you might want to use /mnt at some point for some reason …

obviously you’d have to create that directory first …

Then it may also be necessary to include some option for when the device only supports some particular version of the nfs protocol.

2 Likes
[marc@marc-pc ~]$ sudo mount -t nfs 192.168.1.10:/data/2022 /home/marc/qnap
[sudo] Mot de passe de marc : 
mount.nfs: access denied by server while mounting 192.168.1.10:/data/2022
[marc@marc-pc ~]$ 

Indeed, there is a problem…
I’d already activated smb and nfs in my NAS.

Whatever that might mean …
… the server (your qnap) must export the directories that are to be mountable by the clients:

https://wiki.archlinux.org/title/NFS#Server_configuration

I don’t know anything about your qnap - what it is or how to operate/configure it … :man_shrugging:

1 Like

I think your issue is caused by your attempt to mount a subfolder on your share - which is not possible - it is not exported.

1 Like

You mean i should use this
192.168.1.10:/data/
Instead of 192.168.1.10:/data/2022 ?

You can only mount the exported path - so if your export is ip.x.y.z:/data this is what you can mont.

There is some caveats using nfsv4 vs nfsv3, see → NFS - ArchWiki

Also see → [root tip] [How To] Share data using NFS

2 Likes

(the above not an active link - highlight/mark it - right click on it - choose open link from context menu …)

… which is essentially the same as what @linux-aarhus said

How you define your exports in your qnap … I don’t know. :man_shrugging:

1 Like

I don’t know too (yet). :smile:

I’m wondering if i really understand how it works: i want to access to my disks in my Nas as they were internal; so i have to mount all disks and repeat here 2 times the process to mount the 3 disks (and fourth one day if i add a disk in my Nas)?

first you have to tell your NAS to export either … everything
or
specific directories
so that these can then be accessed via nfs by you (the client)

Your NAS is the server - your machine is the client.

How you tell your NAS what directories it should export / make available for access via NFS … I don’t know.
I don’t have such a thing …

1 Like

Ok.
I should have study that before the purchase…

If it has got NFS support - there is a way to configure it via it’s web interface (where you also enabled NFS … somehow)
Perhaps it will export the whole disk only?
unlikely - but: I can’t say

I have used other NAS devices. There where always options in the interface …

1 Like

I’m on it :wink:

I am a littly rusty on NFS so I decided to check with my Synology NAS.

I have a shared folder named data and it is exported to NFS.

On my NFS permissions tab - info about the pount path is printed - you will likely have som similar information with a qnap system

Screenshot

1 Like

2 things i forgot to tell:

  • i have a (old) synology and i will try to mount it with the same process
  • with another pc on windows (don’t bite!), it works with cifs (i just load a qnap tool and it works instantaneously)

With Syno, there is a problem too:

[marc@marc-pc ~]$ sudo nano /etc/systemd/system/home-marc-syno.mount
[sudo] Mot de passe de marc : 
[marc@marc-pc ~]$ sudo systemctl daemon-reload
[marc@marc-pc ~]$ systemctl show -p ActiveState -p SubState --value home-marc-syno.mount
inactive
dead
[marc@marc-pc ~]$ sudo systemctl start home-marc-syno.mount
Job failed. See "journalctl -xe" for details.
[marc@marc-pc ~]$ journalctl -xe
déc. 15 08:25:23 marc-pc sudo[4573]: pam_unix(sudo:session): session closed for user root
déc. 15 08:25:33 marc-pc sudo[4604]:     marc : TTY=pts/1 ; PWD=/home/marc ; USER=root ; COMMAND=/usr/bin/systemctl daemon-reload
déc. 15 08:25:33 marc-pc sudo[4604]: pam_unix(sudo:session): session opened for user root(uid=0) by marc(uid=1000)
déc. 15 08:25:34 marc-pc systemd[1]: Reload requested from client PID 4607 ('systemctl') (unit user@1000.service)...
déc. 15 08:25:34 marc-pc systemd[1]: Reloading...
déc. 15 08:25:34 marc-pc systemd[1]: Reloading finished in 311 ms.
déc. 15 08:25:34 marc-pc sudo[4604]: pam_unix(sudo:session): session closed for user root
déc. 15 08:25:42 marc-pc kwin_x11[894]: kwin_core: XCB error: 152 (BadDamage), sequence: 4271, resource id: 25207472, major code: 143 (DAMAGE), minor code>
déc. 15 08:25:42 marc-pc kwin_x11[894]: kwin_core: XCB error: 3 (BadWindow), sequence: 4272, resource id: 81788988, major code: 129 (SHAPE), minor code: 6>
déc. 15 08:26:02 marc-pc sudo[4708]:     marc : TTY=pts/1 ; PWD=/home/marc ; USER=root ; COMMAND=/usr/bin/systemctl start home-marc-syno.mount
déc. 15 08:26:02 marc-pc sudo[4708]: pam_unix(sudo:session): session opened for user root(uid=0) by marc(uid=1000)
déc. 15 08:26:02 marc-pc systemd[1]: Mounting Mount NAS Video share using NFS...
░░ Subject: L'unité (unit) home-marc-syno.mount a commencé à démarrer
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://forum.manjaro.org/c/support
â–‘â–‘ 
░░ L'unité (unit) home-marc-syno.mount a commencé à démarrer.
déc. 15 08:26:03 marc-pc mount[4715]: mount.nfs: access denied by server while mounting 192.168.1.30:/volume1/Films
déc. 15 08:26:03 marc-pc systemd[1]: home-marc-syno.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 home-marc-syno.mount has exited.
â–‘â–‘ 
â–‘â–‘ The process' exit code is 'exited' and its exit status is 32.
déc. 15 08:26:03 marc-pc systemd[1]: home-marc-syno.mount: Failed with result 'exit-code'.
â–‘â–‘ Subject: Unit failed
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://forum.manjaro.org/c/support
â–‘â–‘ 
â–‘â–‘ The unit home-marc-syno.mount has entered the 'failed' state with result 'exit-code'.
déc. 15 08:26:03 marc-pc systemd[1]: Failed to mount Mount NAS Video share using NFS.
░░ Subject: L'unité (unit) home-marc-syno.mount a échoué
â–‘â–‘ Defined-By: systemd
â–‘â–‘ Support: https://forum.manjaro.org/c/support
â–‘â–‘ 
░░ L'unité (unit) home-marc-syno.mount a échoué, avec le résultat failed.
déc. 15 08:26:03 marc-pc sudo[4708]: pam_unix(sudo:session): session closed for user root
lines 996-1034/1034 (END)

[Unit]
Description=Mount NAS Video share using NFS

[Mount]
What=192.168.1.30:/volume1/Films
Where=/home/marc/syno/
Type=nfs
Options=_netdev,auto

[Install]
WantedBy=multi-user.target

Most likely your IP address has changed since you setup your share.

That could be why you get the message

Another possibility is your mount point - as and old sysadmin - mounting a folder using root should never be in a user’s home folder.

When mount using .mount and fstab you are running the mount as root.

It is often better to create a single data structure originating from the root e.g.

/a/syno

Then assign permissions to the mountpoint either by setting the owner (single user system) or by adding the users to the users group and set permissions accordingly.

1 Like