[Bug 257586] [service] does not restart [devd] when called from a pkg-install script

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 03 Aug 2021 13:12:50 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257586

            Bug ID: 257586
           Summary: [service] does not restart [devd] when called from a
                    pkg-install script
           Product: Base System
           Version: 12.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: bsdpr@phoe.frmug.org

Note: I'm unsure where to file this bug report, either in base or ports.

On a 12.2-STABLE host (rev 8b9b3d90de5dbeba0f8d68a154c657c0c139e5a9) I
experience troubles when running service(8) to restart devd(8) within a
pkg-install or pkg-deinstall script: devd is stopped but it fails to properly
restart.

My pkg-install script is as shown bellow, the deinstall is almost identical
apart from s/POST-INSTALL/POST-DEINSTALL/:

#!/bin/sh                                                                       
SERVICE=/usr/sbin/service
if [ "$2" = POST-INSTALL ] ; then
    ${SERVICE} devd restart
    ${SERVICE} devd status
fi

When installing I observe that devd does not last long:

# service devd status ; /usr/bin/make install ; echo postmake ; service devd
status
devd is running as pid 13426.
===>  Installing for uartdevconf-1.0
===>  Checking if uartdevconf is already installed
===>   Registering installation for uartdevconf-1.0
Installing uartdevconf-1.0...
Stopping devd.
Waiting for PIDS: 13426.
Starting devd.
devd is running as pid 13514.
postmake
devd is not running.

When starting (or restarting) devd after installation, from outside of the
package installation environment, it lasts:

# service devd status ; /usr/bin/make install ; echo postmake ; service devd
status ; service devd start ; sleep 2 ; service devd status
devd is running as pid 13983.
===>  Installing for uartdevconf-1.0
===>  Checking if uartdevconf is already installed
===>   Registering installation for uartdevconf-1.0
Installing uartdevconf-1.0...
Stopping devd.
Waiting for PIDS: 13983.
Starting devd.
devd is running as pid 14077.
postmake
devd is not running.
Starting devd.
devd is running as pid 14114.

That is a showstopper because this port/package relies on a set of devd rules
for correct operation.

-- 
You are receiving this mail because:
You are the assignee for the bug.