DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD Ports and Packages

FreeBSD Ports and Packages Installation and upgrading of ports and packages on FreeBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 3rd August 2008
kasse kasse is offline
Fdisk Soldier
 
Join Date: Jun 2008
Posts: 67
Thanked 0 Times in 0 Posts
Default pkg_add -r does not use exported packagesite

Without knowing if this is appropriate to do, my problem is:
I want to use a binary package in /packages-7-stable/Latest/ so I use
Code:
 export PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7-stable/Latest/
and try to use pkg_add -r . But then I get the error message
Code:
Error: FTP Unable to get ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.0-release/Latest/"the package": File unavailable (e.g., file not found, no access)
pkg_add: unable to fetch 'ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.0-release/Latest/"the package"' by URL
("the package" is just the dummy name here in this post")
Why does it not search using PACKAGESITE?
Reply With Quote
  #2   (View Single Post)  
Old 3rd August 2008
corey_james corey_james is offline
Uber Geek
 
Join Date: Apr 2008
Location: Brisbane, Australia
Posts: 238
Thanked 4 Times in 10 Posts
Default

from the pkg_add man page

Quote:
ENVIRONMENT
The value of the PKG_PATH is used if a given package cannot be found.
The environment variable should be a series of entries separated by
colons. Each entry consists of a directory name. The current directory
may be indicated implicitly by an empty directory name, or explicitly by
a single period.

The environment variable PKG_DBDIR specifies an alternative location for
the installed package database, default location is /var/db/pkg.

The environment variables PKG_TMPDIR and TMPDIR, in that order, are taken
to name temporary directories where pkg_add will attempt to create its
staging area in. If these variables are not present or if the directo-
ries named lack sufficient space, then pkg_add will use the first of
/var/tmp, /tmp or /usr/tmp with sufficient space.

The environment variable PACKAGEROOT specifies an alternate location for
pkg_add to fetch from. The fetch URL is built using this environment
variable and the automatic directory logic that pkg_add uses when the -r
option is invoked. An example setting would be "ftp://ftp3.FreeBSD.org".

The environment variable PACKAGESITE specifies an alternate location for
pkg_add to fetch from. This variable subverts the automatic directory
logic that pkg_add uses when the -r option is invoked. Thus it should be
a complete URL to the remote package file(s).

The environment variable PKGDIR specifies an alternative location to save
downloaded packages to when -K option is used.
__________________
"No, that's wrong, Cartman. But don't worry, there are no stupid answers, just stupid people." -- Mr. Garrison

Forum Netiquette
Reply With Quote
  #3   (View Single Post)  
Old 3rd August 2008
kasse kasse is offline
Fdisk Soldier
 
Join Date: Jun 2008
Posts: 67
Thanked 0 Times in 0 Posts
Default

Sorry for me being a bit slow, but what do you mean? Should I set packageroot instead of packagesite?
Reply With Quote
  #4   (View Single Post)  
Old 3rd August 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Thanked 49 Times in 43 Posts
Default

it should work.

anyway, try:
# PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7-stable/Latest/ pkg_add -r mysterious_package
Reply With Quote
  #5   (View Single Post)  
Old 3rd August 2008
kasse kasse is offline
Fdisk Soldier
 
Join Date: Jun 2008
Posts: 67
Thanked 0 Times in 0 Posts
Default

eeh well that is what I have tried and with some other variants too. with a Latest/. also as the path. First I thought that the enviroment variable was not available when I sudo but it is. So i guess I just have to look hard at the man page and find out what I'm doing wrong
Reply With Quote
  #6   (View Single Post)  
Old 3rd August 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,051
Thanked 198 Times in 156 Posts
Default

Try trimming Latest/ off the URL.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #7   (View Single Post)  
Old 3rd August 2008
ephemera's Avatar
ephemera ephemera is offline
Knuth's homeboy
 
Join Date: Apr 2008
Posts: 537
Thanked 49 Times in 43 Posts
Default

> eeh well that is what I have tried

just the way i had given? are you sure?

are you saying that pkg_add is not using the PACKAGESITE env variable?
Reply With Quote
  #8   (View Single Post)  
Old 4th August 2008
kasse kasse is offline
Fdisk Soldier
 
Join Date: Jun 2008
Posts: 67
Thanked 0 Times in 0 Posts
Default

Thanks for the replies, but I'm sorry to say that it is not working.
The variable PACKAGESITE is exported but it does not work.
Perhaps if I could use setenv instead, but I guess that does not work in bash. Also I cannot use setenv if I switch to sh since it complains that, setenv cannot be found. I cannot locate setenv, so I don't know if I have it. I find the man files for setenv but nothing more. That is weird since I use the standard installation of Freebsd 7
Reply With Quote
  #9   (View Single Post)  
Old 4th August 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,051
Thanked 198 Times in 156 Posts
Default

setenv is for csh and tcsh, not for bourne shells.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
Old 4th August 2008
kasse kasse is offline
Fdisk Soldier
 
Join Date: Jun 2008
Posts: 67
Thanked 0 Times in 0 Posts
Default

Ok, still it does not work if I use setenv in csh. But for you, is all that you do just to set the variable PACKAGESITE and then when you use pkg_add -nr , it searches according to PACKAGESITE?
Reply With Quote
Old 24th August 2008
kasse kasse is offline
Fdisk Soldier
 
Join Date: Jun 2008
Posts: 67
Thanked 0 Times in 0 Posts
Default

I don't know if it is against the rules to bump the thread, but since I still haven't solved this problem I hope that I do not offend anyone by doing so.

so here goes nothing - bump!
Reply With Quote
Old 25th August 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,116
Thanked 182 Times in 149 Posts
Default

What is the output of
Code:
env | grep PACKAGESITE
?
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Old 25th August 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,051
Thanked 198 Times in 156 Posts
Default

It works fine as far as I can see:

Code:
# env | grep PACKAGESITE
Exit 1

# pkg_add -r add
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7-stable/Latest/add.tbz... Done.
# pkg_delete add\*

# setenv PACKAGESITE http://example.com/
# pkg_add -r add
Error: FTP Unable to get http://example.com/add.tbz: Not Found
pkg_add: unable to fetch 'http://example.com/add.tbz' by URL
Exit 1
# uname -a
FreeBSD phong.rwxrwxrwx.net 7.0-STABLE FreeBSD 7.0-STABLE #0: Sun Aug 10 06:09:56 CEST 2008     carpetsmoker@phong.rwxrwxrwx.net:/usr/obj/usr/src/sys/PHONG  i386
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
Old 25th August 2008
kasse kasse is offline
Fdisk Soldier
 
Join Date: Jun 2008
Posts: 67
Thanked 0 Times in 0 Posts
Default

thank you for your replies, I feel somewhat honored that the two big shots here take the time to deal with this.

J65nko:
before I have exported PACKAGESITE, env |grep PACKAGESITE gives nothing
then if i export PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7-stable/Latest/
I get stable-7 in env | grep PACKAGESITE

Carpetsmoker:
with pf turned off and with packagesite set as above I get
Code:
[viktor@Dell /usr/home/viktor]$ env |grep PACKAGESITE
PACKAGESITE=ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7-stable/Latest/
[viktor@Dell /usr/home/viktor]$ sudo pkg_add -nr add
Password:
Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-7.0-release/Latest/add.tbz... Done.
but
Code:
[viktor@Dell /usr/home/viktor]$ uname -a
FreeBSD Dell 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Feb 24 19:59:52 UTC 2008     root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
is the problem that you cannot use 7-stable with a 7.0-release (whatever that is) so it reverts to the default?
Reply With Quote
Old 25th August 2008
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,051
Thanked 198 Times in 156 Posts
Default

Quote:
sudo pkg_add -nr add
Ahha, this is the problem, sudo doesn't copy the user's environment.

From sudoers(5):
Code:
    env_reset       If set, sudo will reset the environment to only contain
		       the LOGNAME, SHELL, USER, USERNAME and the SUDO_* vari-
		       ables.  Any variables in the caller's environment that
		       match the env_keep and env_check lists are then added.
		       The default contents of the env_keep and env_check
		       lists are displayed when sudo is run by root with the
		       -V option.  If sudo was compiled with the SECURE_PATH
		       option, its value will be used for the PATH environment
		       variable.  This flag is on by default.
And from sudo(8):
Code:
       -E  The -E (preserve environment) option will override the env_reset
	   option in sudoers(5)).  It is only available when either the match-
	   ing command has the SETENV tag or the setenv option is set in sudo-
	   ers(5).
