# pkg can't find package even though I've installed it



## mj_ (Jul 3, 2018)

Trying to wrap my head around this... latest release of FreeBSD 11.2:


```
root@freebsd:~ # pkg search xfce4-goodies
root@freebsd:~ # pkg install xfce4-goodies
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
pkg: No packages available to install matching 'xfce4-goodies' have been found in the repositories
root@freebsd:~ #
```

But:


```
root@freebsd:~ # pkg info | grep xfce4-goodies
xfce4-goodies-4.12_1           Meta-port for software and artwork from the Xfce4 Goodies Project
```


```
root@freebsd:~ # pkg info xfce4-goodies
xfce4-goodies-4.12_1
Name           : xfce4-goodies
Version        : 4.12_1
Installed on   : Fri Jun 29 15:02:38 2018 UTC
Origin         : x11/xfce4-goodies
Architecture   : FreeBSD:11:*
Prefix         : /usr/local
Categories     : x11
Licenses       :
Maintainer     : xfce@FreeBSD.org
WWW            : http://goodies.xfce.org/
Comment        : Meta-port for software and artwork from the Xfce4 Goodies Project
Options        :
    ARCHIVE        : on
    BATTERY        : on
    BSDCPUFREQ     : on
    CALCULATOR     : on
    CLIPMAN        : on
    CPUGRAPH       : on
    DASHBOARD      : on
    DATETIME       : on
    DICTIONARY     : on
    DISKPERF       : on
    EMBED          : on
    EQUAKE         : on
    FSGUARD        : on
    GENERICSLIDER  : off
    GENMON         : on
    GIGOLO         : on
    MAILWATCH      : on
    MEDIATAGS      : on
    MIDORI         : off
    MIXER          : on
    MOUNT          : on
    MPC            : off
    NETLOAD        : on
    NOTES          : on
    PAROLE         : on
    POWERMANAGER   : on
    PRINT          : off
    PULSEAUDIO     : off
    QUICKLAUNCHER  : off
    RISTRETTO      : on
    SCREENSHOOTER  : on
    SMARTBOOKMARK  : on
    SYSTEMLOAD     : on
    TASKMANAGER    : on
    TERMINAL       : on
    THEMES         : on
    TIMEOUT        : on
    TIMER          : on
    VALA           : off
    VCS            : on
    VERVE          : on
    VFS            : off
    VOLUMED        : on
    VOLUMEDPULSE   : off
    WAVELAN        : on
    WEATHER        : on
    WHISKERMENU    : on
    WMDOCK         : off
    XFBURN         : on
    XFMPC          : off
    XKB            : on
Annotations    :
    repo_type      : binary
    repository     : FreeBSD
Flat size      : 0.00B
Description    :
The Xfce Goodies Project includes additional software and artwork that are
related to the Xfce desktop, but not part of the official release.

The Xfce Project itself provides a lightweight desktop environment, which
includes only the core compoments required for a desktop environment, like a
window manager, a file manager, a session manager, a panel and a few utilities.
Additional software packages and plugins to existing software, like the panel
or the file manager, are provided by the Xfce Goodies Project.

This meta-port does not install any software itself - it simply depends on other
ports which are part of the Xfce Goodies Project, and a few additional ports
which are not officially part of Goodies, but highly recommended for an Xfce
desktop environment.

WWW: http://goodies.xfce.org/
```

How is that possible?


----------



## ShelLuser (Jul 3, 2018)

Not all ports last for life. Sometimes ports can get removed for various reasons.

However, that doesn't appear to be the case here:


