DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 541CTnsH2570026 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 541CTnsH2570026 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=B2WKC++Q X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AC0573857C67 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1746102587; bh=u9IjmFf66tTeccryikyqS9T1F/Y2r+pv2ZQt3Hkmka0=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=B2WKC++QgR1DoWcoELn1ep/AOhbolmWhch+V3rXaN04AaxV2k8uuHhAaCW2AMfLJx s2IpPvTXssk/k6vQLwCVphwQLHxSSpizOrYW+qcueBk4sXiuNPnC9MUw7mlpxgmaGt naIBJ6s9rh7cHeFA2s3jVewM/p7vsRMmLcFFdQto= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 429E3385842D ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 429E3385842D ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746102557; cv=none; b=DTmItqvv2sTKRpoP1CCDMu+N/z7XMvYURcj0HeDFvdwSRGVid7eGmizVOb5lSeru3jtzwkOPB9IJ+lQ1ntDanhIN4dQEWfc3UoqpmOv9Zxfmf6nKgCSZDvLPME+VrWdy52TOk6d2PcdW70dma66JEJPL5gbe4MPtrZ0jLTCEVs0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1746102557; c=relaxed/simple; bh=Ai/TBA7n//fXkGUJ68gu4hcU+htNdBtRFi4QFtsZE+M=; h=Message-ID:Date:MIME-Version:From:Subject:To:DKIM-Signature; b=rqVf2T5fSdTes5z9xOtrXY2cA5Emp3gf4FcSll1mL5ZPp4ZHResQYTOjX//+gJqlDpzy2CxCrYGLlZCZmQXkOgznGEeGVJJ1DFgShFGpAAMqn4t16hFmhAOnBzkdQTL+z06Exc9DyhBMrCaaTjD936OJttzC7nUtsknC6PGcf34= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 429E3385842D Message-ID: <24fc2fd6-f898-43b8-992f-2194d3544010@SystematicSW.ab.ca> Date: Thu, 1 May 2025 06:29:13 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug with cygserver-config not working anymore Content-Language: en-CA To: cygwin AT cygwin DOT com References: <861a1fac721ae16816bcfaf275494a3b6b3321bf DOT camel AT USherbrooke DOT ca> Organization: Systematic Software In-Reply-To: <861a1fac721ae16816bcfaf275494a3b6b3321bf.camel@USherbrooke.ca> X-Rspamd-Server: rspamout08 X-Rspamd-Queue-Id: 1FE4430 X-Stat-Signature: ghk8atzw6n4t6p5ywhpx89agc3c77trt X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361 X-Session-ID: U2FsdGVkX18BpSOiKIkRCthVrbiR10oVbRQyZd1LVz4= X-HE-Tag: 1746102555-895918 X-HE-Meta: U2FsdGVkX19Seq0VCSLbkvYgzdXnCmz1gqdoRq6ia1RzmhNFm3OvzKexoU1UbIn3F5wRNMXrWUWpzlYSBDMxnK//SZfAkw8gYt/CUz7IEYFlua4CHd9BllVVLfF0Hed/s84Ul3XZwezEBOIxv7nZR+bQEfSatSoasp6DJRdw7utr4Jyb2IEeM2ugDikMUE322pX+iIcwbM7k8WB0EkFcETE0rEFQF4jpasNCBYvkqBgvBGLJWKWPTb1uRNVY0F4YhWXbjpuWQT1iwRQ0XsGIBUqPYtWdPRA1h/cuQivTpY7dOYoXlS2k7Rm/v+3GMRBl0uV6/Sd5PkPwQ81XvcUGw5DBI6nM7CFv X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Brian Inglis via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Brian Inglis , Christian Lupien Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 541CTnsH2570026 On 2025-04-30 15:30, Christian Lupien via Cygwin wrote: > On a recent system install, I tried to install cygserver by executing > cygserver-config > but it failed saying that cygserver was already running. > > I have done that same install for many years with success. > > I tracked down the problem to the service discovery line inside the > script (line 92) that uses: > ps -ef | grep -v grep | grep -q ${service_name} > but since ps -f was changed in commit (2024-01-31) > 1ce9756ee61e8dff5e3319851e14ebf310a0bdd8 to return the cmdline which it > did not before, this fails because the script finds itself (cygserver- > config is found by grep -q ${service_name}) > > I think the solution would be to remove the -f option to ps. So a patch > would be like: > --- cygserver-config.orig 2025-04-30 17:23:24.461779400 -0400 > +++ cygserver-config 2025-04-30 17:23:47.067576200 -0400 > @@ -89,7 +89,7 @@ > _nt=`expr "${_sys}" : "CYGWIN_NT"` > > # Check for running cygserver processes first. > -if ps -ef | grep -v grep | grep -q ${service_name} > +if ps -e | grep -v grep | grep -q ${service_name} > then > echo > echo "There is a cygserver (${service_name}) already running. Nothing to do, apparently." Could use cygrunsrv -L | grep, or cygrunsrv -Q cygserver (preferred); or ps -es (aka --summary) instead of -ef; or grep -q `which cygserver` and also skip grep -v; or both; or have cygserver (or cygrunsrv after fork, delay, check) create/rm a standard pid file /var/run/cygserver.pid like a good little daemon should, crond, inetd, and sshd do, and syslogd/-ng can; maybe adding -P, --pidfile override like inetd. Daemon configs do: /bin/cron-config: cygrunsrv -Q cron > /dev/null 2>&1 /bin/cron-config: echo "Cron is already installed as a service under account ${cronusername}." -- /bin/cron-config: if ps -es | grep -Fqi '/usr/sbin/cron'; then /bin/cron-config: echo "INFO: A cron daemon is already running." /bin/cygserver-config:if ps -ef | grep -v grep | grep -q ${service_name} /bin/cygserver-config-then /bin/cygserver-config- echo /bin/cygserver-config: echo "There is a cygserver (${service_name}) already running. Nothing to do, apparently." / -- /bin/cygserver-config: # But only if it is not already installed /bin/cygserver-config: if ! cygrunsrv -Q ${service_name} > /dev/null 2>&1 /bin/iu-config: if ! cygrunsrv -Q inetd >/dev/null 2>&1 -- /bin/iu-config: # now, if successfully installed, set ownership of the affected files /bin/iu-config: if cygrunsrv -Q inetd >/dev/null 2>&1 /bin/ssh-host-config: if /usr/bin/cygrunsrv -Q ${service_name} >/dev/null 2>&1 /bin/ssh-host-config- then /bin/ssh-host-config: csih_inform "Sshd service is already installed." -- /bin/ssh-host-config: if /usr/bin/cygrunsrv -Q ${service_name} >/dev/null 2>&1 -- /bin/ssh-host-config:if /usr/bin/ps -ef | /usr/bin/grep -q '/sshd\?$' /bin/ssh-host-config-then /bin/ssh-host-config- echo /bin/ssh-host-config: csih_error "There are still ssh processes running. Please shut them down first." /bin/syslog-ng-config:# Check if syslogd is installed and remove on user request. /bin/syslog-ng-config:if cygrunsrv -Q syslogd > /dev/null 2>&1 /bin/syslog-ng-config-then /bin/syslog-ng-config: echo "Warning: The syslogd service is already installed. You can not" -- /bin/syslog-ng-config:# Install syslog-ng service if it is not already installed /bin/syslog-ng-config:if ! cygrunsrv -Q syslog-ng > /dev/null 2>&1 Usage and man page of ps need synced to add -hVW to usage and update -f: $ diff <(ps -h) <(man ps) # edited -Usage: ps [-aefls] [-u UID] [-p PID] - -f, --full show process uids, ppids and command line + ps [-aeflsW] [-u UID] [-p PID] + ps -h | -V + -f, --full show process uids, ppids -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retrancher but when there is no more to cut -- Antoine de Saint-Exupéry -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple