[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#883976: nfs-common: Shell script executed by systemd to mount net /home * /var fails



Le 09/12/2017 à 23:32, Duncan Hare a écrit :
> Why during boot are the messages:
> 
> mount: can't find 192.168.1.10:/nsfroot/b827eb/c23849/var  /var in /etc/fstab
> mount: can't find 192.168.1.10:/nsfroot/b827eb/c23849/home /home in /etc/fstab
> 
> being generated as though the root id during boot is a normal unprivilaged unser?
> /usr/bin/setup-var-home.sh:
> #!/bin/bash
> H=$(hostname);
> #H="b827ebc23849";
> /bin/mount 192.168.1.10:/nsfroot/${H:0:-6}"/"${H:6:12}"/var  /var";
> /bin/mount 192.168.1.10:/nsfroot/${H:0:-6}"/"${H:6:12}"/home /home";
I'm not sure a shell script is the best way to mount NFS exports at boot
(I have read your other recent bug reports, I'm aware that you're
currently encountering problems with NFS mounts at boot, but running a
shell script for solving this seems a bit overkill to me), but in this
case, this has nothing to do with NFS or systemd, it's your shell script
which is flawed.

More precisely, you placed the double-quotes in a way that makes the
shell consider everything after /bin/mount as one long argument. You
could remove those double-quotes altogether, since it seems you name
your NFS exports according to your machines' hostnames, and a hostname
can't contain spaces ([1]), but if you absolutely want to hold onto
them, try to correctly quote the different arguments, for example:

/bin/mount 192.168.1.10:/nsfroot/"${H:0:-6}"/"${H:6:12}"/var  /var

or:

/bin/mount 192.168.1.10:/nsfroot/"${H:0:-6}/${H:6:12}"/var  /var

or:

/bin/mount 192.168.1.10:/nsfroot/"${H:0:-6}/${H:6:12}/var"  /var

or, to be absolutely clear as to what the mount command expects, and how
to quote arguments accordingly:

/bin/mount "192.168.1.10:/nsfroot/${H:0:-6}/${H:6:12}/var"  "/var"

I understand that you may be a bit frustrated with those aforementioned
problems you're currently encountering with your NFS mounts at boot, but
filing bug reports at the drop of a hat is counter-productive. Not only
are you nagging this package's maintainers, but also other people (like
me) who don't maintain this package but subscribed to receive its bug
reports.

After verifying that what I'm suggesting works as you expect (but then
again, I sincerely doubt a shell script is the way to go here), please
spare the maintainers a bit of their (precious) time and close this bug.

[1] https://en.wikipedia.org/wiki/Hostname#Restrictions_on_valid_hostnames

Regards,

-- 
Raphaël Halimi

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: