Package: init-system-helpers
Version: 1.65.2
Severity: normal
Tags: patch

Dear Luca,

I would be grateful if you could apply the attached patch for /usr/sbin/service
so that it works correctly with native openrc-run scripts. For such scripts,
manually setting the internal openrc symlinks actually prevents the script from
running as openrc-run then detects the script as having already been started.

I appreciate that this is not an area of Debian that directly interests you. I
would be happy to do an NMU and push the commit to salsa, if you would
prefer. Just let me know.

Thanks

Mark

-- System Information:
Debian Release: 12.7
merged-usr: yes
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-22-amd64 (SMP w/2 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /bin/dash
Init: OpenRC (via /run/openrc), PID 1: init

Versions of packages init-system-helpers is related to:
ii  insserv  1.24.0-1

-- no debconf information
>From 09d16e51a3de83d4a1f1c4fdd6285ca94db816ad Mon Sep 17 00:00:00 2001
From: Mark Hindley <[email protected]>
Date: Sun, 15 Sep 2024 15:35:31 +0100
Subject: [PATCH] Don't manually set status symlinks for native openrc-run
 scripts.

For native openrc-run scripts, fiddling with the links before the script is run
actually prevents it from running as openrc-run detects the status has been
changed and considers the script as already started.

Fixes:-

> grep '^#! */\(usr/\)\?sbin/openrc-run' /etc/init.d/fstrim
  #!/sbin/openrc-run
> sudo service fstrim status
 * status: stopped
> sudo service fstrim start
 * WARNING: fstrim has already been started
---
 script/service | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/script/service b/script/service
index 08f69bb..44f565c 100755
--- a/script/service
+++ b/script/service
@@ -140,6 +140,8 @@ run_via_sysvinit() {
 }
 
 update_openrc_started_symlinks() {
+   # Skip native openrc-run files
+   grep -q '^#! */\(usr/\)\?sbin/openrc-run' $SERVICEDIR/$SERVICE && return
    # maintain the symlinks of /run/openrc/started so that
    # rc-status works with the service command as well
    if [ -d /run/openrc/started ] ; then
-- 
2.39.5

Reply via email to