Bug 218159 - ports-mgmt/pkg: pkg -r fails to run post install script.
Summary: ports-mgmt/pkg: pkg -r fails to run post install script.
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-pkg mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-27 08:55 UTC by Josef Karthauser
Modified: 2017-03-30 00:02 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Josef Karthauser 2017-03-27 08:55:13 UTC
The pkg command has a --chroot flag enabling it to chroot to a directory before installing a package.

We are seeing a failure to run a post install script in this context, suggesting that the chroot isn't being used in all contexts:

root@:/usr/home/joe/true-services/ansible-plays # iocage list
JID   UUID                                  BOOT  STATE  TAG                   IP
3     befbcff3-1123-11e7-8380-080027ca2b91  on    up     smtp-relay   192.168.1.30
5     beffa259-1123-11e7-8380-080027ca2b91  on    up     influxdb   192.168.1.30
4     bf04a45c-1123-11e7-8380-080027ca2b91  on    up     smtp-relay2   192.168.1.31
root@:/usr/home/joe/true-services/ansible-plays # pkg -r /iocage/jails/beffa259-1123-11e7-8380-080027ca2b91/root/ install influxdb
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01    
Fetching packagesite.txz: 100%    6 MiB   5.9MB/s    00:01    
Processing entries: 100%
FreeBSD repository update completed. 25859 packages processed.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	influxdb: 1.1.0

Number of packages to be installed: 1

The process will require 40 MiB more space.
8 MiB to be downloaded.

Proceed with this action? [y/N]: y
Fetching influxdb-1.1.0.txz: 100%    8 MiB   8.8MB/s    00:01    
Checking integrity... done (0 conflicting)
[1/1] Installing influxdb-1.1.0...
===> Creating groups.
Creating group 'influxd' with gid '907'.
===> Creating users
Creating user 'influxd' with uid '907'.
[1/1] Extracting influxdb-1.1.0: 100%
cp: /usr/local/etc/influxd.conf.sample: No such file or directory
pkg: POST-INSTALL script failed
root@:/usr/home/joe/true-services/ansible-plays #
Comment 1 Baptiste Daroussin freebsd_committer 2017-03-28 14:17:25 UTC
you state --chroot but actually use -r which is not a chroot but a rootdir.

btw do you know there is -j ?
Comment 2 Josef Karthauser 2017-03-28 21:02:59 UTC
Sorry - you are right I wrongly reported it was a chroot option problem. Mea culpa. I was trying lots of things and it was late when I raise the bug.

However, the install still fails with rootdir which is what I was reporting (although I thought it was a chroot issue):

   [1/1] Extracting influxdb-1.1.0: 100%
   cp: /usr/local/etc/influxd.conf.sample: No such file or directory
   pkg: POST-INSTALL script failed

It looks like the POST-INSTALL script isn't being run in the context of the rootdir, which looks like an issue to me.

(p.s. the reason I can't run -j is that the jail doesn't have network connectivity to the outside world - it's a vimage jail. Similarly running chromed doesn't work because it switches to using the resolv.conf within the chromed environment which isn't configured for the public network).
Comment 3 lumiwa 2017-03-30 00:02:56 UTC
I have a problem with pkg on FreeBSD 11-RELEASE  too. I am using Synth and I update 745 ports and when start updateing it stopped at:
Installing sndio-1.2.0_2...
===> Creating groups.
Using existing group '_sndio'.
===> Creating users
Creating user '_sndio' with uid '702'.
pw: user '_sndio' disappeared during update
pkg: PRE-INSTALL script failed
Unfortunately, the system upgraded failed.

It happened today March 29th.