fix(nfs): switch to unfs3 user-space NFS (kernel nfsd unavailable on HA OS)
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 1.0.5 - 2026-03-31
|
||||||
|
|
||||||
|
- fix: switch to unfs3 user-space NFS server (kernel nfsd not available on HA OS)
|
||||||
|
- fix: remove unneeded SYS_ADMIN/SYS_MODULE/kernel_modules (not required with unfs3)
|
||||||
|
|
||||||
## 1.0.3 - 2026-03-31
|
## 1.0.3 - 2026-03-31
|
||||||
|
|
||||||
- feat: support multiple configurable NFS shares (folder, allowed_network, read_only)
|
- feat: support multiple configurable NFS shares (folder, allowed_network, read_only)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
ARG BUILD_FROM
|
ARG BUILD_FROM
|
||||||
FROM $BUILD_FROM
|
FROM $BUILD_FROM
|
||||||
RUN apk add --no-cache nfs-utils bash
|
RUN apk add --no-cache unfs3 bash
|
||||||
COPY run.sh /
|
COPY run.sh /
|
||||||
RUN chmod +x /run.sh
|
RUN chmod +x /run.sh
|
||||||
CMD ["/run.sh"]
|
CMD ["/run.sh"]
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "NFS Server",
|
"name": "NFS Server",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"slug": "nfs_server",
|
"slug": "nfs_server",
|
||||||
"description": "Expose Home Assistant media folder via NFS.",
|
"description": "Expose Home Assistant media folder via NFS.",
|
||||||
"arch": [
|
"arch": [
|
||||||
@@ -12,14 +12,9 @@
|
|||||||
"boot": "auto",
|
"boot": "auto",
|
||||||
"init": false,
|
"init": false,
|
||||||
"host_network": true,
|
"host_network": true,
|
||||||
"privileged": [
|
|
||||||
"SYS_ADMIN",
|
|
||||||
"SYS_MODULE"
|
|
||||||
],
|
|
||||||
"apparmor": false,
|
"apparmor": false,
|
||||||
"hassio_api": true,
|
"hassio_api": true,
|
||||||
"hassio_role": "default",
|
"hassio_role": "default",
|
||||||
"kernel_modules": true,
|
|
||||||
"map": [
|
"map": [
|
||||||
"media:rw",
|
"media:rw",
|
||||||
"share:rw",
|
"share:rw",
|
||||||
|
|||||||
30
nfs/run.sh
30
nfs/run.sh
@@ -11,9 +11,9 @@ for index in $(bashio::config 'shares|keys[]'); do
|
|||||||
MOUNT_PATH="/${FOLDER}"
|
MOUNT_PATH="/${FOLDER}"
|
||||||
|
|
||||||
if bashio::var.true "${READ_ONLY}"; then
|
if bashio::var.true "${READ_ONLY}"; then
|
||||||
OPTIONS="ro,sync,no_subtree_check,no_root_squash"
|
OPTIONS="ro,no_root_squash"
|
||||||
else
|
else
|
||||||
OPTIONS="rw,sync,no_subtree_check,no_root_squash"
|
OPTIONS="rw,no_root_squash"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bashio::log.info "Exporting ${MOUNT_PATH} to ${NETWORK} (${OPTIONS})..."
|
bashio::log.info "Exporting ${MOUNT_PATH} to ${NETWORK} (${OPTIONS})..."
|
||||||
@@ -22,26 +22,6 @@ done
|
|||||||
|
|
||||||
cat /etc/exports
|
cat /etc/exports
|
||||||
|
|
||||||
# Load NFS kernel module
|
# Start unfs3 user-space NFS server in foreground
|
||||||
bashio::log.info "Loading nfsd kernel module..."
|
bashio::log.info "Starting unfs3 NFS server..."
|
||||||
modprobe nfsd 2>/dev/null || bashio::log.warning "nfsd module not available, assuming built-in..."
|
exec unfsd -d -e /etc/exports
|
||||||
|
|
||||||
# Mount nfsd filesystem if not already mounted
|
|
||||||
if ! mountpoint -q /proc/fs/nfsd 2>/dev/null; then
|
|
||||||
bashio::log.info "Mounting nfsd filesystem..."
|
|
||||||
mount -t nfsd nfsd /proc/fs/nfsd || bashio::log.warning "Could not mount nfsd filesystem, it may be built-in..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Start NFS services
|
|
||||||
bashio::log.info "Starting NFS services..."
|
|
||||||
rpcbind
|
|
||||||
exportfs -ra
|
|
||||||
|
|
||||||
# Start rpc.statd for file locking
|
|
||||||
rpc.statd &
|
|
||||||
|
|
||||||
# Start the NFS server kernel threads
|
|
||||||
rpc.nfsd
|
|
||||||
|
|
||||||
# Start rpc.mountd in the foreground to keep the container running
|
|
||||||
exec rpc.mountd --no-udp -F
|
|
||||||
|
|||||||
Reference in New Issue
Block a user