installing kiconvtool

Janus Ng

Explorer
Joined
Apr 10, 2016
Messages
63
I want to mount smb shares inside the jails. However, mount_smbfs requires root privileges to run filename encoding conversion. I need UTF-8 encoding support. kiconvtool loads specific charset tables into kernel.

I found that kiconvtool is listed in the iocages ports but I cannot find it in the base pkg repository.

How do I install it?

Thank you very much!
 

Janus Ng

Explorer
Joined
Apr 10, 2016
Messages
63
Notes that this will be added to the base system for U1: https://redmine.ixsystems.com/issues/57543

After I have updated to FreeNAS 11.2-U2, I am sure it came with kiconvtool installed.
$ which kiconvtool /usr/local/sbin/kiconvtool

I have followed this page, in order to let the root in a jail, an unprivileged user, to use mount command with encoding translation support which is required by mount_smbfs.

Added the following line to the /boot/loader.conf
Code:
smbfs_iconv_load="YES"


And these lines to /config/base/etc/rc.conf
Code:
# enable kiconv script
kiconv_preload="YES"

# specify local/foreign encodings
kiconv_local_charsets="UFT-8"
kiconv_foreign_charsets="UTF-8"


And the ~/.nsmbrc
Code:
[default]
workgroup=WORKGROUP

[SERVER]
addr=192.168.0.200
charsets=UTF-8:UTF-8


However, when I executed the following command as an unprivileged user after a reboot:
$ /usr/sbin/mount_smbfs -N -f 666 -d 777 -E UTF-8:UTF-8 //user@server/Media /net/server/media mount_smbfs: can not setup kernel iconv table (UTF-8:tolower): syserr = Operation not permitted

The same command worked faultlessly with root.

What did I mess up?
 

Janus Ng

Explorer
Joined
Apr 10, 2016
Messages
63
No, I cannot resolve it.

However, today I have just learnt that I should have put those modifications to loader.conf and rc.conf into tunables instead. Hence I followed the rules and add 4 values to tunables.

However, I am still confused on how tunables works. I still cannot make it work after a reboot.
Code:
$ /usr/sbin/mount_smbfs -N -f 666 -d 777 -E UTF-8:UTF-8 //user@server/Media /net/server/media
mount_smbfs: can not setup kernel iconv table (UTF-8:tolower): syserr = Operation not permitted


Questions regarding tunables:
  1. Should I double quote the values?
  2. Where do the tunables show up in the actual system?
I have a screenshot of the tunables page.
Screen Shot 2019-03-22 at 3.10.55 PM.png


Code:
$ cat /boot/loader.conf
#
# Boot loader file for FreeNAS.
#
product="FreeNAS"
autoboot_delay="5"
loader_logo="FreeNAS"
loader_menu_title="Welcome to FreeNAS"
loader_brand="FreeNAS"
loader_version=" "

# Workaround slow to attach USB boot devices
kern.cam.boot_delay="30000"

# If the machine dies at boot before /etc/rc.d/sysctl is run, let the user do
# something.
debug.debugger_on_panic=1
debug.ddb.textdump.pending=1

hw.hptrr.attach_generic=0

# Retry for 30 seconds before giving up.
vfs.mountroot.timeout="30"

# Load firmware for isp FC cards.
ispfw_load="YES"

# Load ipmi module
ipmi_load="YES"

# Load freenas sysctl module
freenas_sysctl_load="YES"

# Put FC ports in initiator mode
hint.isp.0.role=2
hint.isp.1.role=2
hint.isp.2.role=2
hint.isp.3.role=2

# Possible kernel module locations
module_path="/boot/kernel;/boot/modules;/usr/local/modules"

# Disable IPv6 link local addresses.  We'll enable this per interface
# if IPv6 is configured for the interface later on in boot.
net.inet6.ip6.auto_linklocal="0"

# Relax the TCP reassembly queue length limit to improve performance
# in the event of packet loss or reordering.
net.inet.tcp.reass.maxqueuelen=1448

# Switch ZVOLs into "dev" mode, skipping GEOM.
vfs.zfs.vol.mode=2

# Disable unused GEOM labels.
kern.geom.label.disk_ident.enable=0
kern.geom.label.ufs.enable=0
kern.geom.label.ufsid.enable=0
kern.geom.label.reiserfs.enable=0
kern.geom.label.ntfs.enable=0
kern.geom.label.msdosfs.enable=0
kern.geom.label.ext2fs.enable=0

# Disable AHCI Enclosure support, not wired anywhere now.
hint.ahciem.0.disabled="1"
hint.ahciem.1.disabled="1"

# Increase dmesg buffer to fit longer boot output.
kern.msgbufsize="524288"

# Prefer newer mrsas(4) to mfi(4) for controllers supported by both.
hw.mfi.mrsas_enable="1"

# Don't wait for USB detach when rebooting.  We may wish
# to investigate this further.
hw.usb.no_shutdown_wait=1

# Disable File Handle Affinity for NFS write operations.
# It improves NFS write throughput with ZFS sync=always.
vfs.nfsd.fha.write=0
vfs.nfsd.fha.max_nfsds_per_fh=32

# Make pagedaemon always request kernel (primarily ZFS) to free memory
# before even thinking about swapping.  It may be another extreme, but
# hopefully it will be better then going out of swap, since arc_min won't
# allow ARC to shrink too much if some application really require swap.
vm.lowmem_period=0


Code:
$ cat /etc/rc.conf
#!/bin/sh

# This file is explicitly in the public domain.  You may do with it
# anything you like.

# Fallback settings for FreeNAS.  This file is read in first and is
# then overidden by the values in the database.

# XXX need to clean this up

hostname="freenas"
openssh_enable="YES"

sendmail_enable="NONE"    # Run the sendmail inbound daemon (YES/NO).

background_fsck="NO"
fsck_y_enable="YES"

synchronous_dhclient="YES"    # Start dhclient directly on configured

ntpd_enable="YES"
ntpd_sync_on_start="YES"

# open-vm-tools
vmware_guest_vmblock_enable="YES"
vmware_guest_vmhgfs_enable="YES"
vmware_guest_vmmemctl_enable="YES"

devfs_system_ruleset="usbrules"

# System's run from memory disks.
clear_tmp_X="NO"

# Do not mark to autodetach otherwise ZFS gets very unhappy.
geli_autodetach="NO"

# We set dumpdev and run savecore in middleware.  The savecore rc script
# just errors out by the time it runs, and setting dumpdev to AUTO causes
# the dump device to be changed from the one we actually wanted to use.
savecore_enable="NO"
dumpdev="NO"
dumpdir="/data/crash"
ix_textdump_enable="YES"

# A set of storage supporting kernel modules, they must be loaded before ix-fstab.
early_kld_list="geom_mirror geom_multipath"

# A set of kernel modules that can be loaded after mounting local filesystems.
kld_list="dtraceall hwpmc t3_tom t4_tom"

dbus_enable="YES"
mdnsd_enable="YES"

# Turbo boost
performance_cpu_freq="HIGH"

# Add our rc.d scripts to load path
local_startup="/etc/ix.rc.d /usr/local/etc/rc.d"

# Make sure ix scripts run early enough
early_late_divider="*"

# ZFS
root_rw_mount="YES"

# syslog-ng
syslogd_enable="NO"
# Silence syslogd about missing files
# syslogd_flags="-s -C"
syslog_ng_enable="YES"

nginx_enable="YES"
nginx_login_class="nginx"

# Do not log DEVD events below LOG_NOTICE
devd_flags="-q"

# /var is a tmpfs, there is no need to clean it every boot
cleanvar_enable="NO"

# Skip check against sshd
openssh_skipportscheck="YES"

inadyn_flags="--continue-on-error"
 
Top