diff mbox series

[1/4] nfs-utils: clean up startup

Message ID 20250212191518.1968329-1-danismostlikely@gmail.com
State Accepted, archived
Commit 6110687d199bf390380fe84c330858e3b03f681d
Headers show
Series [1/4] nfs-utils: clean up startup | expand

Commit Message

Dan McGregor Feb. 12, 2025, 7:12 p.m. UTC
From: Daniel McGregor <daniel.mcgregor@vecima.com>

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.

Signed-off-by: Daniel McGregor <daniel.mcgregor@vecima.com>
---
 meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon | 8 ++++----
 meta/recipes-connectivity/nfs-utils/nfs-utils_2.8.2.bb  | 9 ++++-----
 2 files changed, 8 insertions(+), 9 deletions(-)

Comments

Ross Burton Feb. 18, 2025, 3:50 p.m. UTC | #1
On 12 Feb 2025, at 19:12, Dan McGregor via lists.openembedded.org <danismostlikely=gmail.com@lists.openembedded.org> wrote:
> 
> 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.

These just merged, but I found some issues:

On boot with sysv:

Starting NFS common utilities … statd start-stop-daemon: can't execute '/sbin/rpc.statd': No such file or directory

It’s not wrong: the path is /usr/sbin/rpc.statd for me.

Probably a related issue, but at rootfs time:

  - nothing provides nfs-utils-mount needed by nfs-utils-client-2.8.2-r0.core2-64

Indeed nfs-utils-mount is empty, because it has FILES using base_sbindir but the binaries are in sbindir.

I’m wondering if there’s a latent usrmerge issue here.

Ross
diff mbox series

Patch

diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon
index 992267d5a16..4f07324a21f 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfscommon
@@ -1,9 +1,9 @@ 
 #!/bin/sh
 ### BEGIN INIT INFO
 # Provides:          nfs-common
-# Required-Start:    $portmap hwclock
-# Required-Stop:     $portmap hwclock
-# Default-Start:     2 3 4 5
+# Required-Start:    $portmap $time
+# Required-Stop:     $portmap $time
+# 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
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.8.2.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.8.2.bb
index ff02a3aea01..df9c95a71ff 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.8.2.bb
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.8.2.bb
@@ -133,15 +133,14 @@  do_install:append () {
 	install -m 0644 ${UNPACKDIR}/nfs-server.service ${D}${systemd_system_unitdir}/
 	install -m 0644 ${UNPACKDIR}/nfs-mountd.service ${D}${systemd_system_unitdir}/
 	install -m 0644 ${UNPACKDIR}/nfs-statd.service ${D}${systemd_system_unitdir}/
+	install -m 0644 ${UNPACKDIR}/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 ${UNPACKDIR}/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