2

Using dpkg, I see that Chef version 11.2.0 is currently installed:

$ dpkg -l | grep -i 'chef'
ii  chef                                 11.2.0-1.ubuntu.11.04             The full stack of chef

I'm building another server and want to use that exact package. I'm assuming that either apt or dpkg put it somewhere, how do I determine where the original installer resides?

I see a bunch of .deb files in /var/cache/apt/archives/, however none appear to be for Chef.

EDIT:

I found the debian installer on the Opscode web site:

https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/11.04/x86_64/chef_11.2.0-1.ubuntu.11.04_amd64.deb

After I installed it using sudo dpkg -i chef_11.2.0-1.ubuntu.11.04_amd64.deb, I tried the locate command as recommended by waltinator, and it didn't return any results.

Am I to assume, then, that packages installed manually like this are NOT added to the local apt archive?

muru
  • 197,895
  • 55
  • 485
  • 740
Alan
  • 187
  • 1
    Ubuntu 11.04 is end-of-life, so unless you follow the steps in this post, the answer below likely won't work. In addition, is there any particular reason just running sudo apt-get install chef won't work (assuming it's a supported Ubuntu release)? – saiarcot895 Aug 20 '15 at 00:35
  • We're experiencing problems with the current Chef client, which is why I want to test a new server setup with this specific version that IS working on that particular server. – Alan Aug 20 '15 at 15:40
  • Run this : apt-cache showpkg chef .You should be able to see lines Description Language and File. On the file line, you can find out which ppa the package came from. You'd need to turn that line into an html path, and add that path to your new server as a ppa repository. Let me know if this helps, and let me know if you want this posted as an answer – Sergiy Kolodyazhnyy Aug 20 '15 at 16:32
  • @Serg the file line says "/var/lib/dpkg/status", and that file appears to be the summary of all packages on the system. In the end, I simply downloaded the debian installer from Opscode. – Alan Aug 20 '15 at 17:22
  • @Serg I tried "apt-cache showpkg" for another app, and now see what you mean. It SHOULD be the source repository where the package came from. It appears that the Chef installer isn't setting its package properties completely. Please add an answer, I think this is the closest to what I was looking for. Thanks. – Alan Aug 20 '15 at 17:29
  • @Alan found a better solution. Answer posted. Please review – Sergiy Kolodyazhnyy Aug 20 '15 at 18:00
  • 1
    apt adds packages that it (or one of its frontends) downloaded to the cache. dpkg has no knowledge of apt's cache. – muru Aug 22 '15 at 01:32

2 Answers2

2

You could look for it:

locate --regexp 'chef.*deb'

Or, you could get a new copy, if /var/cache/apt/archives has been cleaned out.

See man apt-get, which says, in part:

NAME
       apt-get - APT package handling utility -- command-line interface

SYNOPSIS
       apt-get [-asqdyfmubV] [-o=config_string] [-c=config_file] [-t=target_release] [-a=architecture] {update | upgrade | dselect-upgrade | dist-upgrade |
               install pkg [{=pkg_version_number | /target_release}]...  | remove pkg...  | purge pkg...  |
               source pkg [{=pkg_version_number | /target_release}]...  | build-dep pkg [{=pkg_version_number | /target_release}]...  |
               download pkg [{=pkg_version_number | /target_release}]...  | check | clean | autoclean | autoremove | {-v | --version} | {-h | --help}}

Especially the download pkg [{=pkg_version_number | /target_release}] part, later on:

   download
       download will download the given binary package into the current directory.

So, apt-get download chef=11.2.0-1.ubuntu.11.04 is where I would start. I HAVE NOT TESTED THIS COMMAND

waltinator
  • 36,399
  • Thanks. I had been trying the download option of apt-get however wasn't having any luck, so I thought I wasn't specifying the version correctly. When I tried it without any version it says "Unable to locate package chef", so I guess I'll have to see if I can retrieve an older version of the installer directly from Opscode. – Alan Aug 20 '15 at 15:53
  • Oh, and the locate command returns a list of entries in the path /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.2.0/, but no debian installer. – Alan Aug 20 '15 at 15:55
1

So after some searching in addition to what I've posted in the comments, I found a command that produces the exact repository - apt-cache policy packagename.

Example:

$ apt-cache policy chef
chef:
  Installed: (none)
  Candidate: 11.8.2-2
  Version table:
     11.8.2-2 0
        500 http://us.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
Fabby
  • 34,259
Sergiy Kolodyazhnyy
  • 105,154
  • 20
  • 279
  • 497