Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Suppose you want to add a package foo but when you invoke pkg_add via:

pkg_add -r foo

you get an error:

Error: Unable to get ftp://.../foo.tbz: File unavailable ...

It's not a problem since according to pkg_add's man page, all you have to do is to set the PACKAGEROOT environment variable to the root directory of foo:

PACKAGEROOT=ftp://root/to/package

Not so fast! It is a problem--it doesn't work! If you don't export PACKAGEROOT, then pkg_add uses its default location and exporting PACKAGEROOT give you the error:

pkg_add: can't stat package file 'foo'

The same holds when setting the PACKAGESITE variable.

Now, I have actually solved this problem:

pkg_add -r ftp://my/package/root/foo.tbz

works fine. Nevertheless, I have two questions:

  1. What exactly does can't stat package file 'foo' mean?
  2. Why doesn't this work as advertised?


For the interested, I experienced this problem when trying to install Enlightenment. The ports version is old and I didn't want to compile anyway since that takes a while. I set PACKAGEROOT and PACKAGESITE independently via different terminal sessions:

export PACKAGEROOT=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.0-release/x11-wm

and

export PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.0-release/x11-wm/

but neither worked.

share|improve this question

3 Answers 3

The difference between PACKAGEROOT and PACKAGESITE is that PACKAGEROOT retains the original directory logic and PACKAGESITE does not. These are correct:

PACKAGEROOT=ftp://ftp.freebsd.org

PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.0-release/Latest/

In answer to your questions:

  1. It means pkg_add it couldn't find the file. You're seeing it only with PACKAGESITE because setting that variable overrides the search process, which would usually yield "Couldn't find package foo."

  2. It does. When you have PACKAGESITE specified, all "pkg_add -r foo" does is try to open up $PACKAGESITE/foo.tbz. Do you see the problem? Go to your PACKAGESITE value and look for enlightenment.tbz.

    You didn't find it. The closest you found was enlightenment-0.16.999.042_3,2.tbz. So pkg_add -r "enlightenment-0.16.999.042_3,2" would work. Change your PACKAGESITE to ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8.0-release/Latest/ and it'll work.

    This is the whole reason the Latest/ subdirectory exists.

share|improve this answer

Just out of curiousity, did you actually read http://www.freebsd.org/doc/en/books/handbook/packages-using.html or just skim through it? It works exactly as described.

try

export PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-8-stable/Latest/

Also, "can't stat package 'foo'" basically means that it can't find that file (it's tried to stat() the file and failed. see man 2 stat for more details)

share|improve this answer
    
I most certainly does not work as advertised. Nowhere in the man page does it mention in any way whatsoever that you have to add 'Latest' on to the end of the URLs and the handbook's example doesn't bring attention to that at all. Moreover, the URLs i gave in my example actually contain the packages that I'm looking for. It may work, but the documentation needs to be 'there' in the case of the man pages and requiring 'Latest' on the end of the URL needs to be highlighted in the case of the handbook. –  gvkv Dec 7 '09 at 21:47
1  
OK. Rage a bit less and think about it logically. Why would you set PACKAGESITE to a full path to the package and then specify the package name again in the command? Seems a bit too redundant to be the correct way to use the command. Unfortunately, it's not possible to highlight all the important parts of the handbook, as it's all important (some bits to you, some bits to others). Put simply - Grow up, read the documentation carefully and stop whining. –  rodjek Dec 7 '09 at 22:19
    
The PACKAGESITE I gave originally is a typo--it's now fixed as I used a URL to a directory in practice. Regardless, nothing you have said refutes any points in my comment--there is no reason to use the URL you gave in either the man page or the handbook. I have no rage, just a desire for clarity. I consider this closed. –  gvkv Dec 7 '09 at 22:58
    
Except that I pulled that export line straight from the handbook... But you're right, there's definitely nothing in the handbook about it. –  rodjek Dec 7 '09 at 23:26

With 8.2-release I found the problem to be that I wasn't using BASH as my root shell. I added the 'export PACKAGEROOT' line to my ~/.profile but it didn't actually take effect until I used bash as my shell. Perhaps with your root shell as /bin/csh that's why they assign the variable and then export it as a separate statement in your ~/.profile. I haven't tested it to know for sure

share|improve this answer
    
Note that bash should probably not be your root shell (or at least not root's login shell) -- Bash is installed in /usr/local with lots of dependencies by default. If you need to get into the system as root one day and the dependencies are broken (or /usr/local didn't mount) you still want root to have a working shell - one of the standard ones under /bin. You can of course launch bash yourself after you've logged in :-) –  voretaq7 Nov 28 '12 at 19:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.