Bug 246760 - ZFS usermount sysrc command invalid
Summary: ZFS usermount sysrc command invalid
Status: Closed FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Documentation (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-doc (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-27 01:07 UTC by Mike Plemmons
Modified: 2020-07-11 15:49 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Plemmons 2020-05-27 01:07:08 UTC
On https://www.freebsd.org/doc/handbook/zfs-zfs.html under heading 19.4.7.2. Sending Encrypted Backups over SSH the text says the following.

"To mount the pool, the unprivileged user must own the directory, and regular users must be allowed to mount file systems. On the receiving system:

# sysctl vfs.usermount=1
vfs.usermount: 0 -> 1
# sysrc -f /etc/sysctl.conf vfs.usermount=1
# zfs create recvpool/backup
# zfs allow -u someuser create,mount,receive recvpool/backup
# chown someuser /recvpool/backup"

When I type the following as using sudo on my 12.1-RELEASE-p2 system I get an error.

[mike@nas ~]$ sudo sysrc -f /etc/sysctl.conf vfs.usermount=1
sysrc: vfs.usermount: name contains characters not allowed in shell

When I change to the root user I get the same error.

[mike@nas ~]$ sudo -i
root@nas:~ # sysrc -f /etc/sysctl.conf vfs.usermount=1
sysrc: vfs.usermount: name contains characters not allowed in shell


It seems like the valid characters variable in /usr/share/bsdconfig/sysrc.subr  is incorrect.

VALID_VARNAME_CHARS="0-9ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_"

Should it include a period?

Also, I believe the documentation should clarify when a user needs to run as root versus when to run as a non-root user. At least it seems like every command should be run as root but it is not clear.

I had to manually edit the /etc/sysctl.conf file.
Comment 1 Mike Plemmons 2020-05-27 01:08:22 UTC
I just realized that my comment about the root versus non-root user is already stated with the change in the prompt symbol.
Comment 2 Allan Jude freebsd_committer 2020-05-27 02:45:08 UTC
Yeah, sysrc cannot be used for sysctls, it only works for shell variables like rc.conf

This bit of documentation should be reverted to the original code:

echo vfs.usermount=1 >> /etc/sysctl.conf

I have commented on the offending change here:

https://reviews.freebsd.org/D12127
Comment 3 commit-hook freebsd_committer 2020-07-11 15:49:11 UTC
A commit references this bug:

Author: allanjude
Date: Sat Jul 11 15:48:48 UTC 2020
New revision: 54327
URL: https://svnweb.freebsd.org/changeset/doc/54327

Log:
  Don't use sysrc for sysctl OIDs

  PR:		246760
  Submitted by:	debdrup
  Reported by:	Mike Plemmons <mikeplemmons@gmail.com>
  Sponsored by:	Klara Inc.
  Event:		July 2020 Bugathon
  Differential Revision:	https://reviews.freebsd.org/D12127

Changes:
  head/en_US.ISO8859-1/books/handbook/zfs/chapter.xml