```
peter@zefiris:/home/peter $ pkg search xfce4-goodies
xfce4-goodies-4.12_1           Meta-port for software and artwork from the Xfce4 Goodies Project
peter@zefiris:/home/peter $ date
Tue Jul  3 07:20:17 CEST 2018
```
Therefor my (first) conclusion can only be that you somehow changed your repository info in an invalid way or that you're using a repository which doesn't contain this software (the latter sounds weird, I agree, but it's theoretically possible).

(edit) What FreeBSD version are you using? Do you even actually run FreeBSD, that could be another explanation?

What does /etc/pkg/FreeBSD.conf tell you?  And did you create any more repository config files (any files in /usr/local/etc/pkg/repos)?


----------



## mj_ (Jul 3, 2018)

I haven't touched the repositories. It's a very fresh installation of FreeBSD coming from the VM image. I've started experimenting with FreeBSD last week Thursday in an attempt to replace some of our company's ancient UNIX servers with something more modern and installed this particular package on Friday. Haven't touched the VM all weekend long, came back Monday morning and the package was "gone".


```
[martin@freebsd ~]$ cat /etc/pkg/FreeBSD.conf
# $FreeBSD: releng/11.2/etc/pkg/FreeBSD.conf 333474 2018-05-10 23:58:33Z gjb $
#
# To disable this repository, instead of modifying or removing this file,
# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
#
#   mkdir -p /usr/local/etc/pkg/repos
#   echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
#

FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}
```

/usr/local/etc/pkg/repos doesn't seem to exist:

```
[martin@freebsd ~]$ ls /usr/local/etc/pkg/repos
ls: /usr/local/etc/pkg/repos: No such file or directory
```

Oddly enough all the other xfce4 packages seem to be available, it's just this one that is missing for some odd reason.
I've also tried cleaning the cache (both clean and clean -a) to no avail.


----------



## SirDice (Jul 3, 2018)

Can you do a `pkg update -f`? I have a feeling your locally cached index is out of sync with the remote repository. This can lead to weird errors where packages can't be found (the index has the package but on the repository itself it's missing).

Looking through the quarterly repository I can see xfce4-goodies appear to be missing. So it shouldn't show up. I don't know why it's missing though, it sometimes happens when it (or a dependency) fails to build.


----------



## mj_ (Jul 3, 2018)

Thanks for the tip. However, it didn't help:

`root@freebsd:~ # pkg clean
Nothing to do.
root@freebsd:~ # pkg clean -a
The following package files will be deleted:
    /var/cache/pkg/e2fsprogs-1.44.2-1f6211f2e2.txz
    /var/cache/pkg/e2fsprogs-libss-1.44.2.txz
    /var/cache/pkg/e2fsprogs-1.44.2.txz
    /var/cache/pkg/e2fsprogs-libuuid-1.44.2-328b5a617f.txz
    /var/cache/pkg/e2fsprogs-libuuid-1.44.2.txz
    /var/cache/pkg/e2fsprogs-libblkid-1.44.2-a80074f542.txz
    /var/cache/pkg/e2fsprogs-libblkid-1.44.2.txz
    /var/cache/pkg/e2fsprogs-libss-1.44.2-99123c6ced.txz
The cleanup will free 1 MiB

Proceed with cleaning the cache? [y/N]: y
Deleting files: 100%
All done
root@freebsd:~ # pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01 
Fetching packagesite.txz: 100%    6 MiB 530.0kB/s    00:12 
Processing entries: 100%
FreeBSD repository update completed. 31048 packages processed.
All repositories are up to date.
root@freebsd:~ # pkg search xfce4-goodies
root@freebsd:~ #`




SirDice said:


> Looking through the quarterly repository I can see xfce4-goodies appear to be missing. So it shouldn't show up. I don't know why it's missing though, it sometimes happens when it (or a dependency) fails to build.


What does that mean exactly? What is that quarterly that you're referring to? I have to admit I'm still very new to FreeBSD. I've been using various UNIX systems as well as a multitude of Linux distros for more than 20+ years but BSD has somehow never been on my radar. However, in my entire professional life I have never had a package disappear from a Linux repository over night. Do packages simply "disappear" from the BSD repository even though they were still present the day before? If so that would be a disaster to be honest - how am I supposed to maintain a consistent base and deploy new systems if all of a sudden random packages go missing? It surely can't be by design, can it?


----------



## ShelLuser (Jul 3, 2018)

mj_ said:


> What does that mean exactly? What is that quarterly that you're referring to? I have to admit I'm still very new to FreeBSD.


There are 2 types of binary repositories. quaterly, which is set as the default, and latest. Quarterly only gets updated, well, you get the drift while latest gets more frequent updates and therefor also provides more recent versions of the software.

