Re: pkg issue after FreeBSD 11 upgrade
Hi Baptiste, Sorry to bother you. Did you have some time to work on this thread? Thanks. On Wed, Aug 30, 2017 at 12:46 PM, Cassiano Peixoto < peixotocassi...@gmail.com> wrote: > Thank you for your support Baptiste, I really appreciate that. > > As same as HANDLE_RC_SCRIPTS option the new one should be handled > carefully. > > Please keep us posted when it's ready. > > > On Wednesday, August 30, 2017, Baptiste Daroussin > wrote: > >> On Wed, Aug 30, 2017 at 10:07:51AM -0300, Cassiano Peixoto wrote: >> > Ok I know about HANDLE_RC_SCRIPTS, it's a good approach. But how to deal >> > with when I need to restart a service without upgrading? Reaper >> > functionnality is a trouble for many administrators who made meta ports >> to >> > manage their servers. I really think it could be a option to be >> > enabled/disabled. Can you see this possibility? >> > >> >> Yes I could add an option to disable the reaper functionnality (and will >> probably to unblock such use case as soon as I have time to do it.) >> >> However I still think this is not the right idea :) and a better one >> could be >> found >> >> Bapt >> > ___ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: pkg issue after FreeBSD 11 upgrade
Thank you for your support Baptiste, I really appreciate that. As same as HANDLE_RC_SCRIPTS option the new one should be handled carefully. Please keep us posted when it's ready. On Wednesday, August 30, 2017, Baptiste Daroussin wrote: > On Wed, Aug 30, 2017 at 10:07:51AM -0300, Cassiano Peixoto wrote: > > Ok I know about HANDLE_RC_SCRIPTS, it's a good approach. But how to deal > > with when I need to restart a service without upgrading? Reaper > > functionnality is a trouble for many administrators who made meta ports > to > > manage their servers. I really think it could be a option to be > > enabled/disabled. Can you see this possibility? > > > > Yes I could add an option to disable the reaper functionnality (and will > probably to unblock such use case as soon as I have time to do it.) > > However I still think this is not the right idea :) and a better one could > be > found > > Bapt > ___ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: pkg issue after FreeBSD 11 upgrade
On Wed, Aug 30, 2017 at 10:07:51AM -0300, Cassiano Peixoto wrote: > Ok I know about HANDLE_RC_SCRIPTS, it's a good approach. But how to deal > with when I need to restart a service without upgrading? Reaper > functionnality is a trouble for many administrators who made meta ports to > manage their servers. I really think it could be a option to be > enabled/disabled. Can you see this possibility? > Yes I could add an option to disable the reaper functionnality (and will probably to unblock such use case as soon as I have time to do it.) However I still think this is not the right idea :) and a better one could be found Bapt signature.asc Description: PGP signature
Re: pkg issue after FreeBSD 11 upgrade
Cassiano Peixoto wrote: Ok I know about HANDLE_RC_SCRIPTS, it's a good approach. But how to deal with when I need to restart a service without upgrading? Reaper functionnality is a trouble for many administrators who made meta ports to manage their servers. I really think it could be a option to be enabled/disabled. Can you see this possibility? Thanks. On Wed, Aug 30, 2017 at 9:59 AM, Baptiste Daroussin wrote: On Wed, Aug 30, 2017 at 09:55:22AM -0300, Cassiano Peixoto wrote: Hi Baptiste, Why it used to work on FreeBSD 10? It stopped worked on FreeBSD 11 only. It only worked on FreeBSD 10 prior to 10.2, the reaper functionnality in freebsd kernel appeared in 10.2 Cron is just an example, I manage more than 50 FreeBSD servers, and I've been using ports for years to update some configs and restart the service on all of them. Many times I need to change nginx config, ldap, etc. I just need to restart the service. HANDLE_RC_SCRIPTS=true in your pkg.conf and pkg will automatically restart anything rc script provide once the package containing it is upgrading. This is off by default because in many cases it is dangerous (database upgrades, dovecot like things upgrade etc). But if you know what you are doing it does the job. Best regards, Bapt Hey, I think you also want process supervision given your other comments. You can do this easily using daemon -P to run your scripts (but you'd need to rewrite the rc script...) Or use runit or similar? You could implement "runlevels" with that if that's REALLY what you want :) Cheers, Chris -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: pkg issue after FreeBSD 11 upgrade
Hi Baptiste, > On 30. Aug 2017, at 3:05 PM, Baptiste Daroussin wrote: > >> No. At OPNsense we use a patch to revert the behaviour. >> >> https://github.com/opnsense/ports/blob/master/ports-mgmt/pkg/files/patch-libpkg_scripts.c > > Why and what is your use case, there is a reason why this code has been added, > and I would like to hear more about use cases so we can try to address them. There's to things in this patch. (1) The hard fail for scripts leaves a GUI-driven environment without its package, so post-install fails become fatal and appliances are completely stranded, possibly left without means of recovery. This is where FreeBSD base and the "appliance" GUI packages are completely separated. This is somewhat mitigated by marking said GUI package vital, but vital won't help if the package was deinstalled during an upgrade and then the upgrade script itself fails. Every now and then, I see "user disappeared" during package installs on stock FreeBSD systems so the install fails. I am guessing that's the same issue. (2) The reaper kills a package-based watchdog / backend service. Maybe HANDLE_RC_SCRIPTS can cope with this, but it would be beneficial to be able to enable this per package / rc service / metadata as generally the reaper is a fine and sane addition. Cheers, Franco ___ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: pkg issue after FreeBSD 11 upgrade
Hi Franco, Thank you. You know what I'm suffering. As I said in my last email I think it would be an option to enable/disable. I just upgraded my customers servers to FreeBSD 11 and I just realized it. I think when more admins who maintain this kind of port (needing to restart services), as soon as they migrate they will face the same problem. On Wed, Aug 30, 2017 at 10:01 AM, Franco Fichtner wrote: > Hi Cassiano, > > > On 30. Aug 2017, at 2:55 PM, Cassiano Peixoto > wrote: > > > > Why it used to work on FreeBSD 10? It stopped worked on FreeBSD 11 only. > > It was a later 10.x change as far as I know. > > > Is there some flag to disable it? Or some hack that I could do? > > No. At OPNsense we use a patch to revert the behaviour. > > https://github.com/opnsense/ports/blob/master/ports-mgmt/ > pkg/files/patch-libpkg_scripts.c > > > Cheers, > Franco ___ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: pkg issue after FreeBSD 11 upgrade
Ok I know about HANDLE_RC_SCRIPTS, it's a good approach. But how to deal with when I need to restart a service without upgrading? Reaper functionnality is a trouble for many administrators who made meta ports to manage their servers. I really think it could be a option to be enabled/disabled. Can you see this possibility? Thanks. On Wed, Aug 30, 2017 at 9:59 AM, Baptiste Daroussin wrote: > On Wed, Aug 30, 2017 at 09:55:22AM -0300, Cassiano Peixoto wrote: > > Hi Baptiste, > > > > Why it used to work on FreeBSD 10? It stopped worked on FreeBSD 11 only. > > It only worked on FreeBSD 10 prior to 10.2, the reaper functionnality in > freebsd > kernel appeared in 10.2 > > > > Cron is just an example, I manage more than 50 FreeBSD servers, and I've > > been using ports for years to update some configs and restart the service > > on all of them. Many times I need to change nginx config, ldap, etc. I > just > > need to restart the service. > > HANDLE_RC_SCRIPTS=true in your pkg.conf and pkg will automatically restart > anything rc script provide once the package containing it is upgrading. > > This is off by default because in many cases it is dangerous (database > upgrades, > dovecot like things upgrade etc). But if you know what you are doing it > does the > job. > > Best regards, > Bapt > ___ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: pkg issue after FreeBSD 11 upgrade
On Wed, Aug 30, 2017 at 03:01:30PM +0200, Franco Fichtner wrote: > Hi Cassiano, > > > On 30. Aug 2017, at 2:55 PM, Cassiano Peixoto > > wrote: > > > > Why it used to work on FreeBSD 10? It stopped worked on FreeBSD 11 only. > > It was a later 10.x change as far as I know. > > > Is there some flag to disable it? Or some hack that I could do? > > No. At OPNsense we use a patch to revert the behaviour. > > https://github.com/opnsense/ports/blob/master/ports-mgmt/pkg/files/patch-libpkg_scripts.c Why and what is your use case, there is a reason why this code has been added, and I would like to hear more about use cases so we can try to address them. Best regards, Bapt signature.asc Description: PGP signature
Re: pkg issue after FreeBSD 11 upgrade
Hi Cassiano, > On 30. Aug 2017, at 2:55 PM, Cassiano Peixoto > wrote: > > Why it used to work on FreeBSD 10? It stopped worked on FreeBSD 11 only. It was a later 10.x change as far as I know. > Is there some flag to disable it? Or some hack that I could do? No. At OPNsense we use a patch to revert the behaviour. https://github.com/opnsense/ports/blob/master/ports-mgmt/pkg/files/patch-libpkg_scripts.c Cheers, Franco ___ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: pkg issue after FreeBSD 11 upgrade
On Wed, Aug 30, 2017 at 09:55:22AM -0300, Cassiano Peixoto wrote: > Hi Baptiste, > > Why it used to work on FreeBSD 10? It stopped worked on FreeBSD 11 only. It only worked on FreeBSD 10 prior to 10.2, the reaper functionnality in freebsd kernel appeared in 10.2 > > Cron is just an example, I manage more than 50 FreeBSD servers, and I've > been using ports for years to update some configs and restart the service > on all of them. Many times I need to change nginx config, ldap, etc. I just > need to restart the service. HANDLE_RC_SCRIPTS=true in your pkg.conf and pkg will automatically restart anything rc script provide once the package containing it is upgrading. This is off by default because in many cases it is dangerous (database upgrades, dovecot like things upgrade etc). But if you know what you are doing it does the job. Best regards, Bapt signature.asc Description: PGP signature
Re: pkg issue after FreeBSD 11 upgrade
Hi Baptiste, Why it used to work on FreeBSD 10? It stopped worked on FreeBSD 11 only. Cron is just an example, I manage more than 50 FreeBSD servers, and I've been using ports for years to update some configs and restart the service on all of them. Many times I need to change nginx config, ldap, etc. I just need to restart the service. Is there some flag to disable it? Or some hack that I could do? Thanks. On Wed, Aug 30, 2017 at 9:48 AM, Baptiste Daroussin wrote: > On Wed, Aug 30, 2017 at 09:00:55AM -0300, Cassiano Peixoto wrote: > > 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: > > It is not a bug, it is by design, pkg becomes the reaper of the scripts it > runs > and kills everything once the script is executed. > > btw if you install crontab in cron.d you do not need to restart the > service, > cron will figure out itself and reload what it needed. > > Bapt > ___ freebsd-stable@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: pkg issue after FreeBSD 11 upgrade
On Wed, Aug 30, 2017 at 09:00:55AM -0300, Cassiano Peixoto wrote: > 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: It is not a bug, it is by design, pkg becomes the reaper of the scripts it runs and kills everything once the script is executed. btw if you install crontab in cron.d you do not need to restart the service, cron will figure out itself and reload what it needed. Bapt signature.asc Description: PGP signature
Re: pkg issue after FreeBSD 11 upgrade
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= peixotocassi...@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/s00:01 Fetching packagesite.txz: 100% 122 KiB 62.6kB/s00: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/s00: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 fai