Subject: Re: bug#39670: Cannot mount NFS share as user or root

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 24 Sep 2020 21:53:10 -0400

Hi,

Nathan Dehnel <[email-masked]> writes:

> Right, but it's more inconvenient than just clicking the share in thunar
> and it mounting. Actually, I can't mount it without doing "sudo" first,
> despite having the "user" fstab flag set. This actually might be a separate
> issue, but I'm not sure.

That's a good point.  We should try to make this simpler.  The mount.nfs
binary needs to be setuid root to allow unprivileged users to mount NFS
file systems.  Unfortunately, the mount command (which we already define
as setuid-root) only looked for helpers under /run/current/profile/sbin.
This is now fixed in commit def6e2ae4619587114383b3f8fd9f3cf8310b4b9
(which had to be made on core-updates).

> Why doesn't the regular "mount" command work, again? Some sort of
> dependency loop because of the functional package manager? And this is
> deemed "not guix-specific"?

For some file systems, 'mount' requires helper to be found in its PATH
(see: "man mount").  That is true on any systems (not Guix-specific).
These helpers are not installed out-of-the-box on Guix System, so you
need to add them yourself to the 'packages' operating system field.

If you also want to be able to use mount as an unprivileged user, the
mount command as well as its helpers must all be setuid-root.  Again,
this is something (for the helpers) that must currently done manually by
adding, for example:

--8<---------------cut here---------------start------------->8---
(setuid-programs (cons*
                   (file-append nfs-utils "/sbin/mount.nfs")
                   (file-append ntfs-3g "/sbin/mount.ntfs-3g")
                   %setuid-programs))
--8<---------------cut here---------------end--------------->8---

I've sent a patch for review which proposes to add these setuid-root binaries for
desktop users out-of-the-box on Guix System, which only adds about 4 MiB
to the almost 3 GiB closure of the lightweight-desktop.tmpl system [0].

As mentioned before, it depends on a change to util-linux that had to be
made on the core-updates branch, so it won't be usable until the next
core-updates merge.

Maxim

[0]  https://debbugs.gnu.org/cgi/bugreport.cgi?bug=43604