Skip to contentSkip to conversation

nfs-utils: clean up startup

PATCH Superseded Dan McGregor 3 participants 7 messages Mar 29, 2024 – Apr 3, 2024

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/3 nfs-utils: clean up startup

From: Daniel McGregor <[email protected]>

Change the sysvinit script to start at the S runlevel, this matches Debian, and prevents systemd from generating a unit file for it. Also have the nfsd systemd service request the nfsd kernel filesystem mountpoint. This avoids startup failures in unpriviled containers or other setups that don't support the filesystem.

---
 meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon | 4 ++--
 meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb  | 9 ++++-----
 2 files changed, 6 insertions(+), 7 deletions(-)
meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon +2 -2
index 992267d5a16..4c1ad17c3c6 100644
@@ -3,7 +3,7 @@
 # Provides:          nfs-common
 # Required-Start:    $portmap hwclock
 # Required-Stop:     $portmap hwclock
-# Default-Start:     2 3 4 5
+# Default-Start:     S
 # Default-Stop:      0 1 6
 # Short-Description: NFS support for both client and server
 # Description:       NFS is a popular protocol for file sharing across
@@ -20,7 +20,7 @@
 . /etc/init.d/functions
 
 test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
-test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid
+test -z "$STATD_PID" && STATD_PID=/run/rpc.statd.pid
 #
 # The default state directory is /var/lib/nfs
 test -n "$NFS_STATEDIR" || NFS_STATEDIR=/var/lib/nfs
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +4 -5
index 2f2644f9a83..527fcd609c1 100644
@@ -132,15 +132,14 @@ do_install:append () {
 	install -m 0644 ${WORKDIR}/nfs-server.service ${D}${systemd_system_unitdir}/
 	install -m 0644 ${WORKDIR}/nfs-mountd.service ${D}${systemd_system_unitdir}/
 	install -m 0644 ${WORKDIR}/nfs-statd.service ${D}${systemd_system_unitdir}/
+	install -m 0644 ${WORKDIR}/proc-fs-nfsd.mount ${D}${systemd_system_unitdir}/
 	sed -i -e 's,@SBINDIR@,${sbindir},g' \
 		-e 's,@SYSCONFDIR@,${sysconfdir},g' \
 		-e 's,@HIGH_RLIMIT_NOFILE@,${HIGH_RLIMIT_NOFILE},g' \
 		${D}${systemd_system_unitdir}/*.service
-	if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
-		install -m 0644 ${WORKDIR}/proc-fs-nfsd.mount ${D}${systemd_system_unitdir}/
-		install -d ${D}${systemd_system_unitdir}/sysinit.target.wants/
-		ln -sf ../proc-fs-nfsd.mount ${D}${systemd_system_unitdir}/sysinit.target.wants/proc-fs-nfsd.mount
-	fi
+	# Add compatibility symlinks for the sysvinit scripts
+	ln -s nfs-server.service ${D}${systemd_system_unitdir}/nfsserver.service
+	ln -s /dev/null ${D}${systemd_system_unitdir}/nfscommon.service
 
 	# kernel code as of 3.8 hard-codes this path as a default
 	install -d ${D}/var/lib/nfs/v4recovery
Signature · 1 line
2.41.0
#1 lore raw

PATCH v5 2/3 nfs-utils: Use upstream systemd service files

From: Daniel McGregor <[email protected]>

Reduce diffs against upstream by using the service files provided by them. This reduces our dependence on patches that simply change the names of a service.
This also changes the way some nfs options get set for systemd, it introduces the nfs.conf file for configuration, which all daemons already support.

---
 .../bugfix-adjust-statd-service-name.patch    | 39 -----------------
 .../nfs-utils/nfs-utils/nfs-mountd.service    | 18 --------
 .../nfs-utils/nfs-utils/nfs-server.service    | 24 -----------
 .../nfs-utils/nfs-utils/nfs-statd.service     | 16 -------
 .../nfs-utils-debianize-start-statd.patch     | 42 -------------------
 .../nfs-utils/nfs-utils/nfs-utils.conf        | 35 ----------------
 .../nfs-utils/nfs-utils/proc-fs-nfsd.mount    |  8 ----
 .../nfs-utils/nfs-utils_2.6.4.bb              | 32 +++++---------
 8 files changed, 11 insertions(+), 203 deletions(-)
 delete mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/bugfix-adjust-statd-service-name.patch
 delete mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service
 delete mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service
 delete mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service
 delete mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-debianize-start-statd.patch
 delete mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf
 delete mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/proc-fs-nfsd.mount
meta/recipes-connectivity/nfs-utils/nfs-utils/bugfix-adjust-statd-service-name.patch deleted +0 -39
deleted file mode 100644
index f13d7b380ca..00000000000
@@ -1,39 +0,0 @@
-From 398fed3bb0350cb1229e54e7020ae0e044c206d1 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Ulrich=20=C3=96lmann?= <[email protected]>
-Date: Wed, 17 Feb 2016 08:33:45 +0100
-Subject: bugfix: adjust statd service name
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Upstream uses 'rpc-statd.service' and Yocto introduced 'nfs-statd.service'
-instead but forgot to update the mount.nfs helper 'start-statd' accordingly.
-
-Upstream-Status: Inappropriate [other]
-
-Signed-off-by: Ulrich Ölmann <[email protected]>
-
-Rebase it.
-
-Signed-off-by: Robert Yang <[email protected]>
----
- utils/statd/start-statd | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/utils/statd/start-statd b/utils/statd/start-statd
-index af5c950..df9b9be 100755
---- a/utils/statd/start-statd
-+++ b/utils/statd/start-statd
-@@ -28,10 +28,10 @@ fi
- # First try systemd if it's installed.
- if [ -d /run/systemd/system ]; then
-     # Quit only if the call worked.
--    if systemctl start rpc-statd.service; then
-+    if systemctl start nfs-statd.service; then
-         # Ensure systemd knows not to stop rpc.statd or its dependencies
-         # on 'systemctl isolate ..'
--        systemctl add-wants --runtime remote-fs.target rpc-statd.service
-+        systemctl add-wants --runtime remote-fs.target nfs-statd.service
-         exit 0
-     fi
- fi
meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service deleted +0 -18
deleted file mode 100644
index ebfe64b9ced..00000000000
@@ -1,18 +0,0 @@
-[Unit]
-Description=NFS Mount Daemon
-DefaultDependencies=no
-After=rpcbind.socket
-Requires=proc-fs-nfsd.mount
-After=proc-fs-nfsd.mount
-After=network.target local-fs.target
-BindsTo=nfs-server.service
-ConditionPathExists=@SYSCONFDIR@/exports
-
-[Service]
-EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf
-ExecStart=@SBINDIR@/rpc.mountd -F $MOUNTD_OPTS
-LimitNOFILE=@HIGH_RLIMIT_NOFILE@
-StateDirectory=nfs
-
-[Install]
-WantedBy=multi-user.target
meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service deleted +0 -24
deleted file mode 100644
index 15ceee04d0d..00000000000
@@ -1,24 +0,0 @@
-[Unit]
-Description=NFS server and services
-DefaultDependencies=no
-Requires=network.target proc-fs-nfsd.mount
-Requires=nfs-mountd.service
-Wants=rpcbind.service
-After=local-fs.target
-After=network.target proc-fs-nfsd.mount rpcbind.service nfs-mountd.service
-ConditionPathExists=@SYSCONFDIR@/exports
-
-[Service]
-Type=oneshot
-EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf
-ExecStartPre=@SBINDIR@/exportfs -r
-ExecStart=@SBINDIR@/rpc.nfsd $NFSD_OPTS $NFSD_COUNT
-ExecStop=@SBINDIR@/rpc.nfsd 0
-ExecStopPost=@SBINDIR@/exportfs -au
-ExecStopPost=@SBINDIR@/exportfs -f
-ExecReload=@SBINDIR@/exportfs -r
-RemainAfterExit=yes
-StateDirectory=nfs
-
-[Install]
-WantedBy=multi-user.target
meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service deleted +0 -16
deleted file mode 100644
index b519194121c..00000000000
@@ -1,16 +0,0 @@
-[Unit]
-Description=NFS status monitor for NFSv2/3 locking.
-DefaultDependencies=no
-Conflicts=umount.target
-Requires=nss-lookup.target rpcbind.service
-After=network.target nss-lookup.target rpcbind.service
-ConditionPathExists=@SYSCONFDIR@/exports
-
-[Service]
-EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf
-ExecStart=@SBINDIR@/rpc.statd -F $STATD_OPTS
-LimitNOFILE=@HIGH_RLIMIT_NOFILE@
-StateDirectory=nfs
-
-[Install]
-WantedBy=multi-user.target
meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-debianize-start-statd.patch deleted +0 -42

42 lines not on this page · raw message

meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils.conf deleted +0 -35
deleted file mode 100644
index a1007a7fbf4..00000000000
@@ -1,35 +0,0 @@
-# Parameters to be passed to nfs-utils (clients & server) service files.
-#
-
-# Options to pass to rpc.nfsd.
-NFSD_OPTS=""
-
-# Number of servers to start up; the default is 8 servers.
-NFSD_COUNT=""
-
-# Where to mount nfsd filesystem; the default is "/proc/fs/nfsd".
-PROCNFSD_MOUNTPOINT=""
-
-# Options used to mount nfsd filesystem; the default is "rw,nodev,noexec,nosuid".
-PROCNFSD_MOUNTOPTS=""
-
-# Options for rpc.mountd.
-# If you have a port-based firewall, you might want to set up
-# a fixed port here using the --port option.
-MOUNTD_OPTS=""
-
-# Parameters to be passed to nfs-common (nfs clients & server) init script.
-#
-
-# If you do not set values for the NEED_ options, they will be attempted
-# autodetected; this should be sufficient for most people. Valid alternatives
-# for the NEED_ options are "yes" and "no".
-
-# Do you want to start the statd daemon? It is not needed for NFSv4.
-NEED_STATD=""
-
-# Options to pass to rpc.statd.
-# N.B. statd normally runs on both client and server, and run-time
-# options should be specified accordingly.
-# STATD_OPTS="-p 32765 -o 32766"
-STATD_OPTS=""
meta/recipes-connectivity/nfs-utils/nfs-utils/proc-fs-nfsd.mount deleted +0 -8
deleted file mode 100644
index 630801b3751..00000000000
@@ -1,8 +0,0 @@
-[Unit]
-Description=NFSD configuration filesystem
-After=systemd-modules-load.service
-
-[Mount]
-What=nfsd
-Where=/proc/fs/nfsd
-Type=nfsd
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +11 -21
index 527fcd609c1..3896fac6ed5 100644
@@ -21,13 +21,6 @@ USERADD_PARAM:${PN}-client = "--system  --home-dir /var/lib/nfs \
 SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.xz \
            file://nfsserver \
            file://nfscommon \
-           file://nfs-utils.conf \
-           file://nfs-server.service \
-           file://nfs-mountd.service \
-           file://nfs-statd.service \
-           file://proc-fs-nfsd.mount \
-           file://nfs-utils-debianize-start-statd.patch \
-           file://bugfix-adjust-statd-service-name.patch \
            file://0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch \
            file://clang-warnings.patch \
            file://0001-locktest-Makefile.am-Do-not-use-build-flags.patch \
@@ -48,8 +41,8 @@ INITSCRIPT_PARAMS:${PN}-client = "defaults 19 21"
 inherit autotools-brokensep update-rc.d systemd pkgconfig
 
 SYSTEMD_PACKAGES = "${PN} ${PN}-client"
-SYSTEMD_SERVICE:${PN} = "nfs-server.service nfs-mountd.service"
-SYSTEMD_SERVICE:${PN}-client = "nfs-statd.service"
+SYSTEMD_SERVICE:${PN} = "nfs-server.service"
+SYSTEMD_SERVICE:${PN}-client = "nfs-client.target"
 
 # --enable-uuid is need for cross-compiling
 EXTRA_OECONF = "--with-statduser=rpcuser \
@@ -58,6 +51,7 @@ EXTRA_OECONF = "--with-statduser=rpcuser \
                 --enable-uuid \
                 --disable-gss \
                 --disable-nfsdcltrack \
+                --disable-sbin-override \
                 --with-statdpath=/var/lib/nfs/statd \
                 --with-rpcgen=${HOSTTOOLS_DIR}/rpcgen \
                "
@@ -65,7 +59,7 @@ EXTRA_OECONF = "--with-statduser=rpcuser \
 LDFLAGS:append = " -lsqlite3 -levent"
 
 PACKAGECONFIG ??= "tcp-wrappers \
-    ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
+    ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 systemd', d)} \
 "
 PACKAGECONFIG:remove:libc-musl = "tcp-wrappers"
 PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,--without-tcp-wrappers,tcp-wrappers"
@@ -74,6 +68,7 @@ PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
 PACKAGECONFIG[nfsv41] = "--enable-nfsv41,--disable-nfsv41,libdevmapper,libdevmapper"
 # keyutils is available in meta-oe
 PACKAGECONFIG[nfsv4] = "--enable-nfsv4,--disable-nfsv4,keyutils,python3-core"
+PACKAGECONFIG[systemd] = "--with-systemd=${systemd_unitdir}/system,--without-systemd"
 
 PACKAGES =+ "${PN}-client ${PN}-mount ${PN}-stats ${PN}-rpcctl"
 
@@ -81,14 +76,16 @@ CONFFILES:${PN}-client += "${localstatedir}/lib/nfs/etab \
 			   ${localstatedir}/lib/nfs/rmtab \
 			   ${localstatedir}/lib/nfs/xtab \
 			   ${localstatedir}/lib/nfs/statd/state \
+			   ${sysconfdir}/nfs.conf \
 			   ${sysconfdir}/nfsmount.conf"
 
 FILES:${PN}-client = "${sbindir}/*statd \
 		      ${libdir}/libnfsidmap.so.* \
 		      ${sbindir}/rpc.idmapd ${sbindir}/sm-notify \
 		      ${sbindir}/showmount ${sbindir}/nfsstat \
+		      ${sbindir}/nfsconf \
 		      ${localstatedir}/lib/nfs \
-		      ${sysconfdir}/nfs-utils.conf \
+		      ${sysconfdir}/nfs.conf \
 		      ${sysconfdir}/nfsmount.conf \
 		      ${sysconfdir}/init.d/nfscommon \
 		      ${systemd_system_unitdir}/nfs-statd.service"
@@ -125,18 +122,11 @@ do_install:append () {
 	install -m 0755 ${WORKDIR}/nfsserver ${D}${sysconfdir}/init.d/nfsserver
 	install -m 0755 ${WORKDIR}/nfscommon ${D}${sysconfdir}/init.d/nfscommon
 
-	install -m 0755 ${WORKDIR}/nfs-utils.conf ${D}${sysconfdir}
-	install -m 0755 ${S}/utils/mount/nfsmount.conf ${D}${sysconfdir}
+	install -m 0644 ${S}/nfs.conf ${D}${sysconfdir}
 
 	install -d ${D}${systemd_system_unitdir}
-	install -m 0644 ${WORKDIR}/nfs-server.service ${D}${systemd_system_unitdir}/
-	install -m 0644 ${WORKDIR}/nfs-mountd.service ${D}${systemd_system_unitdir}/
-	install -m 0644 ${WORKDIR}/nfs-statd.service ${D}${systemd_system_unitdir}/
-	install -m 0644 ${WORKDIR}/proc-fs-nfsd.mount ${D}${systemd_system_unitdir}/
-	sed -i -e 's,@SBINDIR@,${sbindir},g' \
-		-e 's,@SYSCONFDIR@,${sysconfdir},g' \
-		-e 's,@HIGH_RLIMIT_NOFILE@,${HIGH_RLIMIT_NOFILE},g' \
-		${D}${systemd_system_unitdir}/*.service
+	# Retain historical service name so old scripts keep working
+	ln -s rpc-statd.service ${D}${systemd_system_unitdir}/nfs-statd.service
 	# Add compatibility symlinks for the sysvinit scripts
 	ln -s nfs-server.service ${D}${systemd_system_unitdir}/nfsserver.service
 	ln -s /dev/null ${D}${systemd_system_unitdir}/nfscommon.service
Signature · 1 line
2.41.0
#2 lore raw

PATCH v5 3/3 nfs-utils: Configure nfsv4 ID mapping & Kerberos

In reply to Dan McGregor

From: Daniel McGregor <[email protected]>

Add support for the nfsv4 user ID mapping daemon, configured with a sensible default, and add a packageconfig for Kerberos support.

This is reasonably tested in production in our environment, but only systemd support. There'll be some more work to do to get GSSAPI and NFS idmapd support integreated into that.

---
 ...01-gssd-use-printf-format-specifiers.patch | 181 ++++++++++++++++++
 .../0002-Use-nogroup-for-nobody-group.patch   |  38 ++++
 .../0003-find-OE-provided-Kerberos.patch      |  42 ++++
 .../nfs-utils/nfs-utils/clang-warnings.patch  |  81 +++++++-
 .../nfs-utils/nfs-utils_2.6.4.bb              |  37 +++-
 5 files changed, 367 insertions(+), 12 deletions(-)
 create mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch
 create mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/0002-Use-nogroup-for-nobody-group.patch
 create mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/0003-find-OE-provided-Kerberos.patch
meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +181 -0
new file mode 100644
index 00000000000..ab6517a30ed
@@ -0,0 +1,181 @@
+From 094b965b7044e7d102542ac30e95b556ca82654b Mon Sep 17 00:00:00 2001
+From: Daniel McGregor <[email protected]>
+Date: Wed, 29 Nov 2023 07:10:58 -0600
+Subject: [PATCH] gssd: use printf format specifiers
+
+This function takes a printf format specifier, tell the compiler about
+that. This adds the ability for GCC to warn about misuses, and prevents
+Clang from warning on the implementation.
+
+Upstream-Status: Pending
+Signed-off-by: Daniel McGregor <[email protected]>
+---
+ utils/gssd/err_util.h     |  2 +-
+ utils/gssd/gss_names.c    |  4 ++--
+ utils/gssd/gss_util.c     |  2 +-
+ utils/gssd/gssd.c         |  4 ++--
+ utils/gssd/gssd_proc.c    |  8 ++++----
+ utils/gssd/krb5_util.c    | 10 +++++-----
+ utils/gssd/svcgssd_proc.c |  8 ++++----
+ 7 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/utils/gssd/err_util.h b/utils/gssd/err_util.h
+index 6fa9d3d..61f5a31 100644
+--- a/utils/gssd/err_util.h
++++ b/utils/gssd/err_util.h
+@@ -32,7 +32,7 @@
+ #define _ERR_UTIL_H_
+ 
+ void initerr(char *progname, int verbosity, int fg);
+-void printerr(int priority, char *format, ...);
++void printerr(int priority, char *format, ...) __attribute__ ((format (printf, 2, 3)));
+ int get_verbosity(void);
+ char * sec2time(int);
+ 
+diff --git a/utils/gssd/gss_names.c b/utils/gssd/gss_names.c
+index 982b96f..0548c33 100644
+--- a/utils/gssd/gss_names.c
++++ b/utils/gssd/gss_names.c
+@@ -65,7 +65,7 @@ get_krb5_hostbased_name(gss_buffer_desc *name, char **hostbased_name)
+ 	if (strchr(name->value, '@') && strchr(name->value, '/')) {
+ 		if ((sname = calloc(name->length, 1)) == NULL) {
+ 			printerr(0, "ERROR: get_krb5_hostbased_name failed "
+-				 "to allocate %d bytes\n", name->length);
++				 "to allocate %zd bytes\n", name->length);
+ 			return -1;
+ 		}
+ 		/* read in name and instance and replace '/' with '@' */
+@@ -102,7 +102,7 @@ get_hostbased_client_name(gss_name_t client_name, gss_OID mech,
+ 	}
+ 	if (name.length >= 0xffff) {	    /* don't overflow */
+ 		printerr(0, "ERROR: get_hostbased_client_name: "
+-			 "received gss_name is too long (%d bytes)\n",
++			 "received gss_name is too long (%zd bytes)\n",
+ 			 name.length);
+ 		goto out_rel_buf;
+ 	}
+diff --git a/utils/gssd/gss_util.c b/utils/gssd/gss_util.c
+index a4b2777..7d41a94 100644
+--- a/utils/gssd/gss_util.c
++++ b/utils/gssd/gss_util.c
+@@ -304,7 +304,7 @@ gssd_acquire_cred(char *server_name, const gss_OID oid)
+ 				target_name, &pbuf, NULL);
+ 		if (ignore_maj_stat == GSS_S_COMPLETE) {
+ 			printerr(1, "Unable to obtain credentials for '%.*s'\n",
+-				 pbuf.length, pbuf.value);
++				 (int)pbuf.length, (char *)pbuf.value);
+ 			ignore_maj_stat = gss_release_buffer(&ignore_min_stat,
+ 							     &pbuf);
+ 		}
+diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
+index 833d8e0..380116a 100644
+--- a/utils/gssd/gssd.c
++++ b/utils/gssd/gssd.c
+@@ -518,9 +518,9 @@ scan_active_thread_list(void)
+ 					do_error_downcall(info->fd, info->uid, -ETIMEDOUT);
+ 				} else {
+ 					if (!(info->flags & UPCALL_THREAD_WARNED)) {
+-						printerr(0, "watchdog: thread id 0x%lx running for %ld seconds\n",
++						printerr(0, "watchdog: thread id 0x%lx running for %lld seconds\n",
+ 								info->tid,
+-								now.tv_sec - info->timeout.tv_sec + upcall_timeout);
++								(long long int)(now.tv_sec - info->timeout.tv_sec + upcall_timeout));
+ 						info->flags |= UPCALL_THREAD_WARNED;
+ 					}
+ 				}
+diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
+index ae568f1..574eb4b 100644
+--- a/utils/gssd/gssd_proc.c
++++ b/utils/gssd/gssd_proc.c
+@@ -168,7 +168,7 @@ do_downcall(int k5_fd, uid_t uid, struct authgss_private_data *pd,
+ 
+ 	if (get_verbosity() > 1)
+ 		printerr(2, "do_downcall(0x%lx): lifetime_rec=%s acceptor=%.*s\n",
+-			tid, sec2time(lifetime_rec), acceptor->length, acceptor->value);
++			tid, sec2time(lifetime_rec), (int)acceptor->length, (char *)acceptor->value);
+ 	buf_size = sizeof(uid) + sizeof(timeout) + sizeof(pd->pd_seq_win) +
+ 		sizeof(pd->pd_ctx_hndl.length) + pd->pd_ctx_hndl.length +
+ 		sizeof(context_token->length) + context_token->length +
+@@ -284,14 +284,14 @@ populate_port(struct sockaddr *sa, const socklen_t salen,
+ 
+ 	port = nfs_getport(sa, salen, program, version, protocol);
+ 	if (!port) {
+-		printerr(0, "ERROR: unable to obtain port for prog %ld "
+-			    "vers %ld\n", program, version);
++		printerr(0, "ERROR: unable to obtain port for prog %lu "
++			    "vers %lu\n", (long unsigned int)program, (long unsigned int)version);
+ 		return 0;
+ 	}
+ 
+ set_port:
+ 	printerr(2, "DEBUG: setting port to %hu for prog %lu vers %lu\n", port,
+-		 program, version);
++		 (long unsigned int)program, (long unsigned int)version);
+ 
+ 	switch (sa->sa_family) {
+ 	case AF_INET:
+diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
+index e3f270e..28f7d84 100644
+--- a/utils/gssd/krb5_util.c
++++ b/utils/gssd/krb5_util.c
+@@ -304,9 +304,9 @@ gssd_find_existing_krb5_ccache(uid_t uid, char *dirname,
+ 				score++;
+ 
+ 			printerr(3, "CC '%s'(%s@%s) passed all checks and"
+-				    " has mtime of %u\n",
++				    " has mtime of %llu\n",
+ 				 buf, princname, realm, 
+-				 tmp_stat.st_mtime);
++				 (long long unsigned)tmp_stat.st_mtime);
+ 			/*
+ 			 * if more than one match is found, return the most
+ 			 * recent (the one with the latest mtime), and
+@@ -341,10 +341,10 @@ gssd_find_existing_krb5_ccache(uid_t uid, char *dirname,
+ 				}
+ 				printerr(3, "CC '%s:%s/%s' is our "
+ 					    "current best match "
+-					    "with mtime of %u\n",
+-					 cctype, dirname,
++					    "with mtime of %llu\n",
++					 *cctype, dirname,
+ 					 best_match_dir->d_name,
+-					 best_match_stat.st_mtime);
++					 (long long unsigned)best_match_stat.st_mtime);
+ 			}
+ 			free(princname);
+ 			free(realm);
+diff --git a/utils/gssd/svcgssd_proc.c b/utils/gssd/svcgssd_proc.c
+index b403143..7fecd1a 100644
+--- a/utils/gssd/svcgssd_proc.c
++++ b/utils/gssd/svcgssd_proc.c
+@@ -102,10 +102,10 @@ do_svc_downcall(gss_buffer_desc *out_handle, struct svc_cred *cred,
+ 	qword_addint(&bp, &blen, cred->cr_uid);
+ 	qword_addint(&bp, &blen, cred->cr_gid);
+ 	qword_addint(&bp, &blen, cred->cr_ngroups);
+-	printerr(2, "mech: %s, hndl len: %d, ctx len %d, timeout: %d (%d from now), "
++	printerr(2, "mech: %s, hndl len: %zd, ctx len %zd, timeout: %lld (%lld from now), "
+ 		 "clnt: %s, uid: %d, gid: %d, num aux grps: %d:\n",
+ 		 fname, out_handle->length, context_token->length,
+-		 endtime, endtime - time(0),
++		 (long long int)endtime, (long long int)(endtime - time(0)),
+ 		 client_name ? client_name : "<null>",
+ 		 cred->cr_uid, cred->cr_gid, cred->cr_ngroups);
+ 	for (i=0; i < cred->cr_ngroups; i++) {
+@@ -232,7 +232,7 @@ get_ids(gss_name_t client_name, gss_OID mech, struct svc_cred *cred)
+ 	}
+ 	if (name.length >= 0xffff || /* be certain name.length+1 doesn't overflow */
+ 	    !(sname = calloc(name.length + 1, 1))) {
+-		printerr(0, "WARNING: get_ids: error allocating %d bytes "
++		printerr(0, "WARNING: get_ids: error allocating %zd bytes "
+ 			"for sname\n", name.length + 1);
+ 		gss_release_buffer(&min_stat, &name);
+ 		goto out;
+@@ -360,7 +360,7 @@ handle_nullreq(char *cp) {
+ 	if (in_handle.length != 0) { /* CONTINUE_INIT case */
+ 		if (in_handle.length != sizeof(ctx)) {
+ 			printerr(0, "WARNING: handle_nullreq: "
+-				    "input handle has unexpected length %d\n",
++				    "input handle has unexpected length %zd\n",
+ 				    in_handle.length);
+ 			goto out_err;
+ 		}
meta/recipes-connectivity/nfs-utils/nfs-utils/0002-Use-nogroup-for-nobody-group.patch new file +38 -0
new file mode 100644
index 00000000000..3c238f851ba
@@ -0,0 +1,38 @@
+From 6095b5a9208eac37b73e05f81c090d8183138c6a Mon Sep 17 00:00:00 2001
+From: Daniel McGregor <[email protected]>
+Date: Tue, 6 Jun 2023 16:07:53 -0600
+Subject: [PATCH] Use "nogroup" for nobody group
+
+Upstream-Status: Inappropriate [oe-core specific, configuration]
+Signed-off-by: Daniel McGregor <[email protected]>
+---
+ support/nfsidmap/idmapd.conf | 2 +-
+ utils/idmapd/idmapd.c        | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/support/nfsidmap/idmapd.conf b/support/nfsidmap/idmapd.conf
+index 2a2f79a1..e6f3724f 100644
+--- a/support/nfsidmap/idmapd.conf
++++ b/support/nfsidmap/idmapd.conf
+@@ -41,7 +41,7 @@
+ [Mapping]
+ 
+ #Nobody-User = nobody
+-#Nobody-Group = nobody
++#Nobody-Group = nogroup
+ 
+ [Translation]
+ 
+diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
+index cd9a965f..3be805e9 100644
+--- a/utils/idmapd/idmapd.c
++++ b/utils/idmapd/idmapd.c
+@@ -89,7 +89,7 @@
+ #endif
+ 
+ #ifndef NFS4NOBODY_GROUP
+-#define NFS4NOBODY_GROUP "nobody"
++#define NFS4NOBODY_GROUP "nogroup"
+ #endif
+ 
+ /* From Niels */
meta/recipes-connectivity/nfs-utils/nfs-utils/0003-find-OE-provided-Kerberos.patch new file +42 -0

42 lines not on this page · raw message

meta/recipes-connectivity/nfs-utils/nfs-utils/clang-warnings.patch +77 -4

95 lines not on this page · raw message

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +29 -8
index 3896fac6ed5..bb65ba33a74 100644
@@ -26,6 +26,9 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x
            file://0001-locktest-Makefile.am-Do-not-use-build-flags.patch \
            file://0001-tools-locktest-Use-intmax_t-to-print-off_t.patch \
            file://0001-reexport.h-Include-unistd.h-to-compile-with-musl.patch \
+           file://0001-gssd-use-printf-format-specifiers.patch \
+           file://0002-Use-nogroup-for-nobody-group.patch \
+           file://0003-find-OE-provided-Kerberos.patch \
            "
 SRC_URI[sha256sum] = "01b3b0fb9c7d0bbabf5114c736542030748c788ec2fd9734744201e9b0a1119d"
 
@@ -49,10 +52,9 @@ EXTRA_OECONF = "--with-statduser=rpcuser \
                 --enable-mountconfig \
                 --enable-libmount-mount \
                 --enable-uuid \
-                --disable-gss \
-                --disable-nfsdcltrack \
                 --disable-sbin-override \
                 --with-statdpath=/var/lib/nfs/statd \
+                --with-pluginpath=${libdir}/libnfsidmap \
                 --with-rpcgen=${HOSTTOOLS_DIR}/rpcgen \
                "
 
@@ -61,13 +63,16 @@ LDFLAGS:append = " -lsqlite3 -levent"
 PACKAGECONFIG ??= "tcp-wrappers \
     ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 systemd', d)} \
 "
+
 PACKAGECONFIG:remove:libc-musl = "tcp-wrappers"
+#krb5 is available in meta-oe
+PACKAGECONFIG[gssapi] = "--with-krb5=${STAGING_EXECPREFIXDIR} --enable-gss --enable-svcgss,--disable-gss --disable-svcgss,krb5"
 PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,--without-tcp-wrappers,tcp-wrappers"
 PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
 # libdevmapper is available in meta-oe
 PACKAGECONFIG[nfsv41] = "--enable-nfsv41,--disable-nfsv41,libdevmapper,libdevmapper"
 # keyutils is available in meta-oe
-PACKAGECONFIG[nfsv4] = "--enable-nfsv4,--disable-nfsv4,keyutils,python3-core"
+PACKAGECONFIG[nfsv4] = "--enable-nfsv4 --enable-nfsdcltrack,--disable-nfsv4 --disable-nfsdcltrack,keyutils,python3-core"
 PACKAGECONFIG[systemd] = "--with-systemd=${systemd_unitdir}/system,--without-systemd"
 
 PACKAGES =+ "${PN}-client ${PN}-mount ${PN}-stats ${PN}-rpcctl"
@@ -76,19 +81,34 @@ CONFFILES:${PN}-client += "${localstatedir}/lib/nfs/etab \
 			   ${localstatedir}/lib/nfs/rmtab \
 			   ${localstatedir}/lib/nfs/xtab \
 			   ${localstatedir}/lib/nfs/statd/state \
+			   ${sysconfdir}/idmapd.conf \
 			   ${sysconfdir}/nfs.conf \
 			   ${sysconfdir}/nfsmount.conf"
 
 FILES:${PN}-client = "${sbindir}/*statd \
-		      ${libdir}/libnfsidmap.so.* \
 		      ${sbindir}/rpc.idmapd ${sbindir}/sm-notify \
 		      ${sbindir}/showmount ${sbindir}/nfsstat \
+		      ${sbindir}/rpc.gssd \
 		      ${sbindir}/nfsconf \
+		      ${libdir}/libnfsidmap.so.* \
+		      ${libdir}/libnfsidmap/*.so \
+		      ${libexecdir}/nfsrahead \
 		      ${localstatedir}/lib/nfs \
+		      ${sysconfdir}/idmapd.conf \
+		      ${sysconfdir}/init.d/nfscommon \
 		      ${sysconfdir}/nfs.conf \
 		      ${sysconfdir}/nfsmount.conf \
-		      ${sysconfdir}/init.d/nfscommon \
-		      ${systemd_system_unitdir}/nfs-statd.service"
+		      ${systemd_system_unitdir}/auth-rpcgss-module.service \
+		      ${systemd_system_unitdir}/nfs-client.target \
+		      ${systemd_system_unitdir}/nfs-idmapd.service \
+		      ${systemd_system_unitdir}/nfs-statd.service \
+		      ${systemd_system_unitdir}/nfscommon.service \
+		      ${systemd_system_unitdir}/rpc-gssd.service \
+		      ${systemd_system_unitdir}/rpc-statd-notify.service \
+		      ${systemd_system_unitdir}/rpc-statd.service \
+		      ${systemd_system_unitdir}/rpc_pipefs.target \
+		      ${systemd_system_unitdir}/var-lib-nfs-rpc_pipefs.mount \
+		      ${nonarch_libdir}/udev/rules.d/*"
 RDEPENDS:${PN}-client = "${PN}-mount rpcbind"
 
 FILES:${PN}-mount = "${base_sbindir}/*mount.nfs*"
@@ -104,8 +124,8 @@ FILES:${PN}-staticdev += "${libdir}/libnfsidmap/*.a"
 FILES:${PN} += "${systemd_unitdir} ${libdir}/libnfsidmap/ ${nonarch_libdir}/modprobe.d"
 
 do_configure:prepend() {
-	sed -i -e 's,sbindir = /sbin,sbindir = ${base_sbindir},g' \
-		${S}/utils/mount/Makefile.am
+	sed -i -e 's,udev_rulesdir = /usr/lib/udev/rules.d/,udev_rulesdir = ${nonarch_base_libdir}/udev/rules.d/,g' \
+	    ${S}/systemd/Makefile.am ${S}/tools/nfsrahead/Makefile.am
 }
 
 # Make clean needed because the package comes with
@@ -122,6 +142,7 @@ do_install:append () {
 	install -m 0755 ${WORKDIR}/nfsserver ${D}${sysconfdir}/init.d/nfsserver
 	install -m 0755 ${WORKDIR}/nfscommon ${D}${sysconfdir}/init.d/nfscommon
 
+	install -m 0644 ${S}/support/nfsidmap/idmapd.conf ${D}${sysconfdir}
 	install -m 0644 ${S}/nfs.conf ${D}${sysconfdir}
 
 	install -d ${D}${systemd_system_unitdir}
Signature · 1 line
2.41.0
#3 lore raw

Re: [OE-core] [PATCH v5 3/3] nfs-utils: Configure nfsv4 ID mapping & Kerberos

Do not add pending patches please. Upstream submission first.

Even better if you can review already present patches and submit them too.

Alex

Quoted 584 lines · Dan McGregor

From: Daniel McGregor <[email protected]>

Add support for the nfsv4 user ID mapping daemon, configured with a sensible default, and add a packageconfig for Kerberos support.

This is reasonably tested in production in our environment, but only systemd support. There'll be some more work to do to get GSSAPI and NFS idmapd support integreated into that.

---
 ...01-gssd-use-printf-format-specifiers.patch | 181 ++++++++++++++++++
 .../0002-Use-nogroup-for-nobody-group.patch   |  38 ++++
 .../0003-find-OE-provided-Kerberos.patch      |  42 ++++
 .../nfs-utils/nfs-utils/clang-warnings.patch  |  81 +++++++-
 .../nfs-utils/nfs-utils_2.6.4.bb              |  37 +++-
 5 files changed, 367 insertions(+), 12 deletions(-)
 create mode 100644
meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch
 create mode 100644
meta/recipes-connectivity/nfs-utils/nfs-utils/0002-Use-nogroup-for-nobody-group.patch
 create mode 100644

meta/recipes-connectivity/nfs-utils/nfs-utils/0003-find-OE-provided-Kerberos.patch

diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file mode 100644
index 00000000000..ab6517a30ed
--- /dev/null
+++
b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +31 -0
@@ -0,0 +1,181 @@
+From 094b965b7044e7d102542ac30e95b556ca82654b Mon Sep 17 00:00:00 2001
+From: Daniel McGregor <[email protected]>
+Date: Wed, 29 Nov 2023 07:10:58 -0600
+Subject: [PATCH] gssd: use printf format specifiers
+
+This function takes a printf format specifier, tell the compiler about
+that. This adds the ability for GCC to warn about misuses, and prevents
+Clang from warning on the implementation.
+
+Upstream-Status: Pending
+Signed-off-by: Daniel McGregor <[email protected]>
+---
+ utils/gssd/err_util.h     |  2 +-
+ utils/gssd/gss_names.c    |  4 ++--
+ utils/gssd/gss_util.c     |  2 +-
+ utils/gssd/gssd.c         |  4 ++--
+ utils/gssd/gssd_proc.c    |  8 ++++----
+ utils/gssd/krb5_util.c    | 10 +++++-----
+ utils/gssd/svcgssd_proc.c |  8 ++++----
+ 7 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/utils/gssd/err_util.h b/utils/gssd/err_util.h
+index 6fa9d3d..61f5a31 100644
+--- a/utils/gssd/err_util.h
++++ b/utils/gssd/err_util.h
+@@ -32,7 +32,7 @@
+ #define _ERR_UTIL_H_
+
+ void initerr(char *progname, int verbosity, int fg);
+-void printerr(int priority, char *format, ...);
++void printerr(int priority, char *format, ...) __attribute__ ((format

(printf, 2, 3)));
+ int get_verbosity(void);
+ char * sec2time(int);

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +6 -0
+
+diff --git a/utils/gssd/gss_names.c b/utils/gssd/gss_names.c
+index 982b96f..0548c33 100644
+--- a/utils/gssd/gss_names.c
++++ b/utils/gssd/gss_names.c
+@@ -65,7 +65,7 @@ get_krb5_hostbased_name(gss_buffer_desc *name, char

**hostbased_name)

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +3 -0
+       if (strchr(name->value, '@') && strchr(name->value, '/')) {
+               if ((sname = calloc(name->length, 1)) == NULL) {
+                       printerr(0, "ERROR: get_krb5_hostbased_name failed

"

+-                               "to allocate %d bytes\n", name->length);
++                               "to allocate %zd bytes\n", name->length);
meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +4 -0
+                       return -1;
+               }
+               /* read in name and instance and replace '/' with '@' */
+@@ -102,7 +102,7 @@ get_hostbased_client_name(gss_name_t client_name,

gss_OID mech,

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +13 -0
+       }
+       if (name.length >= 0xffff) {        /* don't overflow */
+               printerr(0, "ERROR: get_hostbased_client_name: "
+-                       "received gss_name is too long (%d bytes)\n",
++                       "received gss_name is too long (%zd bytes)\n",
+                        name.length);
+               goto out_rel_buf;
+       }
+diff --git a/utils/gssd/gss_util.c b/utils/gssd/gss_util.c
+index a4b2777..7d41a94 100644
+--- a/utils/gssd/gss_util.c
++++ b/utils/gssd/gss_util.c
+@@ -304,7 +304,7 @@ gssd_acquire_cred(char *server_name, const gss_OID

oid)

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +3 -0
+                               target_name, &pbuf, NULL);
+               if (ignore_maj_stat == GSS_S_COMPLETE) {
+                       printerr(1, "Unable to obtain credentials for

'%.*s'\n",

+-                               pbuf.length, pbuf.value);
++                               (int)pbuf.length, (char *)pbuf.value);
+                       ignore_maj_stat =

gss_release_buffer(&ignore_min_stat,

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +8 -0
+                                                            &pbuf);
+               }
+diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
+index 833d8e0..380116a 100644
+--- a/utils/gssd/gssd.c
++++ b/utils/gssd/gssd.c
+@@ -518,9 +518,9 @@ scan_active_thread_list(void)
+                                       do_error_downcall(info->fd,

info->uid, -ETIMEDOUT);

(quoted diff) +2 -0
+                               } else {
+                                       if (!(info->flags &

UPCALL_THREAD_WARNED)) {
+- printerr(0, "watchdog:
thread id 0x%lx running for %ld seconds\n",
++ printerr(0, "watchdog:
thread id 0x%lx running for %lld seconds\n",
+ info->tid,
+- now.tv_sec
- info->timeout.tv_sec + upcall_timeout);
++ (long long
int)(now.tv_sec - info->timeout.tv_sec + upcall_timeout));
+ info->flags |=
UPCALL_THREAD_WARNED;

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +7 -0
+                                       }
+                               }
+diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
+index ae568f1..574eb4b 100644
+--- a/utils/gssd/gssd_proc.c
++++ b/utils/gssd/gssd_proc.c
+@@ -168,7 +168,7 @@ do_downcall(int k5_fd, uid_t uid, struct

authgss_private_data *pd,

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +3 -0
+
+       if (get_verbosity() > 1)
+               printerr(2, "do_downcall(0x%lx): lifetime_rec=%s

acceptor=%.*s\n",
+- tid, sec2time(lifetime_rec), acceptor->length,
acceptor->value);
++ tid, sec2time(lifetime_rec),
(int)acceptor->length, (char *)acceptor->value);

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +4 -0
+       buf_size = sizeof(uid) + sizeof(timeout) + sizeof(pd->pd_seq_win) +
+               sizeof(pd->pd_ctx_hndl.length) + pd->pd_ctx_hndl.length +
+               sizeof(context_token->length) + context_token->length +
+@@ -284,14 +284,14 @@ populate_port(struct sockaddr *sa, const socklen_t

salen,

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +7 -0
+
+       port = nfs_getport(sa, salen, program, version, protocol);
+       if (!port) {
+-              printerr(0, "ERROR: unable to obtain port for prog %ld "
+-                          "vers %ld\n", program, version);
++              printerr(0, "ERROR: unable to obtain port for prog %lu "
++                          "vers %lu\n", (long unsigned int)program,

(long unsigned int)version);

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +5 -0
+               return 0;
+       }
+
+ set_port:
+       printerr(2, "DEBUG: setting port to %hu for prog %lu vers %lu\n",

port,

+-               program, version);
++               (long unsigned int)program, (long unsigned int)version);
meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +8 -0
+
+       switch (sa->sa_family) {
+       case AF_INET:
+diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
+index e3f270e..28f7d84 100644
+--- a/utils/gssd/krb5_util.c
++++ b/utils/gssd/krb5_util.c
+@@ -304,9 +304,9 @@ gssd_find_existing_krb5_ccache(uid_t uid, char

*dirname,

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +12 -0
+                               score++;
+
+                       printerr(3, "CC '%s'(%s@%s) passed all checks and"
+-                                  " has mtime of %u\n",
++                                  " has mtime of %llu\n",
+                                buf, princname, realm,
+-                               tmp_stat.st_mtime);
++                               (long long unsigned)tmp_stat.st_mtime);
+                       /*
+                        * if more than one match is found, return the most
+                        * recent (the one with the latest mtime), and
+@@ -341,10 +341,10 @@ gssd_find_existing_krb5_ccache(uid_t uid, char

*dirname,

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +10 -0
+                               }
+                               printerr(3, "CC '%s:%s/%s' is our "
+                                           "current best match "
+-                                          "with mtime of %u\n",
+-                                       cctype, dirname,
++                                          "with mtime of %llu\n",
++                                       *cctype, dirname,
+                                        best_match_dir->d_name,
+-                                       best_match_stat.st_mtime);
++                                       (long long

unsigned)best_match_stat.st_mtime);

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +8 -0
+                       }
+                       free(princname);
+                       free(realm);
+diff --git a/utils/gssd/svcgssd_proc.c b/utils/gssd/svcgssd_proc.c
+index b403143..7fecd1a 100644
+--- a/utils/gssd/svcgssd_proc.c
++++ b/utils/gssd/svcgssd_proc.c
+@@ -102,10 +102,10 @@ do_svc_downcall(gss_buffer_desc *out_handle, struct

svc_cred *cred,

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +4 -0
+       qword_addint(&bp, &blen, cred->cr_uid);
+       qword_addint(&bp, &blen, cred->cr_gid);
+       qword_addint(&bp, &blen, cred->cr_ngroups);
+-      printerr(2, "mech: %s, hndl len: %d, ctx len %d, timeout: %d (%d

from now), "
++ printerr(2, "mech: %s, hndl len: %zd, ctx len %zd, timeout: %lld
(%lld from now), "

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +4 -0
+                "clnt: %s, uid: %d, gid: %d, num aux grps: %d:\n",
+                fname, out_handle->length, context_token->length,
+-               endtime, endtime - time(0),
++               (long long int)endtime, (long long int)(endtime -

time(0)),

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +4 -0
+                client_name ? client_name : "<null>",
+                cred->cr_uid, cred->cr_gid, cred->cr_ngroups);
+       for (i=0; i < cred->cr_ngroups; i++) {
+@@ -232,7 +232,7 @@ get_ids(gss_name_t client_name, gss_OID mech, struct

svc_cred *cred)

(quoted diff) +2 -0
+       }
+       if (name.length >= 0xffff || /* be certain name.length+1 doesn't

overflow */

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +11 -0
+           !(sname = calloc(name.length + 1, 1))) {
+-              printerr(0, "WARNING: get_ids: error allocating %d bytes "
++              printerr(0, "WARNING: get_ids: error allocating %zd bytes "
+                       "for sname\n", name.length + 1);
+               gss_release_buffer(&min_stat, &name);
+               goto out;
+@@ -360,7 +360,7 @@ handle_nullreq(char *cp) {
+       if (in_handle.length != 0) { /* CONTINUE_INIT case */
+               if (in_handle.length != sizeof(ctx)) {
+                       printerr(0, "WARNING: handle_nullreq: "
+-                                  "input handle has unexpected length

%d\n",
++ "input handle has unexpected length
%zd\n",

meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +3 -0
+                                   in_handle.length);
+                       goto out_err;
+               }

diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0002-Use-nogroup-for-nobody-group.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0002-Use-nogroup-for-nobody-group.patch new file mode 100644
index 00000000000..3c238f851ba
--- /dev/null
+++
b/meta/recipes-connectivity/nfs-utils/nfs-utils/0002-Use-nogroup-for-nobody-group.patch

meta/recipes-connectivity/nfs-utils/nfs-utils/0002-Use-nogroup-for-nobody-group.patch new file +38 -0
@@ -0,0 +1,38 @@
+From 6095b5a9208eac37b73e05f81c090d8183138c6a Mon Sep 17 00:00:00 2001
+From: Daniel McGregor <[email protected]>
+Date: Tue, 6 Jun 2023 16:07:53 -0600
+Subject: [PATCH] Use "nogroup" for nobody group
+
+Upstream-Status: Inappropriate [oe-core specific, configuration]
+Signed-off-by: Daniel McGregor <[email protected]>
+---
+ support/nfsidmap/idmapd.conf | 2 +-
+ utils/idmapd/idmapd.c        | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/support/nfsidmap/idmapd.conf b/support/nfsidmap/idmapd.conf
+index 2a2f79a1..e6f3724f 100644
+--- a/support/nfsidmap/idmapd.conf
++++ b/support/nfsidmap/idmapd.conf
+@@ -41,7 +41,7 @@
+ [Mapping]
+
+ #Nobody-User = nobody
+-#Nobody-Group = nobody
++#Nobody-Group = nogroup
+
+ [Translation]
+
+diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
+index cd9a965f..3be805e9 100644
+--- a/utils/idmapd/idmapd.c
++++ b/utils/idmapd/idmapd.c
+@@ -89,7 +89,7 @@
+ #endif
+
+ #ifndef NFS4NOBODY_GROUP
+-#define NFS4NOBODY_GROUP "nobody"
++#define NFS4NOBODY_GROUP "nogroup"
+ #endif
+
+ /* From Niels */

diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0003-find-OE-provided-Kerberos.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0003-find-OE-provided-Kerberos.patch new file mode 100644
index 00000000000..4f15aaec4ea
--- /dev/null
+++
b/meta/recipes-connectivity/nfs-utils/nfs-utils/0003-find-OE-provided-Kerberos.patch

meta/recipes-connectivity/nfs-utils/nfs-utils/0003-find-OE-provided-Kerberos.patch new file +42 -0
@@ -0,0 +1,42 @@
+From f4f4a226bfd71ddc0f53dd54159e3eaa835b18e6 Mon Sep 17 00:00:00 2001
+From: Daniel McGregor <[email protected]>
+Date: Wed, 8 Nov 2023 16:24:20 -0600
+Subject: [PATCH] find OE provided Kerberos
+
+Upstream-Status: Inappropriate [oe-core specific]
+Signed-off-by: Daniel McGregor <[email protected]>
+---
+ aclocal/kerberos5.m4 | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/aclocal/kerberos5.m4 b/aclocal/kerberos5.m4
+index f96f0fd..ad85fdf 100644
+--- a/aclocal/kerberos5.m4
++++ b/aclocal/kerberos5.m4
+@@ -22,8 +22,8 @@ AC_DEFUN([AC_KERBEROS_V5],[
+     dnl This ugly hack brought on by the split installation of
+     dnl MIT Kerberos on Fedora Core 1
+     K5CONFIG=""
+-    if test -f $dir/bin/krb5-config; then
+-      K5CONFIG=$dir/bin/krb5-config
++    if test -f $dir/bin/crossscripts/krb5-config; then
++      K5CONFIG=$dir/bin/crossscripts/krb5-config
+     elif test -f "/usr/kerberos/bin/krb5-config"; then
+       K5CONFIG="/usr/kerberos/bin/krb5-config"
+     elif test -f "/usr/lib/mit/bin/krb5-config"; then
+@@ -72,6 +72,7 @@ AC_DEFUN([AC_KERBEROS_V5],[
+   AC_MSG_RESULT($KRBDIR)
+
+   dnl Check if -rpath=$(KRBDIR)/lib is needed
++  if false; then
+   echo "The current KRBDIR is $KRBDIR"
+   if test "$KRBDIR/lib" = "/lib" -o "$KRBDIR/lib" = "/usr/lib" \
+        -o "$KRBDIR/lib" = "//lib" -o "$KRBDIR/lib" = "/usr//lib" ; then
+@@ -81,6 +82,7 @@ AC_DEFUN([AC_KERBEROS_V5],[
+   else
+     KRBLDFLAGS="-Wl,-rpath=$KRBDIR/lib"
+   fi
++  fi
+
+   dnl Now check for functions within gssapi library
+   AC_CHECK_LIB($gssapi_lib, gss_krb5_export_lucid_sec_context,

diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/clang-warnings.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/clang-warnings.patch index fde99b599eb..ff697477b08 100644

meta/recipes-connectivity/nfs-utils/nfs-utils/clang-warnings.patch +23 -4
@@ -1,4 +1,4 @@
-From 1ab0c326405c6daa06f1a7eb4b0b60bf4e0584c2 Mon Sep 17 00:00:00 2001
+From 7d04566b7b8e57114533360cc4b933a74ed6b314 Mon Sep 17 00:00:00 2001
 From: Khem Raj <[email protected]>
 Date: Tue, 31 Dec 2019 08:15:34 -0800
 Subject: [PATCH] Detect warning options during configure
@@ -16,11 +16,14 @@ Upstream-Status: Pending
 Signed-off-by: Khem Raj <[email protected]>
 
 ---
- support/nfs/xcommon.c | 3 +++
- 1 file changed, 3 insertions(+)
+ support/nfs/xcommon.c          | 6 ++++++
+ support/nfs/xlog.c             | 6 ++++++
+ support/nfsidmap/libnfsidmap.c | 3 +++
+ utils/exportfs/exportfs.c      | 3 +++
+ 4 files changed, 18 insertions(+)
 
 diff --git a/support/nfs/xcommon.c b/support/nfs/xcommon.c
-index 3989f0b..e080423 100644
+index 3989f0bc..ff438c18 100644
 --- a/support/nfs/xcommon.c
 +++ b/support/nfs/xcommon.c
 @@ -98,7 +98,10 @@ nfs_error (const char *fmt, ...) {
@@ -34,3 +37,73 @@ index 3989f0b..e080423 100644
       va_end (args);
       free (fmt2);
  }
+@@ -132,7 +135,10 @@ die(int err, const char *fmt, ...) {
+       va_list args;
+
+       va_start(args, fmt);
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+       vfprintf(stderr, fmt, args);
++#pragma GCC diagnostic pop
+       fprintf(stderr, "\n");
+       va_end(args);
+
+diff --git a/support/nfs/xlog.c b/support/nfs/xlog.c
+index fa125cef..dc4c9ea1 100644
+--- a/support/nfs/xlog.c
++++ b/support/nfs/xlog.c
+@@ -178,11 +178,16 @@ xlog_backend(int kind, const char *fmt, va_list

args)

meta/recipes-connectivity/nfs-utils/nfs-utils/clang-warnings.patch +25 -0
+               fprintf(stderr, "%s: ", log_name);
+ #endif
+               va_copy(args2, args);
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+               vfprintf(stderr, fmt, args2);
++#pragma GCC diagnostic pop
+               fprintf(stderr, "\n");
+               va_end(args2);
+       }
+
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+       if (log_syslog) {
+               switch (kind) {
+               case L_FATAL:
+@@ -203,6 +208,7 @@ xlog_backend(int kind, const char *fmt, va_list args)
+                       break;
+               }
+       }
++#pragma GCC diagnostic pop
+
+       if (kind == L_FATAL)
+               exit(1);
+diff --git a/support/nfsidmap/libnfsidmap.c

b/support/nfsidmap/libnfsidmap.c

meta/recipes-connectivity/nfs-utils/nfs-utils/clang-warnings.patch +29 -0
+index 0a912e52..95eb64d2 100644
+--- a/support/nfsidmap/libnfsidmap.c
++++ b/support/nfsidmap/libnfsidmap.c
+@@ -99,7 +99,10 @@ static void default_logger(const char *fmt, ...)
+       va_list vp;
+
+       va_start(vp, fmt);
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+       vsyslog(LOG_WARNING, fmt, vp);
++#pragma GCC diagnostic pop
+       va_end(vp);
+ }
+
+diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
+index b03a047b..eac1ff2a 100644
+--- a/utils/exportfs/exportfs.c
++++ b/utils/exportfs/exportfs.c
+@@ -646,7 +646,10 @@ dumpopt(char c, char *fmt, ...)
+
+       va_start(ap, fmt);
+       printf("%c", c);
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+       vprintf(fmt, ap);
++#pragma GCC diagnostic pop
+       va_end(ap);
+       return ',';
+ }
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +0 -0
index 3896fac6ed5..bb65ba33a74 100644
@@ -26,6 +26,9 @@ SRC_URI =

"${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x

            file://0001-locktest-Makefile.am-Do-not-use-build-flags.patch \
            file://0001-tools-locktest-Use-intmax_t-to-print-off_t.patch \

file://0001-reexport.h-Include-unistd.h-to-compile-with-musl.patch \

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +3 -0
+           file://0001-gssd-use-printf-format-specifiers.patch \
+           file://0002-Use-nogroup-for-nobody-group.patch \
+           file://0003-find-OE-provided-Kerberos.patch \
            "
 SRC_URI[sha256sum] =

"01b3b0fb9c7d0bbabf5114c736542030748c788ec2fd9734744201e9b0a1119d"

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +4 -3
@@ -49,10 +52,9 @@ EXTRA_OECONF = "--with-statduser=rpcuser \
                 --enable-mountconfig \
                 --enable-libmount-mount \
                 --enable-uuid \
-                --disable-gss \
-                --disable-nfsdcltrack \
                 --disable-sbin-override \
                 --with-statdpath=/var/lib/nfs/statd \
+                --with-pluginpath=${libdir}/libnfsidmap \
                 --with-rpcgen=${HOSTTOOLS_DIR}/rpcgen \
                "
 
@@ -61,13 +63,16 @@ LDFLAGS:append = " -lsqlite3 -levent"
 PACKAGECONFIG ??= "tcp-wrappers \
     ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 systemd', d)} \
 "
+
 PACKAGECONFIG:remove:libc-musl = "tcp-wrappers"
+#krb5 is available in meta-oe
+PACKAGECONFIG[gssapi] = "--with-krb5=${STAGING_EXECPREFIXDIR}
--enable-gss --enable-svcgss,--disable-gss --disable-svcgss,krb5"
 PACKAGECONFIG[tcp-wrappers] =

"--with-tcp-wrappers,--without-tcp-wrappers,tcp-wrappers"
PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"

 # libdevmapper is available in meta-oe
 PACKAGECONFIG[nfsv41] =
"--enable-nfsv41,--disable-nfsv41,libdevmapper,libdevmapper"
 # keyutils is available in meta-oe
-PACKAGECONFIG[nfsv4] =
"--enable-nfsv4,--disable-nfsv4,keyutils,python3-core"
+PACKAGECONFIG[nfsv4] = "--enable-nfsv4
--enable-nfsdcltrack,--disable-nfsv4
--disable-nfsdcltrack,keyutils,python3-core"
 PACKAGECONFIG[systemd] =
"--with-systemd=${systemd_unitdir}/system,--without-systemd"

PACKAGES =+ "${PN}-client ${PN}-mount ${PN}-stats ${PN}-rpcctl"

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +18 -3
@@ -76,19 +81,34 @@ CONFFILES:${PN}-client +=
 "${localstatedir}/lib/nfs/etab \
                           ${localstatedir}/lib/nfs/rmtab \
                           ${localstatedir}/lib/nfs/xtab \
                           ${localstatedir}/lib/nfs/statd/state \
+                          ${sysconfdir}/idmapd.conf \
                           ${sysconfdir}/nfs.conf \
                           ${sysconfdir}/nfsmount.conf"
 
 FILES:${PN}-client = "${sbindir}/*statd \
-                     ${libdir}/libnfsidmap.so.* \
                      ${sbindir}/rpc.idmapd ${sbindir}/sm-notify \
                      ${sbindir}/showmount ${sbindir}/nfsstat \
+                     ${sbindir}/rpc.gssd \
                      ${sbindir}/nfsconf \
+                     ${libdir}/libnfsidmap.so.* \
+                     ${libdir}/libnfsidmap/*.so \
+                     ${libexecdir}/nfsrahead \
                      ${localstatedir}/lib/nfs \
+                     ${sysconfdir}/idmapd.conf \
+                     ${sysconfdir}/init.d/nfscommon \
                      ${sysconfdir}/nfs.conf \
                      ${sysconfdir}/nfsmount.conf \
-                     ${sysconfdir}/init.d/nfscommon \
-                     ${systemd_system_unitdir}/nfs-statd.service"
+                     ${systemd_system_unitdir}/auth-rpcgss-module.service
 \
+                     ${systemd_system_unitdir}/nfs-client.target \
+                     ${systemd_system_unitdir}/nfs-idmapd.service \
+                     ${systemd_system_unitdir}/nfs-statd.service \
+                     ${systemd_system_unitdir}/nfscommon.service \
+                     ${systemd_system_unitdir}/rpc-gssd.service \
+                     ${systemd_system_unitdir}/rpc-statd-notify.service \
+                     ${systemd_system_unitdir}/rpc-statd.service \
+                     ${systemd_system_unitdir}/rpc_pipefs.target \
+
 ${systemd_system_unitdir}/var-lib-nfs-rpc_pipefs.mount \
+                     ${nonarch_libdir}/udev/rules.d/*"

RDEPENDS:${PN}-client = "${PN}-mount rpcbind"

FILES:${PN}-mount = "${base_sbindir}/*mount.nfs*"

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +0 -0
@@ -104,8 +124,8 @@ FILES:${PN}-staticdev += "${libdir}/libnfsidmap/*.a"
 FILES:${PN} += "${systemd_unitdir} ${libdir}/libnfsidmap/

${nonarch_libdir}/modprobe.d"

do_configure:prepend() {

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +1 -2
-       sed -i -e 's,sbindir = /sbin,sbindir = ${base_sbindir},g' \
-               ${S}/utils/mount/Makefile.am
+       sed -i -e 's,udev_rulesdir = /usr/lib/udev/rules.d/,udev_rulesdir

= ${nonarch_base_libdir}/udev/rules.d/,g' \

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +1 -0
+           ${S}/systemd/Makefile.am ${S}/tools/nfsrahead/Makefile.am
 }
 
 # Make clean needed because the package comes with
@@ -122,6 +142,7 @@ do_install:append () {
        install -m 0755 ${WORKDIR}/nfsserver

${D}${sysconfdir}/init.d/nfsserver

        install -m 0755 ${WORKDIR}/nfscommon

${D}${sysconfdir}/init.d/nfscommon

+ install -m 0644 ${S}/support/nfsidmap/idmapd.conf ${D}${sysconfdir}

        install -m 0644 ${S}/nfs.conf ${D}${sysconfdir}

        install -d ${D}${systemd_system_unitdir}

--
2.41.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#197618):
https://lists.openembedded.org/g/openembedded-core/message/197618
Mute This Topic: https://lists.openembedded.org/mt/105209256/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw

Re: [OE-core] [PATCH v5 3/3] nfs-utils: Configure nfsv4 ID mapping & Kerberos

Quoted 3 lines · Alexander Kanavin

Do not add pending patches please. Upstream submission first.

Makes sense. I only hadn't because it's not well documented *how* to submit patches to nfs-utils. I think I got it figured now so I'll submit.

Quoted 2 lines

Even better if you can review already present patches and submit them too.

I'll take a look, but not promises...

Quoted 519 lines

Alex

Quoted 516 lines · Dan McGregor

From: Daniel McGregor <[email protected]>

Add support for the nfsv4 user ID mapping daemon, configured with a sensible default, and add a packageconfig for Kerberos support.

This is reasonably tested in production in our environment, but only systemd support. There'll be some more work to do to get GSSAPI and NFS idmapd support integreated into that.

---
 ...01-gssd-use-printf-format-specifiers.patch | 181 ++++++++++++++++++
 .../0002-Use-nogroup-for-nobody-group.patch   |  38 ++++
 .../0003-find-OE-provided-Kerberos.patch      |  42 ++++
 .../nfs-utils/nfs-utils/clang-warnings.patch  |  81 +++++++-
 .../nfs-utils/nfs-utils_2.6.4.bb              |  37 +++-
 5 files changed, 367 insertions(+), 12 deletions(-)
 create mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch
 create mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/0002-Use-nogroup-for-nobody-group.patch
 create mode 100644 meta/recipes-connectivity/nfs-utils/nfs-utils/0003-find-OE-provided-Kerberos.patch
meta/recipes-connectivity/nfs-utils/nfs-utils/0001-gssd-use-printf-format-specifiers.patch new file +181 -0
new file mode 100644
index 00000000000..ab6517a30ed
@@ -0,0 +1,181 @@
+From 094b965b7044e7d102542ac30e95b556ca82654b Mon Sep 17 00:00:00 2001
+From: Daniel McGregor <[email protected]>
+Date: Wed, 29 Nov 2023 07:10:58 -0600
+Subject: [PATCH] gssd: use printf format specifiers
+
+This function takes a printf format specifier, tell the compiler about
+that. This adds the ability for GCC to warn about misuses, and prevents
+Clang from warning on the implementation.
+
+Upstream-Status: Pending
+Signed-off-by: Daniel McGregor <[email protected]>
+---
+ utils/gssd/err_util.h     |  2 +-
+ utils/gssd/gss_names.c    |  4 ++--
+ utils/gssd/gss_util.c     |  2 +-
+ utils/gssd/gssd.c         |  4 ++--
+ utils/gssd/gssd_proc.c    |  8 ++++----
+ utils/gssd/krb5_util.c    | 10 +++++-----
+ utils/gssd/svcgssd_proc.c |  8 ++++----
+ 7 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/utils/gssd/err_util.h b/utils/gssd/err_util.h
+index 6fa9d3d..61f5a31 100644
+--- a/utils/gssd/err_util.h
++++ b/utils/gssd/err_util.h
+@@ -32,7 +32,7 @@
+ #define _ERR_UTIL_H_
+
+ void initerr(char *progname, int verbosity, int fg);
+-void printerr(int priority, char *format, ...);
++void printerr(int priority, char *format, ...) __attribute__ ((format (printf, 2, 3)));
+ int get_verbosity(void);
+ char * sec2time(int);
+
+diff --git a/utils/gssd/gss_names.c b/utils/gssd/gss_names.c
+index 982b96f..0548c33 100644
+--- a/utils/gssd/gss_names.c
++++ b/utils/gssd/gss_names.c
+@@ -65,7 +65,7 @@ get_krb5_hostbased_name(gss_buffer_desc *name, char **hostbased_name)
+       if (strchr(name->value, '@') && strchr(name->value, '/')) {
+               if ((sname = calloc(name->length, 1)) == NULL) {
+                       printerr(0, "ERROR: get_krb5_hostbased_name failed "
+-                               "to allocate %d bytes\n", name->length);
++                               "to allocate %zd bytes\n", name->length);
+                       return -1;
+               }
+               /* read in name and instance and replace '/' with '@' */
+@@ -102,7 +102,7 @@ get_hostbased_client_name(gss_name_t client_name, gss_OID mech,
+       }
+       if (name.length >= 0xffff) {        /* don't overflow */
+               printerr(0, "ERROR: get_hostbased_client_name: "
+-                       "received gss_name is too long (%d bytes)\n",
++                       "received gss_name is too long (%zd bytes)\n",
+                        name.length);
+               goto out_rel_buf;
+       }
+diff --git a/utils/gssd/gss_util.c b/utils/gssd/gss_util.c
+index a4b2777..7d41a94 100644
+--- a/utils/gssd/gss_util.c
++++ b/utils/gssd/gss_util.c
+@@ -304,7 +304,7 @@ gssd_acquire_cred(char *server_name, const gss_OID oid)
+                               target_name, &pbuf, NULL);
+               if (ignore_maj_stat == GSS_S_COMPLETE) {
+                       printerr(1, "Unable to obtain credentials for '%.*s'\n",
+-                               pbuf.length, pbuf.value);
++                               (int)pbuf.length, (char *)pbuf.value);
+                       ignore_maj_stat = gss_release_buffer(&ignore_min_stat,
+                                                            &pbuf);
+               }
+diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
+index 833d8e0..380116a 100644
+--- a/utils/gssd/gssd.c
++++ b/utils/gssd/gssd.c
+@@ -518,9 +518,9 @@ scan_active_thread_list(void)
+                                       do_error_downcall(info->fd, info->uid, -ETIMEDOUT);
+                               } else {
+                                       if (!(info->flags & UPCALL_THREAD_WARNED)) {
+-                                              printerr(0, "watchdog: thread id 0x%lx running for %ld seconds\n",
++                                              printerr(0, "watchdog: thread id 0x%lx running for %lld seconds\n",
+                                                               info->tid,
+-                                                              now.tv_sec - info->timeout.tv_sec + upcall_timeout);
++                                                              (long long int)(now.tv_sec - info->timeout.tv_sec + upcall_timeout));
+                                               info->flags |= UPCALL_THREAD_WARNED;
+                                       }
+                               }
+diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
+index ae568f1..574eb4b 100644
+--- a/utils/gssd/gssd_proc.c
++++ b/utils/gssd/gssd_proc.c
+@@ -168,7 +168,7 @@ do_downcall(int k5_fd, uid_t uid, struct authgss_private_data *pd,
+
+       if (get_verbosity() > 1)
+               printerr(2, "do_downcall(0x%lx): lifetime_rec=%s acceptor=%.*s\n",
+-                      tid, sec2time(lifetime_rec), acceptor->length, acceptor->value);
++                      tid, sec2time(lifetime_rec), (int)acceptor->length, (char *)acceptor->value);
+       buf_size = sizeof(uid) + sizeof(timeout) + sizeof(pd->pd_seq_win) +
+               sizeof(pd->pd_ctx_hndl.length) + pd->pd_ctx_hndl.length +
+               sizeof(context_token->length) + context_token->length +
+@@ -284,14 +284,14 @@ populate_port(struct sockaddr *sa, const socklen_t salen,
+
+       port = nfs_getport(sa, salen, program, version, protocol);
+       if (!port) {
+-              printerr(0, "ERROR: unable to obtain port for prog %ld "
+-                          "vers %ld\n", program, version);
++              printerr(0, "ERROR: unable to obtain port for prog %lu "
++                          "vers %lu\n", (long unsigned int)program, (long unsigned int)version);
+               return 0;
+       }
+
+ set_port:
+       printerr(2, "DEBUG: setting port to %hu for prog %lu vers %lu\n", port,
+-               program, version);
++               (long unsigned int)program, (long unsigned int)version);
+
+       switch (sa->sa_family) {
+       case AF_INET:
+diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
+index e3f270e..28f7d84 100644
+--- a/utils/gssd/krb5_util.c
++++ b/utils/gssd/krb5_util.c
+@@ -304,9 +304,9 @@ gssd_find_existing_krb5_ccache(uid_t uid, char *dirname,
+                               score++;
+
+                       printerr(3, "CC '%s'(%s@%s) passed all checks and"
+-                                  " has mtime of %u\n",
++                                  " has mtime of %llu\n",
+                                buf, princname, realm,
+-                               tmp_stat.st_mtime);
++                               (long long unsigned)tmp_stat.st_mtime);
+                       /*
+                        * if more than one match is found, return the most
+                        * recent (the one with the latest mtime), and
+@@ -341,10 +341,10 @@ gssd_find_existing_krb5_ccache(uid_t uid, char *dirname,
+                               }
+                               printerr(3, "CC '%s:%s/%s' is our "
+                                           "current best match "
+-                                          "with mtime of %u\n",
+-                                       cctype, dirname,
++                                          "with mtime of %llu\n",
++                                       *cctype, dirname,
+                                        best_match_dir->d_name,
+-                                       best_match_stat.st_mtime);
++                                       (long long unsigned)best_match_stat.st_mtime);
+                       }
+                       free(princname);
+                       free(realm);
+diff --git a/utils/gssd/svcgssd_proc.c b/utils/gssd/svcgssd_proc.c
+index b403143..7fecd1a 100644
+--- a/utils/gssd/svcgssd_proc.c
++++ b/utils/gssd/svcgssd_proc.c
+@@ -102,10 +102,10 @@ do_svc_downcall(gss_buffer_desc *out_handle, struct svc_cred *cred,
+       qword_addint(&bp, &blen, cred->cr_uid);
+       qword_addint(&bp, &blen, cred->cr_gid);
+       qword_addint(&bp, &blen, cred->cr_ngroups);
+-      printerr(2, "mech: %s, hndl len: %d, ctx len %d, timeout: %d (%d from now), "
++      printerr(2, "mech: %s, hndl len: %zd, ctx len %zd, timeout: %lld (%lld from now), "
+                "clnt: %s, uid: %d, gid: %d, num aux grps: %d:\n",
+                fname, out_handle->length, context_token->length,
+-               endtime, endtime - time(0),
++               (long long int)endtime, (long long int)(endtime - time(0)),
+                client_name ? client_name : "<null>",
+                cred->cr_uid, cred->cr_gid, cred->cr_ngroups);
+       for (i=0; i < cred->cr_ngroups; i++) {
+@@ -232,7 +232,7 @@ get_ids(gss_name_t client_name, gss_OID mech, struct svc_cred *cred)
+       }
+       if (name.length >= 0xffff || /* be certain name.length+1 doesn't overflow */
+           !(sname = calloc(name.length + 1, 1))) {
+-              printerr(0, "WARNING: get_ids: error allocating %d bytes "
++              printerr(0, "WARNING: get_ids: error allocating %zd bytes "
+                       "for sname\n", name.length + 1);
+               gss_release_buffer(&min_stat, &name);
+               goto out;
+@@ -360,7 +360,7 @@ handle_nullreq(char *cp) {
+       if (in_handle.length != 0) { /* CONTINUE_INIT case */
+               if (in_handle.length != sizeof(ctx)) {
+                       printerr(0, "WARNING: handle_nullreq: "
+-                                  "input handle has unexpected length %d\n",
++                                  "input handle has unexpected length %zd\n",
+                                   in_handle.length);
+                       goto out_err;
+               }
meta/recipes-connectivity/nfs-utils/nfs-utils/0002-Use-nogroup-for-nobody-group.patch new file +38 -0
new file mode 100644
index 00000000000..3c238f851ba
@@ -0,0 +1,38 @@
+From 6095b5a9208eac37b73e05f81c090d8183138c6a Mon Sep 17 00:00:00 2001
+From: Daniel McGregor <[email protected]>
+Date: Tue, 6 Jun 2023 16:07:53 -0600
+Subject: [PATCH] Use "nogroup" for nobody group
+
+Upstream-Status: Inappropriate [oe-core specific, configuration]
+Signed-off-by: Daniel McGregor <[email protected]>
+---
+ support/nfsidmap/idmapd.conf | 2 +-
+ utils/idmapd/idmapd.c        | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/support/nfsidmap/idmapd.conf b/support/nfsidmap/idmapd.conf
+index 2a2f79a1..e6f3724f 100644
+--- a/support/nfsidmap/idmapd.conf
++++ b/support/nfsidmap/idmapd.conf
+@@ -41,7 +41,7 @@
+ [Mapping]
+
+ #Nobody-User = nobody
+-#Nobody-Group = nobody
++#Nobody-Group = nogroup
+
+ [Translation]
+
+diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
+index cd9a965f..3be805e9 100644
+--- a/utils/idmapd/idmapd.c
++++ b/utils/idmapd/idmapd.c
+@@ -89,7 +89,7 @@
+ #endif
+
+ #ifndef NFS4NOBODY_GROUP
+-#define NFS4NOBODY_GROUP "nobody"
++#define NFS4NOBODY_GROUP "nogroup"
+ #endif
+
+ /* From Niels */
meta/recipes-connectivity/nfs-utils/nfs-utils/0003-find-OE-provided-Kerberos.patch new file +42 -0
new file mode 100644
index 00000000000..4f15aaec4ea
@@ -0,0 +1,42 @@
+From f4f4a226bfd71ddc0f53dd54159e3eaa835b18e6 Mon Sep 17 00:00:00 2001
+From: Daniel McGregor <[email protected]>
+Date: Wed, 8 Nov 2023 16:24:20 -0600
+Subject: [PATCH] find OE provided Kerberos
+
+Upstream-Status: Inappropriate [oe-core specific]
+Signed-off-by: Daniel McGregor <[email protected]>
+---
+ aclocal/kerberos5.m4 | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/aclocal/kerberos5.m4 b/aclocal/kerberos5.m4
+index f96f0fd..ad85fdf 100644
+--- a/aclocal/kerberos5.m4
++++ b/aclocal/kerberos5.m4
+@@ -22,8 +22,8 @@ AC_DEFUN([AC_KERBEROS_V5],[
+     dnl This ugly hack brought on by the split installation of
+     dnl MIT Kerberos on Fedora Core 1
+     K5CONFIG=""
+-    if test -f $dir/bin/krb5-config; then
+-      K5CONFIG=$dir/bin/krb5-config
++    if test -f $dir/bin/crossscripts/krb5-config; then
++      K5CONFIG=$dir/bin/crossscripts/krb5-config
+     elif test -f "/usr/kerberos/bin/krb5-config"; then
+       K5CONFIG="/usr/kerberos/bin/krb5-config"
+     elif test -f "/usr/lib/mit/bin/krb5-config"; then
+@@ -72,6 +72,7 @@ AC_DEFUN([AC_KERBEROS_V5],[
+   AC_MSG_RESULT($KRBDIR)
+
+   dnl Check if -rpath=$(KRBDIR)/lib is needed
++  if false; then
+   echo "The current KRBDIR is $KRBDIR"
+   if test "$KRBDIR/lib" = "/lib" -o "$KRBDIR/lib" = "/usr/lib" \
+        -o "$KRBDIR/lib" = "//lib" -o "$KRBDIR/lib" = "/usr//lib" ; then
+@@ -81,6 +82,7 @@ AC_DEFUN([AC_KERBEROS_V5],[
+   else
+     KRBLDFLAGS="-Wl,-rpath=$KRBDIR/lib"
+   fi
++  fi
+
+   dnl Now check for functions within gssapi library
+   AC_CHECK_LIB($gssapi_lib, gss_krb5_export_lucid_sec_context,
meta/recipes-connectivity/nfs-utils/nfs-utils/clang-warnings.patch +77 -4
index fde99b599eb..ff697477b08 100644
@@ -1,4 +1,4 @@
-From 1ab0c326405c6daa06f1a7eb4b0b60bf4e0584c2 Mon Sep 17 00:00:00 2001
+From 7d04566b7b8e57114533360cc4b933a74ed6b314 Mon Sep 17 00:00:00 2001
 From: Khem Raj <[email protected]>
 Date: Tue, 31 Dec 2019 08:15:34 -0800
 Subject: [PATCH] Detect warning options during configure
@@ -16,11 +16,14 @@ Upstream-Status: Pending
 Signed-off-by: Khem Raj <[email protected]>
 
 ---
- support/nfs/xcommon.c | 3 +++
- 1 file changed, 3 insertions(+)
+ support/nfs/xcommon.c          | 6 ++++++
+ support/nfs/xlog.c             | 6 ++++++
+ support/nfsidmap/libnfsidmap.c | 3 +++
+ utils/exportfs/exportfs.c      | 3 +++
+ 4 files changed, 18 insertions(+)
 
 diff --git a/support/nfs/xcommon.c b/support/nfs/xcommon.c
-index 3989f0b..e080423 100644
+index 3989f0bc..ff438c18 100644
 --- a/support/nfs/xcommon.c
 +++ b/support/nfs/xcommon.c
 @@ -98,7 +98,10 @@ nfs_error (const char *fmt, ...) {
@@ -34,3 +37,73 @@ index 3989f0b..e080423 100644
       va_end (args);
       free (fmt2);
  }
+@@ -132,7 +135,10 @@ die(int err, const char *fmt, ...) {
+       va_list args;
+
+       va_start(args, fmt);
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+       vfprintf(stderr, fmt, args);
++#pragma GCC diagnostic pop
+       fprintf(stderr, "\n");
+       va_end(args);
+
+diff --git a/support/nfs/xlog.c b/support/nfs/xlog.c
+index fa125cef..dc4c9ea1 100644
+--- a/support/nfs/xlog.c
++++ b/support/nfs/xlog.c
+@@ -178,11 +178,16 @@ xlog_backend(int kind, const char *fmt, va_list args)
+               fprintf(stderr, "%s: ", log_name);
+ #endif
+               va_copy(args2, args);
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+               vfprintf(stderr, fmt, args2);
++#pragma GCC diagnostic pop
+               fprintf(stderr, "\n");
+               va_end(args2);
+       }
+
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+       if (log_syslog) {
+               switch (kind) {
+               case L_FATAL:
+@@ -203,6 +208,7 @@ xlog_backend(int kind, const char *fmt, va_list args)
+                       break;
+               }
+       }
++#pragma GCC diagnostic pop
+
+       if (kind == L_FATAL)
+               exit(1);
+diff --git a/support/nfsidmap/libnfsidmap.c b/support/nfsidmap/libnfsidmap.c
+index 0a912e52..95eb64d2 100644
+--- a/support/nfsidmap/libnfsidmap.c
++++ b/support/nfsidmap/libnfsidmap.c
+@@ -99,7 +99,10 @@ static void default_logger(const char *fmt, ...)
+       va_list vp;
+
+       va_start(vp, fmt);
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+       vsyslog(LOG_WARNING, fmt, vp);
++#pragma GCC diagnostic pop
+       va_end(vp);
+ }
+
+diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
+index b03a047b..eac1ff2a 100644
+--- a/utils/exportfs/exportfs.c
++++ b/utils/exportfs/exportfs.c
+@@ -646,7 +646,10 @@ dumpopt(char c, char *fmt, ...)
+
+       va_start(ap, fmt);
+       printf("%c", c);
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+       vprintf(fmt, ap);
++#pragma GCC diagnostic pop
+       va_end(ap);
+       return ',';
+ }
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +29 -9
index 3896fac6ed5..bb65ba33a74 100644
@@ -26,6 +26,9 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x
            file://0001-locktest-Makefile.am-Do-not-use-build-flags.patch \
            file://0001-tools-locktest-Use-intmax_t-to-print-off_t.patch \
            file://0001-reexport.h-Include-unistd.h-to-compile-with-musl.patch \
+           file://0001-gssd-use-printf-format-specifiers.patch \
+           file://0002-Use-nogroup-for-nobody-group.patch \
+           file://0003-find-OE-provided-Kerberos.patch \
            "
 SRC_URI[sha256sum] = "01b3b0fb9c7d0bbabf5114c736542030748c788ec2fd9734744201e9b0a1119d"
 
@@ -49,10 +52,9 @@ EXTRA_OECONF = "--with-statduser=rpcuser \
                 --enable-mountconfig \
                 --enable-libmount-mount \
                 --enable-uuid \
-                --disable-gss \
-                --disable-nfsdcltrack \
                 --disable-sbin-override \
                 --with-statdpath=/var/lib/nfs/statd \
+                --with-pluginpath=${libdir}/libnfsidmap \
                 --with-rpcgen=${HOSTTOOLS_DIR}/rpcgen \
                "
 
@@ -61,13 +63,16 @@ LDFLAGS:append = " -lsqlite3 -levent"
 PACKAGECONFIG ??= "tcp-wrappers \
     ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6 systemd', d)} \
 "
+
 PACKAGECONFIG:remove:libc-musl = "tcp-wrappers"
+#krb5 is available in meta-oe
+PACKAGECONFIG[gssapi] = "--with-krb5=${STAGING_EXECPREFIXDIR} --enable-gss --enable-svcgss,--disable-gss --disable-svcgss,krb5"
 PACKAGECONFIG[tcp-wrappers] = "--with-tcp-wrappers,--without-tcp-wrappers,tcp-wrappers"
 PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6,"
 # libdevmapper is available in meta-oe
 PACKAGECONFIG[nfsv41] = "--enable-nfsv41,--disable-nfsv41,libdevmapper,libdevmapper"
 # keyutils is available in meta-oe
-PACKAGECONFIG[nfsv4] = "--enable-nfsv4,--disable-nfsv4,keyutils,python3-core"
+PACKAGECONFIG[nfsv4] = "--enable-nfsv4 --enable-nfsdcltrack,--disable-nfsv4 --disable-nfsdcltrack,keyutils,python3-core"
 PACKAGECONFIG[systemd] = "--with-systemd=${systemd_unitdir}/system,--without-systemd"
 
 PACKAGES =+ "${PN}-client ${PN}-mount ${PN}-stats ${PN}-rpcctl"
@@ -76,19 +81,34 @@ CONFFILES:${PN}-client += "${localstatedir}/lib/nfs/etab \
                           ${localstatedir}/lib/nfs/rmtab \
                           ${localstatedir}/lib/nfs/xtab \
                           ${localstatedir}/lib/nfs/statd/state \
+                          ${sysconfdir}/idmapd.conf \
                           ${sysconfdir}/nfs.conf \
                           ${sysconfdir}/nfsmount.conf"
 
 FILES:${PN}-client = "${sbindir}/*statd \
-                     ${libdir}/libnfsidmap.so.* \
                      ${sbindir}/rpc.idmapd ${sbindir}/sm-notify \
                      ${sbindir}/showmount ${sbindir}/nfsstat \
+                     ${sbindir}/rpc.gssd \
                      ${sbindir}/nfsconf \
+                     ${libdir}/libnfsidmap.so.* \
+                     ${libdir}/libnfsidmap/*.so \
+                     ${libexecdir}/nfsrahead \
                      ${localstatedir}/lib/nfs \
+                     ${sysconfdir}/idmapd.conf \
+                     ${sysconfdir}/init.d/nfscommon \
                      ${sysconfdir}/nfs.conf \
                      ${sysconfdir}/nfsmount.conf \
-                     ${sysconfdir}/init.d/nfscommon \
-                     ${systemd_system_unitdir}/nfs-statd.service"
+                     ${systemd_system_unitdir}/auth-rpcgss-module.service \
+                     ${systemd_system_unitdir}/nfs-client.target \
+                     ${systemd_system_unitdir}/nfs-idmapd.service \
+                     ${systemd_system_unitdir}/nfs-statd.service \
+                     ${systemd_system_unitdir}/nfscommon.service \
+                     ${systemd_system_unitdir}/rpc-gssd.service \
+                     ${systemd_system_unitdir}/rpc-statd-notify.service \
+                     ${systemd_system_unitdir}/rpc-statd.service \
+                     ${systemd_system_unitdir}/rpc_pipefs.target \
+                     ${systemd_system_unitdir}/var-lib-nfs-rpc_pipefs.mount \
+                     ${nonarch_libdir}/udev/rules.d/*"
 RDEPENDS:${PN}-client = "${PN}-mount rpcbind"
 
 FILES:${PN}-mount = "${base_sbindir}/*mount.nfs*"
@@ -104,8 +124,8 @@ FILES:${PN}-staticdev += "${libdir}/libnfsidmap/*.a"
 FILES:${PN} += "${systemd_unitdir} ${libdir}/libnfsidmap/ ${nonarch_libdir}/modprobe.d"
 
 do_configure:prepend() {
-       sed -i -e 's,sbindir = /sbin,sbindir = ${base_sbindir},g' \
-               ${S}/utils/mount/Makefile.am
+       sed -i -e 's,udev_rulesdir = /usr/lib/udev/rules.d/,udev_rulesdir = ${nonarch_base_libdir}/udev/rules.d/,g' \
+           ${S}/systemd/Makefile.am ${S}/tools/nfsrahead/Makefile.am
 }
 
 # Make clean needed because the package comes with
@@ -122,6 +142,7 @@ do_install:append () {
        install -m 0755 ${WORKDIR}/nfsserver ${D}${sysconfdir}/init.d/nfsserver
        install -m 0755 ${WORKDIR}/nfscommon ${D}${sysconfdir}/init.d/nfscommon
 
+       install -m 0644 ${S}/support/nfsidmap/idmapd.conf ${D}${sysconfdir}
        install -m 0644 ${S}/nfs.conf ${D}${sysconfdir}
 
        install -d ${D}${systemd_system_unitdir}
--

2.41.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#197618): https://lists.openembedded.org/g/openembedded-core/message/197618
Mute This Topic: https://lists.openembedded.org/mt/105209256/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw
In reply to Dan McGregor

This still fails on the AB:

https://autobuilder.yoctoproject.org/typhoon/#/builders/23/builds/9115/steps/14/logs/stdio

Quoted 73 lines · Dan McGregor

From: Daniel McGregor <[email protected]>

Change the sysvinit script to start at the S runlevel, this matches Debian, and prevents systemd from generating a unit file for it. Also have the nfsd systemd service request the nfsd kernel filesystem mountpoint. This avoids startup failures in unpriviled containers or other setups that don't support the filesystem.

---
 meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon | 4 ++--
 meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb  | 9 ++++-----
 2 files changed, 6 insertions(+), 7 deletions(-)
meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon +2 -2
index 992267d5a16..4c1ad17c3c6 100644
@@ -3,7 +3,7 @@
 # Provides:          nfs-common
 # Required-Start:    $portmap hwclock
 # Required-Stop:     $portmap hwclock
-# Default-Start:     2 3 4 5
+# Default-Start:     S
 # Default-Stop:      0 1 6
 # Short-Description: NFS support for both client and server
 # Description:       NFS is a popular protocol for file sharing across
@@ -20,7 +20,7 @@
 . /etc/init.d/functions
 
 test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
-test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid
+test -z "$STATD_PID" && STATD_PID=/run/rpc.statd.pid
 #
 # The default state directory is /var/lib/nfs
 test -n "$NFS_STATEDIR" || NFS_STATEDIR=/var/lib/nfs
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +4 -5
index 2f2644f9a83..527fcd609c1 100644
@@ -132,15 +132,14 @@ do_install:append () {
 	install -m 0644 ${WORKDIR}/nfs-server.service ${D}${systemd_system_unitdir}/
 	install -m 0644 ${WORKDIR}/nfs-mountd.service ${D}${systemd_system_unitdir}/
 	install -m 0644 ${WORKDIR}/nfs-statd.service ${D}${systemd_system_unitdir}/
+	install -m 0644 ${WORKDIR}/proc-fs-nfsd.mount ${D}${systemd_system_unitdir}/
 	sed -i -e 's,@SBINDIR@,${sbindir},g' \
 		-e 's,@SYSCONFDIR@,${sysconfdir},g' \
 		-e 's,@HIGH_RLIMIT_NOFILE@,${HIGH_RLIMIT_NOFILE},g' \
 		${D}${systemd_system_unitdir}/*.service
-	if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
-		install -m 0644 ${WORKDIR}/proc-fs-nfsd.mount ${D}${systemd_system_unitdir}/
-		install -d ${D}${systemd_system_unitdir}/sysinit.target.wants/
-		ln -sf ../proc-fs-nfsd.mount ${D}${systemd_system_unitdir}/sysinit.target.wants/proc-fs-nfsd.mount
-	fi
+	# Add compatibility symlinks for the sysvinit scripts
+	ln -s nfs-server.service ${D}${systemd_system_unitdir}/nfsserver.service
+	ln -s /dev/null ${D}${systemd_system_unitdir}/nfscommon.service
 
 	# kernel code as of 3.8 hard-codes this path as a default
 	install -d ${D}/var/lib/nfs/v4recovery
Signature · 11 lines
2.41.0



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#197616): https://lists.openembedded.org/g/openembedded-core/message/197616
Mute This Topic: https://lists.openembedded.org/mt/105209254/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

Thanks. All my local testing against the defaults is now working as of v7. New upstream statuses in patches and fixed packaging errors I had introduced.

Quoted 99 lines · On Sun, Mar 31, 2024, 15:34 Alexandre Belloni <[email protected]>…

This still fails on the AB:

https://autobuilder.yoctoproject.org/typhoon/#/builders/23/builds/9115/steps/14/logs/stdio

Quoted 8 lines · Dan McGregor

From: Daniel McGregor <[email protected]>

Change the sysvinit script to start at the S runlevel, this matches Debian, and prevents systemd from generating a unit file for it. Also have the nfsd systemd service request the nfsd kernel filesystem mountpoint. This avoids startup failures in unpriviled containers or other setups that don't support the filesystem.

Review

Quoted 7 lines
---
 meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon | 4 ++--
 meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb  | 9 ++++-----
 2 files changed, 6 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon

Review

Quoted 22 lines

index 992267d5a16..4c1ad17c3c6 100644

meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon +2 -2
@@ -3,7 +3,7 @@
 # Provides:          nfs-common
 # Required-Start:    $portmap hwclock
 # Required-Stop:     $portmap hwclock
-# Default-Start:     2 3 4 5
+# Default-Start:     S
 # Default-Stop:      0 1 6
 # Short-Description: NFS support for both client and server
 # Description:       NFS is a popular protocol for file sharing across
@@ -20,7 +20,7 @@
 . /etc/init.d/functions
 
 test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
-test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid
+test -z "$STATD_PID" && STATD_PID=/run/rpc.statd.pid
 #
 # The default state directory is /var/lib/nfs
 test -n "$NFS_STATEDIR" || NFS_STATEDIR=/var/lib/nfs
(quoted diff) +0 -0

b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb do_install:append () { · line 132

Quoted 5 lines

index 2f2644f9a83..527fcd609c1 100644

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +0 -0
@@ -132,15 +132,14 @@ do_install:append () {
      install -m 0644 ${WORKDIR}/nfs-server.service

${D}${systemd_system_unitdir}/

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb do_install:append () { · line 133

Quoted 1 line
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +0 -0
      install -m 0644 ${WORKDIR}/nfs-mountd.service

${D}${systemd_system_unitdir}/

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb do_install:append () { · line 134

Quoted 1 line
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +0 -0
      install -m 0644 ${WORKDIR}/nfs-statd.service

${D}${systemd_system_unitdir}/

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb do_install:append () { · line 135

Quoted 1 line
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +1 -0
+     install -m 0644 ${WORKDIR}/proc-fs-nfsd.mount

${D}${systemd_system_unitdir}/

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb do_install:append () {

Quoted 5 lines
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +0 -1
      sed -i -e 's,@SBINDIR@,${sbindir},g' \
              -e 's,@SYSCONFDIR@,${sysconfdir},g' \
              -e 's,@HIGH_RLIMIT_NOFILE@,${HIGH_RLIMIT_NOFILE},g' \
              ${D}${systemd_system_unitdir}/*.service
-     if

${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb do_install:append () { · line 140

Quoted 1 line
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +0 -1
-             install -m 0644 ${WORKDIR}/proc-fs-nfsd.mount

${D}${systemd_system_unitdir}/

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb do_install:append () { · line 141

Quoted 1 line
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +0 -1
-             install -d

${D}${systemd_system_unitdir}/sysinit.target.wants/

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb do_install:append () { · line 142

Quoted 1 line
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +0 -1
-             ln -sf ../proc-fs-nfsd.mount

${D}${systemd_system_unitdir}/sysinit.target.wants/proc-fs-nfsd.mount

meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb do_install:append () {

Quoted 3 lines
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +2 -1
-     fi
+     # Add compatibility symlinks for the sysvinit scripts
+     ln -s nfs-server.service

${D}${systemd_system_unitdir}/nfsserver.service

Quoted 9 lines
meta/recipes-connectivity/nfs-utils/nfs-utils_2.6.4.bb +1 -1
+     ln -s /dev/null ${D}${systemd_system_unitdir}/nfscommon.service
 
      # kernel code as of 3.8 hard-codes this path as a default
      install -d ${D}/var/lib/nfs/v4recovery
--

2.41.0

Quoted 3 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#197616):

https://lists.openembedded.org/g/openembedded-core/message/197616

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/105209254/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com