# Fresh install, problem with pkg_add



## Prodiga1 (Aug 17, 2010)

I've recently freshly installed a version of FreeBSD 8.1 RELEASE, to fix an assortment of problems with my old FreeBSD installation.  

I have run into two problems immediately after a reinstallation and a reconfiguration of dhcp.  

1)  My first is an annoying problem I've run into before with FreeBSD-- pkg_add works when not sudo'd but doesn't work while sudo'd.

The following is the output of verbose mode in a non-sudo environment:


```
pkg_add: pkg_add of dependency 'libXaw-1.0.7 ,1' failed!
```

And in the sudo environment:


```
200 PORT command successful.  Consider using PASV.
initiating transfer
>>> RETR xterm.tbz
Error [...] Can't open data connection
```

I have FTP_PASSIVE="YES" setup in my rc.conf file, but how do I have this setting translate to sudo as well?  I know that upon sudo'ing, these settings are cleared...

2)  My second problem is a display adapter problem with gdm.  After successfully doing a pkg_add -r gdm, I have added dbus_enable="YES" and hald_enable="YES" to my rc.conf file as well as adding gdm_enable="YES"  Upon startup of my system, gdm does not load-- and when I attempt a:

`# gdm`

I get:


```
Failed to acquire org.gnome.DisplayManager: Connection ":1.12" is not allowed to own the service "org.gnome.DisplayManager
```

Any resolutions?

It's extremely disheartening to install a fresh copy of FreeBSD and immediately run into errors like these...


----------



## kpa (Aug 17, 2010)

Put this in /usr/local/etc/sudoers:


```
Defaults        env_keep += "FTP_PASSIVE_MODE"
```

Don't edit the file directly, use:

`# visudo`


----------



## gcooper@ (Aug 18, 2010)

A quick and dirty solution to this it to call the command like:

`sudo env VAR=VALUE command`

It's guaranteed to work whether or not sudo's in the mix without having to edit the sudoers file ...


----------