But binary packages or not they all come from 1 main location: the ports collection. So the stuff you'd usually find in /usr/ports. Binary packages are nothing more but ports which got build using default settings and then made available for download and installation. So within those repositories.

Anyone can set up their own repository though, pkg-repo(8) is a good read for that (though I wouldn't follow up on that if you're still new).

So yeah, the theory here is that there could have been an issue with the building of the port which could then result in the binary package no longer being available. It is an automated process so... I suppose that can happen. For the record, I can now also reproduce this problem on my jail.

You could try checking the latest repository, or if you're really in need for an update you could consider building the port x11/xfce4-goodies yourself. Though I would definitely recommend against this because mixing ports and binary packages is generally speaking a bad idea.

(edit)

To answer your last question about consistency... This is why many of us rely on the ports collection. It takes more time to build the software yourself, but you're also not fully dependent of a 3rd party repository. That's not saying this is a full proof solution; when building problems occur then those will need to be fixed one way or the other before you can proceed with building and installing the software.


----------



## SirDice (Jul 3, 2018)

mj_ said:


> What is that quarterly that you're referring to?


By default, a -RELEASE version uses the quarterly package repositories. This is verified by the "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly" URL in /etc/pkg/FreeBSD.conf. The quarterly packages are updated once every three months or for security issues. This is the best choice for most people. 

Alternatively there's a latest repository, it is updated continuously and follows the ports tree as close as possible (it takes time to build 34000 packages for a bunch of different architectures and versions). 

In both cases, packages are built from the ports tree at regular intervals. Every now and then a port will fail to build and thus fail to create a package.


----------



## mj_ (Jul 3, 2018)

I see, thank you so much. I now understand the release model. Seems to be more like a rolling release where packages can occasionally come and go by accident. As such, this release model is unsuitable for my specific demands.

Maybe it'll be easier if I explain my actual intentions. Right now, when deploying a new say RHEL7 server I install one from a specific ISO media. That way I can make sure the base from which I continue is always identical. Afterwards, I run a script that adds additional repositories such as EPEL and our internal own repository, installs all required packages, sets up the environment required to run our software (environment variables, .bashrc and .profile settings, PostgreSQL connection parameters, etc.). Once the script is done installing and setting things up, it performs sanity and consistency checks.

The problem I'm having with FreeBSD now is very simple: the script fails on the second command already because pkg fails to find the xfce4-goodies package, which installed just fine last Friday and unfortunately is one of the packages deemed necessary on all our servers (just like the entire XFCE4 desktop), and thus exits abnormally (which is expected behavior). Thus, in order to get a consistently identical server I would have to rewrite the script, obtain the package in question from some other place, either binary or source, and install it manually. Naturally, doing this every 3 months is not particularly enticing - what would the FreeBSD solution to this problem be? A mirror repository that we use instead of the official one and keep updated manually? Our own ports collection that we have to compile and build from scratch every time? A static repository with the required base packages plus a second repository with updates (the RHEL/CentOS way)?

I have to admit that I did not expect packages simply disappearing from the repository over night, and I am fairly shocked that this seems to be "normal" (or at least not surprising to those who've been using FreeBSD for more than just a few days or weeks). On the plus side I'm sure there's a solution to this that I haven't thought of just yet.


----------



## SirDice (Jul 3, 2018)

mj_ said:


> The problem I'm having with FreeBSD now is very simple: the script fails on the second command already because pkg fails to find the xfce4-goodies package, which installed just fine last Friday and unfortunately is one of the packages deemed necessary on all our servers (just like the entire XFCE4 desktop), and thus exits abnormally (which is expected behavior). Thus, in order to get a consistently identical server I would have to rewrite the script, obtain the package in question from some other place, either binary or source, and install it manually. Naturally, doing this every 3 months is not particularly enticing - what would the FreeBSD solution to this problem be?


I highly recommend setting up your own repository using ports-mgmt/poudriere. That way you have ultimate control over what gets updated at what point in time. Added bonus, you get to pick your own default versions (PostgreSQL, Perl, Ruby, MySQL/MariaDB, etc).


----------

