From owner-freebsd-stable@freebsd.org Wed Aug 30 12:01:02 2017 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1F19BDF6F7F; Wed, 30 Aug 2017 12:01:02 +0000 (UTC) (envelope-from peixotocassiano@gmail.com) Received: from mail-qt0-x233.google.com (mail-qt0-x233.google.com [IPv6:2607:f8b0:400d:c0d::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC4F869A14; Wed, 30 Aug 2017 12:01:01 +0000 (UTC) (envelope-from peixotocassiano@gmail.com) Received: by mail-qt0-x233.google.com with SMTP id u11so26099780qtu.1; Wed, 30 Aug 2017 05:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=NpPfIuwGyGGWk7ZVbc5A7z+WG8m3+vqmefm1PV98Fss=; b=iQkcV23n1kTEOIgkHYKJ+MoOcutglEO4aj4okmgYtA/YuvoVMATobkd7phEp8qStl5 ZKfJzJGV8qBJvJ6bEkh+bvaB96u8L0Gjo0Z3yfdJyCxPIirPHrqpQmIIcr6YalRNVpEa +TyWq+Ej68rAXztiG0TzC0TfGdgKqk1VVbTIWlBfW+aYtdPj4Fh/WovRTDjcKUCsWpnD dr89hfM6y6/UocAQDrCW50r6AXK8fH80XFIoot4V1Dx5Si7tgKhZpDvxgfE1VYQRbloS dAdaonh/UdLCIfK1cG3R/rJXOOXxRZ3aD4vCBAe62j26D1u4X1pxIaCtS2mLCDTpBxql rTcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=NpPfIuwGyGGWk7ZVbc5A7z+WG8m3+vqmefm1PV98Fss=; b=nUzMrmRACPKyLy3/pg779oFPpJP7f82ICfnabAAy+9olrLdrrJwj6Ml1VzFC5dWUZZ XKa6X08iUykVwisb2Vomq2J2QQIiQbMv7tVXFY/ewpsbDwRxmxUNU6b6cuZ4kWsHCmuB FgZZIkNEj6ExnZtetKOMz9MDvwyi331jD5BaK8eH8M4HnfxFHxqvC51FLacrj5puLfUt ebHVa6HPZeIT+M7blLMcpaxXZwVRtuCPbljsUyTZzBHELzLpF207JDNHOpk5pG9u5pLW VEoJHqb0lycS8x2ppm7DE0DCkj7JmQ0j8FzwV2WwRTPoRtCqlYazl0jbZB5AQnB7uf8o paGA== X-Gm-Message-State: AHYfb5iKp8WUvW+/QSigAb+0l0H14g9gG+ZG2fJfHBSVG8PoKfwBg4PQ S/6PO7Wl50yW/Tg4tgMwPKLi2sHLDW9L X-Received: by 10.200.1.207 with SMTP id b15mr1635684qtg.30.1504094455917; Wed, 30 Aug 2017 05:00:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.38.129 with HTTP; Wed, 30 Aug 2017 05:00:55 -0700 (PDT) In-Reply-To: References: <4c16c960-3b4a-75ab-41ed-51c8109b940a@FreeBSD.org> From: Cassiano Peixoto Date: Wed, 30 Aug 2017 09:00:55 -0300 Message-ID: Subject: Re: pkg issue after FreeBSD 11 upgrade To: Matthew Seaman Cc: "freebsd-ports@freebsd.org" , freebsd-stable@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Aug 2017 12:01:02 -0000 Hi Matthew, Sorry back to this subject. But I really need to restart services with a port. I'm quite sure there is a bug with pkg and FreeBSD 11. I made a simple port to restart cron service: # $FreeBSD$ PORTNAME= ze PORTVERSION= 1.0 CATEGORIES= custom MASTER_SITES= # DISTFILES= # EXTRACT_ONLY= # NONE MAINTAINER= peixotocassiano@gmail.com COMMENT= ze port #NO_MTREE= yes SUB_FILES= pkg-install NO_BUILD= yes NO_WRKSUBDIR= yes do-install: mkdir -p ${STAGEDIR}${DATADIR} @${CP} -r ${FILESDIR}/versions ${STAGEDIR}${DATADIR}/ post-install: ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL .include Here is my pkg-install to restart cron service: #!/bin/sh if [ $2 = "POST-INSTALL" ]; then service cron restart fi Here is the output when I install the port: root@kkk:~ # service cron start cron already running? (pid=2287). root@kkk:~ # pkg install ze Updating Custom repository catalogue... Fetching meta.txz: 100% 560 B 0.6kB/s 00:01 Fetching packagesite.txz: 100% 122 KiB 62.6kB/s 00:02 Processing entries: 100% Custom repository update completed. 427 packages processed. All repositories are up to date. The following 1 package(s) will be affected (of 0 checked): New packages to be INSTALLED: ze: 1.0 Number of packages to be installed: 1 672 B to be downloaded. [1/1] Fetching ze-1.0.txz: 100% 672 B 0.7kB/s 00:01 Checking integrity... done (0 conflicting) [1/1] Installing ze-1.0... + set -- ze-1.0 PRE-INSTALL + [ PRE-INSTALL '=' POST-INSTALL ] Extracting ze-1.0: 100% + set -- ze-1.0 POST-INSTALL + [ POST-INSTALL '=' POST-INSTALL ] + service cron restart Stopping cron. Waiting for PIDS: 2287. Starting cron. root@kkk:~ # ps ax | grep cron 2320 1 S+ 0:00.00 grep cron As you can see the cron has stopped but hasn't started. But If I install the same port with traditional ports approach it works, see: root@kkk: /usr/ports/custom/ze/# ps ax | grep cron 1280 - Is 0:00.97 /usr/sbin/cron -s root@kkk: /usr/ports/custom/ze# make install ===> ze-1.1 depends on file: /usr/local/sbin/pkg - found ===> Fetching all distfiles required by ze-1.1 for building ===> Extracting for ze-1.1 ===> Patching for ze-1.1 ===> Configuring for ze-1.1 ===> Staging for ze-1.1 ===> Generating temporary packing list mkdir -p /usr/ports/custom/ze/work/stage/usr/local/share/ze /bin/sh /usr/ports/custom/ze/work/pkg-install ze-1.1 POST-INSTALL ====> Compressing man pages (compress-man) ===> Installing for ze-1.1 ===> Checking if ze already installed Stopping cron. Waiting for PIDS: 1280. Starting cron. ===> Registering installation for ze-1.1 Installing ze-1.1... root@kkk: /usr/ports/custom/ze# ps ax | grep cron 37527 - Ss 0:00.00 /usr/sbin/cron -s Thanks for your help. On Fri, Aug 11, 2017 at 1:45 PM, Cassiano Peixoto wrote: > Hi Matthew, > > Thanks for your answer. Slapd is just an example, it happens with any > application like apache, mysql, dovecot and others. > > I can see the process is running and up, and it dies after pkg process has > finished. Looks like pkg is killing any application related to its thread. > > I know it's not the best approach, but used to work on FreeBSD 10. > > Anyway, I'll change my script to restart services out of pkg process. > > Thanks. > > On Fri, Aug 11, 2017 at 5:09 AM, Matthew Seaman > wrote: > >> On 10/08/2017 22:05, Cassiano Peixoto wrote: >> > I ran into an issue after FreeBSD 11 upgrade. I have some meta ports >> that >> > starts services like slapd. >> > >> > Its has been working fine on 10-STABLE. But after FreeBSD >> > 11-STABLE r321625M upgrade it stopped working. >> > >> > Here is a simple example of my pkg-install.in script: >> > >> > #!/bin/sh >> > /usr/local/etc/rc.d/slapd stop >> > /usr/local/etc/rc.d/slapd start >> > >> > I can see its executing while upgrading a package: >> > >> > Stopping slapd. >> > Waiting for PIDS: 13875. >> > Starting slapd. >> > >> > But looking if the process is running, it's not: >> > >> > # ps ax | grep slapd >> > 14164 0 S+ 0:00.00 grep slapd >> > >> > Then I manually run the rc.d script and the service starts: >> > >> > # /usr/local/etc/rc.d/slapd restart >> > slapd not running? (check /var/run/openldap/slapd.pid). >> > Starting slapd. >> > >> > So my question is: something has changed on FreeBSD 11 not allowing this >> > kind of execution? >> > >> > BTW, I'm using pkg 1.10.1 and my ports collection is as same as I was >> using >> > on FreeBSD 10. >> >> Restarting daemons after upgrading is something the project has been >> quite resistant to implementing. Mostly because as soon as you start >> looking into it in any depth the true complexity of doing that sort of >> thing reliably for any conceivable system becomes apparent and you end >> up muttering darkly about systemd and losing the will to live. >> >> However, yes, restarting slapd -- it's clear that your script does get >> called, but slapd fails to start at that point during the upgrade >> process. slapd is well known (at least to me) for failing to start >> /silently/ -- you need to check the process is actually there after >> trying to start it, and look at the logfiles and so forth. It also >> seems to quit at the slightest provocation, presumably to avoid any >> potential for data corruption. >> >> So check you logs to see why slapd didn't start. It's quite possible >> that it was simply that something else that slapd needed wasn't >> available at that exact point during the upgrade process, and just >> waiting until the upgrade had finished would sort things out. >> >> Cheers, >> >> Matthew >> >> >