[FreeNAS] load libiconv.ko with utf-8 into kernel

I would like to let user besides root to mount a SMB share. It requires filename conversion with UTF-8 encoding.

In /boot/loader.conf file, I have added:
Apache config:
libiconv_load="YES"

And /etc/nsmb.conf file
Apache config:
[default]
workgroup=WORKGROUP

[server]
addr=1.2.3.4
charsets=UTF-8:UTF-8

But mount_smbfs still complains.
Bash:
$ /usr/sbin/mount_smbfs -N -f 666 -d 777 //user@server/shared /mnt/shared
mount_smbfs: can not setup kernel iconv table (ISO8859-1:tolower): syserr = Operation not permitted
Warning: no cfg file(s) found.

What is the correct syntax for loading iconv with UTF-8 into kernel in /boot/loader.conf?

Thanks a ton!
 
Thanks for the pointer!
However, I have a hard time knowing the correct syntax from the loaded modules.

I have attached the output of dmseg -a and kldstat -vh.
 

Attachments

Thanks for your help.

I thought when a SMB share was mounted by root, a normal user should be able to mount another since the required libraries have already been loaded into the kernel. However, it gives the following error.

$ mount_smbfs -N -f 666 -d 777 //user@server/Shared /net/server/shared
Warning: no cfg file(s) found.
mount_smbfs: can not setup kernel iconv table (ISO8859-1:tolower): syserr = Operation not permitted


Any pointers?
 
OK, some observations.

1. Warning: no cfg file(s) found.
Trussing mount_smbfs shows the following:

open("/etc/nsmb.conf",O_RDONLY,0666) ERR#13 'Permission denied'

And indeed:

$ ls -l /etc/nsmb.conf
-rw------- 1 root wheel 77 Nov 13 10:20 /etc/nsmb.conf

Try using ~/.nsmbrc.

2. Looking at your /etc/nsmb.conf contents, you need to specify server name uppercase, i.e. [SERVER].

I'm still looking into why it still gives the EPERM though.
 
Thank you very much. Sorry for the late reply. I was away from home yesterday.

Yay, the "Warning: no cfg file(s) found." was cleared.
And I was using upper case in the actual file.
Thanks for reminding me.:D

Any progress on the iconv table permission issue?
 
Sadly, it looks like there's no easy way to "fix" this to be able doing user-mounts as there's a lot of resulting iconv loads in kernel. Same story e.g. for mount_msdosfs if you specify -D (DOS codepage option). I wonder if loading libiconv module could just get all tables for all encodings loaded, that doesn't seem to be that big size for today's RAM sizes, but that's really a separate task. Sadly, for now, I don't see an option to solve this (and I could be very well wrong, of course).
 
Yuripv, thanks for your great effort! :D
It is definitely shortcoming of BSD.
I heard there is a kiconvtool that may help.

Unfortunately kiconvtool is not on the pkg manager of FreeNAS which I am using.:'‑(
 
As I was using it on FreeNAS and FreeNAS 11.2-U2 has come out yesterday and added kiconvtool to the kernel, I have tried kiconvtool today to let an unprivileged user to mount a smb share.

I have added the following line to the /boot/loader.conf
Code:
smbfs_iconv_load="YES"

And these lines to /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

And when I execute the following command as an unprivileged user:
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

What did I mess up?
 
Back
Top