# I have a strange problem with pkg_add -r



## pcanyi (Apr 2, 2010)

When I use pkg_add -r XXXX,I found that if the file is little than 500Kb,it can worked fine.But it would stay in a nonworking status when the file is a little larger!And it ofen only can download one file.When I download for a second,it will be in the same status.

I getted in the FTP to download the file,and found that the download thread only can keep abount 30 seconds,then it would be in a "stalled" status.

why?Who can help me?Thanks very much.


----------



## fronclynne (Apr 2, 2010)

Have you tried setting an alternate ftp server in *PACKAGEROOT*?  Something like `# set PACKAGEROOT "ftp://ftp6.freebsd.org" ; pkg_add -r bacon quack bark`, I think.  Check here (aqui) for a list of mirrors.

If that doesn't help, try manually downloading the files to see if it still stalls (ftp(1) is your friend, as is wget(1) (with [red]-c -nd[/red] flags, in these cases).

If it still stalls out, you probably have a local network problem.


----------



## pcanyi (Apr 3, 2010)

Thank you for your guiding and attention.I have done some steps as follows:

ftp ftp.tw.freebsd.org
cd pub/FreeBSD/ports/i386/packages-8.0-release/All
get perl-5.8.9_3.tbz

when I do this,the perl can be downloaded within 15 minutes.But what confused me is that it would be keeping in a Fetching status for a whole day when I use pkg_add -r perl.I was so depressed with this curious problem.

I have also done like this:

setenv PACKAGEROOT ftp://ftp.tw.freebsd.org   or
setenv PACKAGEROOT ftp://ftp.cn.freebsd.org

but when I use pkg_add -r,it can not work!


----------



## SirDice (Apr 3, 2010)

pcanyi said:
			
		

> ```
> setenv PACKAGEROOT ftp://ftp.tw.freebsd.org
> ```


This is not correct. It should be:

```
setenv PACKAGEROOT ftp://ftp.tw.freebsd.org/pub/FreeBSD/ports/i386/packages-8.0-release/Latest
```

Now you can use `# pkg_add -r gnome` i.e.


----------



## fronclynne (Apr 3, 2010)

Ah, thanks, SirDice.  I don't use pkg_add(1) and was trusting the man page, which appears to be at odds with reality.


```
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).
```


----------



## pcanyi (Apr 4, 2010)

YES,fronclynne's view is right.

The variable PACKAGEROOT should be a domain, and PACKAGESITE be complete url.


----------



## pcanyi (Apr 4, 2010)

This problem is really strange. In fact,I haven't solved it any more! What should I add is that I install the Freebsd8.0 in the vmware7.0ã€‚

Ports and FTP are nomal.


----------



## pcanyi (Apr 4, 2010)

I have solved this problem. This is maybe a bug when FreeBSD8.0 installed in vmware7.0.

When I installed the OS in vbox, pkg_add -r worked fine!


----------



## fronclynne (Apr 4, 2010)

I've never vmware used, but within vbox I know you can chuse from a variety of NICs as with qemu, so perhaps the emulated defaultly NIC isn't quite (as the bishop would say) "good enough".  If there's an option to use something with which fxp(4) or xl(4) works, those are pretty good drivers.  I think em(4) is, as well.


----------

