Fix CIFS mount error(79) caused by missing nls_utf8 kernel module

The keyutils fix alone didn't resolve it — confirmed live with keyutils
already installed, the same error persisted. Root cause: the hardcoded
iocharset=utf8 mount option requires the kernel's nls_utf8 module, which
some kernels don't ship at all (confirmed live: `modprobe nls_utf8` on a
stock Ubuntu 6.8.0-137-generic VPS kernel returns "FATAL: Module
nls_utf8 not found" — not loadable, not built in). Every such mount
fails with errno 79 (ELIBACC) regardless of credentials, which is why
this recurred identically after the keyutils fix.

Both vpn-data-mount.sh and mount-network-drive.sh now probe with a
harmless `modprobe nls_utf8` before adding the option, and mount without
it (falling back to the kernel's build-time nls_default) with a clear
warning if the module isn't available, instead of hard-failing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H4k6J1qXXyYxhGEgnJaMvn
This commit is contained in:
Claude
2026-08-10 20:11:05 +00:00
parent 2d9501a56c
commit 9e886ff9a7
2 changed files with 45 additions and 14 deletions
+13 -1
View File
@@ -121,7 +121,19 @@ CREDS
local ver_opt=""
[[ -n "$smb_ver" ]] && ver_opt=",vers=${smb_ver}"
local opts="uid=${ACTUAL_UID},gid=${ACTUAL_GID},${creds_opt}${ver_opt},iocharset=utf8,nofail,_netdev"
local opts="uid=${ACTUAL_UID},gid=${ACTUAL_GID},${creds_opt}${ver_opt},nofail,_netdev"
# iocharset=utf8 only if the kernel can actually load nls_utf8 — some
# kernels (confirmed live: a stock Ubuntu 6.8.0-137-generic VPS) don't
# ship that module at all, and mount.cifs fails every such mount with
# "mount error(79): Can not access a needed shared library" regardless
# of credentials. modprobe on an already-loaded/built-in module is a
# harmless no-op, so this check is safe to run unconditionally.
if modprobe nls_utf8 >/dev/null 2>&1; then
opts="${opts},iocharset=utf8"
else
warn "This kernel ($(uname -r)) has no nls_utf8 module — mounting without iocharset=utf8. Non-ASCII filenames may not display correctly; try 'sudo apt-get install --reinstall linux-modules-$(uname -r)' to see if it restores the module."
fi
_do_mount "cifs" "$share" "$mount_point" "$opts"
}