Date: Sat, 12 Oct 2024 10:37:16 +0200 (CEST) From: Ronald Klop <ronald-lists@klop.ws> To: Matthias Fechner <idefix@fechner.net> Cc: ports@freebsd.org Subject: Re: Cannot start service, initgroups(gotify,365): Operation not permitted Message-ID: <503778064.11874.1728722236313@localhost> In-Reply-To: <5f24c902-919c-453d-8a59-d674138fd11c@fechner.net> References: <5f24c902-919c-453d-8a59-d674138fd11c@fechner.net>
next in thread | previous in thread | raw e-mail | index | archive | help
------=_Part_11873_199532095.1728722236279 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable If you run the script with sh -x you will get output of what it is doing. T= his can help identifying which part of the script fails. sh -x /usr/local/etc/rc.d/gotify_server start Are your sure you ran 'service gotify_server start' as root? The man pages say that iinitgroups can only return EPERM via a call to setg= roups when not run as root. Regards, Ronald =20 Van: Matthias Fechner <idefix@fechner.net> Datum: zaterdag, 12 oktober 2024 10:02 Aan: ports@freebsd.org Onderwerp: Cannot start service, initgroups(gotify,365): Operation not perm= itted >=20 > Dear all, >=20 > I currently try to create a port for gotify. > The port itself is more or less complete, but I have problem with the ini= t script: > #!/bin/sh > # PROVIDE: gotify_server > # REQUIRE: DAEMON NETWORKING > # KEYWORD: shutdown >=20 > # > # Add these lines to /etc/rc.conf.local or /etc/rc.conf > # to enable this service: > # > # gotify_server_enable (bool): Set to NO by default. > # Set it to YES to enable mailpit. > # gotify_server_dir (str): Set to "/var/db/gotify" by default > # Set it to directory to run gotify i= n > # gotify_server_user (str): Set to "gotify" by default. > # Set it to user to run gotify-server= under > # gotify_server_group (str): Set to "gotify" by default. > # Set it to group to run gotify-serve= r under > # gotify_server_args (string): Custom extra arguments for gotify-s= erver >=20 > . /etc/rc.subr >=20 > name=3D"gotify_server" > rcvar=3D"gotify_server_enable" > desc=3D"Run Gotify notification server" >=20 > load_rc_config ${name} >=20 > : ${gotify_server_enable:=3D"NO"} > : ${gotify_server_dir:=3D"/var/db/gotify"} > : ${gotify_server_user:=3D"gotify"} > : ${gotify_server_group:=3D"gotify"} > : ${gotify_server_args:=3D""} >=20 > export HOME=3D${gotify_server_dir} > export PATH=3D${PATH}:%%PREFIX%%/bin >=20 > pidfile=3D"/var/run/${name}.pid" > command=3D"/usr/sbin/daemon" > command_args=3D"-f -p ${pidfile} -u ${gotify_server_user} %%PREFIX%%/bin/= gotify-server ${gotify_server_args}" >=20 > start_precmd=3D"gotify_server_precmd" >=20 > gotify_server_precmd() > { > if [ ! -e "${pidfile}" ]; then > install -g ${gotify_server_group} -o ${gotify_server_use= r} -- /dev/null "${pidfile}"; > fi > } >=20 > run_rc_command $1 >=20 > If I install the package, enabled it (sysrc gotify_server_enable=3D"YES")= and start it with: > service gotify_server start >=20 > It just returns and I see in /var/log/messages: > Oct 12 09:55:56 gitlab daemon[9157]: initgroups(gotify,365): Operation no= t permitted >=20 > The user is existing: > gotify:*:365:365:Gotify User:/var/db/gotify:/bin/sh >=20 > Group is existing: > gotify:*:365: >=20 > and If I execute the command manually it works: > /usr/sbin/daemon -f -p /var/run/gotify_server.pid -u gotify /usr/local/bi= n/gotify-server >=20 > So it is related to something the init scripts are doing. >=20 > Does maybe anyone have a idea? >=20 > Thanks >=20 > Gru=C3=9F > Matthias >=20 > --=20 >=20 > "Programming today is a race between software engineers striving to > build bigger and better idiot-proof programs, and the universe trying to > produce bigger and better idiots. So far, the universe is winning." -- > Rich Cook >=20 > =20 >=20 >=20 >=20 =20 ------=_Part_11873_199532095.1728722236279 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <html><head></head><body>If you run the script with sh -x you will get outp= ut of what it is doing. This can help identifying which part of the script = fails.<br> <br> sh -x /usr/local/etc/rc.d/gotify_server start<br> <br> Are your sure you ran 'service gotify_server start' as root?<br> The man pages say that iinitgroups can only return EPERM via a call to setg= roups when not run as root.<br> <br> Regards,<br> Ronald<br> <br> <p><strong>Van:</strong> Matthias Fechner <idefix@fechner.net><br> <strong>Datum:</strong> zaterdag, 12 oktober 2024 10:02<br> <strong>Aan:</strong> ports@freebsd.org<br> <strong>Onderwerp:</strong> Cannot start service, initgroups(gotify,365): O= peration not permitted</p> <blockquote style=3D"padding-right: 0px; padding-left: 5px; margin-left: 5p= x; border-left: #000000 2px solid; margin-right: 0px"> <div class=3D"MessageRFC822Viewer" id=3D"P"> <div class=3D"TextPlainViewer" id=3D"P.P">Dear all,<br> <br> I currently try to create a port for gotify.<br> The port itself is more or less complete, but I have problem with the init = script:<br> #!/bin/sh<br> # PROVIDE: gotify_server<br> # REQUIRE: DAEMON NETWORKING<br> # KEYWORD: shutdown<br> <br> #<br> # Add these lines to /etc/rc.conf.local or /etc/rc.conf<br> # to enable this service:<br> #<br> # gotify_server_enable (bool): Se= t to NO by default.<br> # &n= bsp;  = ; Set it = to YES to enable mailpit.<br> # gotify_server_dir (str): &= nbsp; Set to "/var/db/gotify" by default<br> # &n= bsp;  = ; Set it = to directory to run gotify in<br> # gotify_server_user (str): = Set to "gotify" by default.<br> # &n= bsp;  = ; Set it = to user to run gotify-server under<br> # gotify_server_group (str):  = ; Set to "gotify" by default.<br> # &n= bsp;  = ; Set it = to group to run gotify-server under<br> # gotify_server_args (string): Cu= stom extra arguments for gotify-server<br> <br> . /etc/rc.subr<br> <br> name=3D"gotify_server"<br> rcvar=3D"gotify_server_enable"<br> desc=3D"Run Gotify notification server"<br> <br> load_rc_config ${name}<br> <br> : ${gotify_server_enable:=3D"NO"}<br> : ${gotify_server_dir:=3D"/var/db/gotify"}<br> : ${gotify_server_user:=3D"gotify"}<br> : ${gotify_server_group:=3D"gotify"}<br> : ${gotify_server_args:=3D""}<br> <br> export HOME=3D${gotify_server_dir}<br> export PATH=3D${PATH}:%%PREFIX%%/bin<br> <br> pidfile=3D"/var/run/${name}.pid"<br> command=3D"/usr/sbin/daemon"<br> command_args=3D"-f -p ${pidfile} -u ${gotify_server_user} %%PREFIX%%/bin/go= tify-server ${gotify_server_args}"<br> <br> start_precmd=3D"gotify_server_precmd"<br> <br> gotify_server_precmd()<br> {<br> if [ ! -e "${pidfile}" ]; = then<br> &nb= sp; install -g ${gotify_server_group} -o ${gotify_server_= user} -- /dev/null "${pidfile}";<br> fi<br> }<br> <br> run_rc_command $1<br> <br> If I install the package, enabled it (sysrc gotify_server_enable=3D"YES") a= nd start it with:<br> service gotify_server start<br> <br> It just returns and I see in /var/log/messages:<br> Oct 12 09:55:56 gitlab daemon[9157]: initgroups(gotify,365): Operation not = permitted<br> <br> The user is existing:<br> gotify:*:365:365:Gotify User:/var/db/gotify:/bin/sh<br> <br> Group is existing:<br> gotify:*:365:<br> <br> and If I execute the command manually it works:<br> /usr/sbin/daemon -f -p /var/run/gotify_server.pid -u gotify /usr/local/bin/= gotify-server<br> <br> So it is related to something the init scripts are doing.<br> <br> Does maybe anyone have a idea?<br> <br> Thanks<br> <br> Gru=C3=9F<br> Matthias<br> <br> -- <br> <br> "Programming today is a race between software engineers striving to<br> build bigger and better idiot-proof programs, and the universe trying to<br= > produce bigger and better idiots. So far, the universe is winning." --<br> Rich Cook<br> <br> </div> <hr></div> </blockquote> <br> </body></html> ------=_Part_11873_199532095.1728722236279--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?503778064.11874.1728722236313>