Bug 278507

Summary: net/gmid: starts too early during boot, before its root documents folder has been mounted (before mountlate)
Product: Ports & Packages Reporter: cmh <freebsd>
Component: Individual Port(s)Assignee: freebsd-ports-bugs (Nobody) <ports-bugs>
Status: Closed FIXED    
Severity: Affects Some People CC: diizzy, freebsd
Priority: --- Flags: freebsd: maintainer-feedback+
Version: Latest   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
Patch to add LOGIN to rcorder require line in rc.d/gmid none

Description cmh 2024-04-21 12:30:49 UTC
Created attachment 250134 [details]
Patch to add LOGIN to rcorder require line in rc.d/gmid

/usr/local/etc/rc.d/gmid is running too early--before the system has fully mounted all of its filesystems, in particular those with the 'late' flag in /etc/fstab.

Users wishing to chroot the gmid daemon as recommended, but who are on zfs, may establish a nullfs mount for gmid that has the 'late' flag set. For example, to mount a read-only copy of the gmid document root within the chroot area at boot. If rc.d/gmid is run before this mount is established gmid will not find its document root and will not launch.

The attached patch file resolves this issue by adding LOGIN to the require line in the rc.d/gmid script. As /sbin/rcorder ensures that rc.d/mountlate is run before LOGIN, all filesystem mounts will be ready for use before launching gmid. This is the same approach taken, for example, by www/apache24 and databases/mysql80-server.
Comment 1 Omar Polo 2024-04-22 13:31:01 UTC
Hello,

I am by no means a rc(8) expert, but the change looks fine to me.  I think I've ripped-off nginx' rc script, but now I see that it has the LOGIN require too.  If I've omitted, it wasn't intentional!

Thanks!
Comment 2 commit-hook freebsd_committer freebsd_triage 2024-06-06 19:08:44 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=500283b4416f14fb650115f8bdaac2a81cbaeca3

commit 500283b4416f14fb650115f8bdaac2a81cbaeca3
Author:     cmh <freebsd@juicer.orange-carb.org>
AuthorDate: 2024-06-06 16:06:45 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2024-06-06 19:05:49 +0000

    net/gmid: Adjust rc.d script

    Add LOGIN to REQUIRE to avoid race conditions

    PR:             278507

 net/gmid/files/gmid.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 3 Daniel Engberg freebsd_committer freebsd_triage 2024-06-06 19:23:40 UTC
Committed, thanks!