So you'll need to look at configuring sudo, or use su.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
Old 26th August 2008
kasse kasse is offline
Fdisk Soldier
 
Join Date: Jun 2008
Posts: 67
Thanked 0 Times in 0 Posts
Default

My hat's off to you Mr Carpetsmoker ! -You're surely good at debugging these kind of problems.
Do you know if this is something that is mentioned often in all the guides that recommend the new users to utilize sudo?
I guess that from now on I should not overlook the manfiles of the commands that I think I understand.
Reply With Quote
Old 26th August 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,116
Thanked 182 Times in 149 Posts
Default

The newer versions of sudo let the user only inherit a limited set of the environment variables.
However, you can add environment variables you want to inherit through the /etc/sudoers file.

From my OpenBSD box (sudo is maintained by OpenBSD developers):
Code:
# $OpenBSD: sudoers,v 1.12 2007/08/09 16:12:08 ajacoutot Exp $
#
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#
    
# Host alias specification

# User alias specification

# Cmnd alias specification

# Defaults specification
Defaults env_keep +="DESTDIR FETCH_CMD FLAVOR FTPMODE MAKE MULTI_PACKAGES OKAY_FILES PKG_DBDIR PKG_D
ESTDIR PKG_CACHE PKG_PATH PKG_TMPDIR PORTSDIR RELEASEDIR SUBPACKAGE"
You see here some OpenBSD specific environment variables for the OpenBSD ports and package system like PKG_PATH and PKG_CACHE.

By adding PACKAGESITE to your FreeBSD sudoers file you will have solved this nasty issue
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Reply

Tags
packagesite, pkg_add, sudo

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pkg_add problems with connecting Mr-Biscuit NetBSD Package System (pkgsrc) 2 26th May 2009 11:44 AM
pkg_add - can't resolve <packagename> nihonto OpenBSD Packages and Ports 11 28th January 2009 10:03 PM
My version of pkg_add :) DNAeon FreeBSD Ports and Packages 26 15th October 2008 06:58 AM
pkg_add g95;g95 x.f95: cannot find g95 enpey OpenBSD Packages and Ports 8 27th August 2008 12:48 AM
pkg_add error buba OpenBSD Packages and Ports 4 13th June 2008 03:29 PM


All times are GMT. The time now is 07:15 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick