Bug 241234 - sysutils/nut upgrade fails when /usr/local/etc/syslog.d/nut does not exist
Summary: sysutils/nut upgrade fails when /usr/local/etc/syslog.d/nut does not exist
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Cy Schubert
URL:
Keywords:
: 249062 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-10-13 19:34 UTC by ddrinnon
Modified: 2020-09-25 18:43 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (cy)


Attachments
Try this patch in you poudriere (1.36 KB, patch)
2020-09-17 01:18 UTC, Cy Schubert
no flags Details | Diff
my patched Makefile (5.48 KB, text/plain)
2020-09-17 02:56 UTC, ddrinnon
no flags Details
I used this at home to create /usr/local/etc/syslog.d (2.58 KB, patch)
2020-09-19 19:53 UTC, Dan Langille
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description ddrinnon 2019-10-13 19:34:21 UTC
When upgrading sysutils/nut and /usr/local/etc/syslog.d/nut does not exist, the upgrade fails with:

cp: /usr/local/etc/syslog.d/nut: No such file or directory
pkg: POST-INSTALL script failed

In fact, the upgrade seems okay and nut does start and run okay.
Comment 1 Cy Schubert freebsd_committer 2019-10-13 22:59:25 UTC
Are you building from port or installing the binary package via pkg?
Comment 2 ddrinnon 2019-10-14 00:23:37 UTC
(In reply to Cy Schubert from comment #1)

I am building from the port with Poudriere.

uname -a:
FreeBSD nas01.cdor.net 11.3-RELEASE-p3 FreeBSD 11.3-RELEASE-p3 #0: Mon Aug 19 21:08:43 UTC 2019     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

pkg info nut:
nut-2.7.4_13
Name           : nut
Version        : 2.7.4_13
Installed on   : Sun Oct 13 12:49:11 2019 MST
Origin         : sysutils/nut
Architecture   : FreeBSD:11:amd64
Prefix         : /usr/local
Categories     : sysutils
Licenses       :
Maintainer     : cy@FreeBSD.org
WWW            : http://www.networkupstools.org/
Comment        : Network UPS Tools
Options        :
        AVAHI          : off
        BASH           : off
        CGI            : on
        DOCS           : on
        FREEIPMI       : off
        IPMIPSU        : off
        IPMI_OFF       : on
        NEON           : on
        NSS            : off
        OPENSSL        : off
        PDU            : off
        SERIAL         : on
        SNMP           : on
        SSL_OFF        : on
        USB            : on
Shared Libs required:
        libgd.so.6
        libpkg.so.4
        libneon.so.27
        libnetsnmp.so.30
Shared Libs provided:
        libnutclient.so.0
        libupsclient.so.4
Annotations    :
        FreeBSD_version: 1103000
        repo_type      : binary
        repository     : head
Flat size      : 6.36MiB
Description    :
This is a developing project to monitor a large assortment of UPS hardware.
Network communications are used so that multiple systems can monitor a
single physical UPS and shut down together if necessary without any
special "sharing hardware" on the UPS itself. CGI scripts are provided
to monitor UPS status via a WEB browser.

WWW: http://www.networkupstools.org/
Comment 3 Dan Langille freebsd_committer 2020-09-03 22:20:56 UTC
*** Bug 249062 has been marked as a duplicate of this bug. ***
Comment 4 Cy Schubert freebsd_committer 2020-09-17 01:18:05 UTC
Created attachment 218014 [details]
Try this patch in you poudriere

Give this patch a spin, please.
Comment 5 ddrinnon 2020-09-17 02:54:55 UTC
Cy - I tried the patch and it didn't work - the /usr/local/etc/syslog.d directory did not get created.  I will attach my patched sysutils/nut/Makefile and below is the output of the pkg upgrade on my nut server:

[root@aux01 /usr/local/etc]# pkg upgrade
Updating head repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01
Fetching packagesite.txz: 100%  384 KiB 393.3kB/s    00:01
Processing entries: 100%
head repository update completed. 1558 packages processed.
All repositories are up to date.
Checking for upgrades (2 candidates): 100%
Processing candidates (2 candidates): 100%
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
        nut: 2.7.4_14 -> 2.7.4_15

Number of packages to be upgraded: 1

1 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching nut-2.7.4_15.txz: 100%    1 MiB   1.2MB/s    00:01
Checking integrity... done (0 conflicting)
[1/1] Upgrading nut from 2.7.4_14 to 2.7.4_15...
[1/1] Extracting nut-2.7.4_15: 100%
You may need to manually remove /usr/local/etc/nut/nut.conf if it is no longer needed.
You may need to manually remove /usr/local/etc/nut/ups.conf if it is no longer needed.
You may need to manually remove /usr/local/etc/nut/upsd.conf if it is no longer needed.
You may need to manually remove /usr/local/etc/nut/upsd.users if it is no longer needed.
You may need to manually remove /usr/local/etc/nut/upsmon.conf if it is no longer needed.
cp: /usr/local/etc/syslog.d/nut: No such file or directory
pkg: POST-INSTALL script failed
[root@aux01 /usr/local/etc]# ls syslog.d
ls: syslog.d: No such file or directory
[root@aux01 /usr/local/etc]#
Comment 6 ddrinnon 2020-09-17 02:56:08 UTC
Created attachment 218015 [details]
my patched Makefile

I copied the patch to sysutils/nut/patch.txt and ran patch <patch.txt
Comment 7 Dan Langille freebsd_committer 2020-09-19 19:53:52 UTC
Created attachment 218088 [details]
I used this at home to create /usr/local/etc/syslog.d

How about this patch? I'm using it at home, and it goes beyond what you need by also fixing file permissions, but it does create the directory.
Comment 8 ddrinnon 2020-09-23 20:30:34 UTC
Dan Langille's patch worked for me - it created /usr/local/etc/syslog.d/nut without any errors.
Comment 9 Dan Langille freebsd_committer 2020-09-23 20:37:52 UTC
That may be because of pkg-plist
Comment 10 Cy Schubert freebsd_committer 2020-09-23 21:01:36 UTC
(In reply to Dan Langille from comment #7)
Looks good.

Can you commit it for me, please.
Comment 11 Cy Schubert freebsd_committer 2020-09-24 00:01:31 UTC
nevermind, this needs to be fixed in nut-devel too.
Comment 12 Cy Schubert freebsd_committer 2020-09-24 00:10:58 UTC
Committed to git tree. Will push later tonight.
Comment 13 commit-hook freebsd_committer 2020-09-24 00:55:14 UTC
A commit references this bug:

Author: cy
Date: Thu Sep 24 00:54:59 UTC 2020
New revision: 549866
URL: https://svnweb.freebsd.org/changeset/ports/549866

Log:
  Create syslog.d subdir if it doesn't exist, allowing install/upgrade
  to complete.

  PR:		241234
  Submitted by:	dvl
  Reported by:	dvl, ddrinnon@cdor.net

Changes:
  head/sysutils/nut/Makefile
  head/sysutils/nut/pkg-plist
  head/sysutils/nut-devel/Makefile
  head/sysutils/nut-devel/pkg-plist
Comment 14 commit-hook freebsd_committer 2020-09-24 00:55:16 UTC
A commit references this bug:

Author: cy
Date: Thu Sep 24 00:55:03 UTC 2020
New revision: 549867
URL: https://svnweb.freebsd.org/changeset/ports/549867

Log:
  Fix permissions.

  PR:		241234
  Submitted by:	dvl

Changes:
  head/sysutils/nut/Makefile
  head/sysutils/nut/pkg-plist
  head/sysutils/nut-devel/Makefile
  head/sysutils/nut-devel/pkg-plist
Comment 15 ddrinnon 2020-09-24 01:43:42 UTC
Thank you for fixing this!  It's been bugging me for a while :)
Comment 16 AlexG 2020-09-25 17:22:09 UTC
It's seems to be broken.
HTTPD error log says:
[Fri Sep 25 11:27:23.117124 2020] [cgi:error] [pid 72959] [client 10.x.x.x:61405] AH01215: upsstats: Can't open /usr/local/etc/nut/upsstats.html: Permission denied: /usr/local/www/apache24/cgi-bin/nut/upsstats.cgi, referer: http://10.x.x.y/nut/header.html
Copy&Past from sample file doesn't help.
Comment 17 Cy Schubert freebsd_committer 2020-09-25 18:26:47 UTC
This is not the same problem. Open a new PR.
Comment 18 AlexG 2020-09-25 18:43:46 UTC
(In reply to Cy Schubert from comment #17)
done
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=249893