pkg_add -r and sudo in FreeBSD
May 2019
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
This site is an effort to share some of the base knowledge I have gathered through all this years working with Linux, FreeBSD, OpenBSD, Python or Zope, among others. So, take a look around and I hope you will find the contents useful.
Recent Entries
Recent Comments
Recent Trackbacks
OpenBSD (9 items)
BSD (0 items)
FreeBSD (19 items)
Linux (3 items)
Security (3 items)
Python (22 items)
Zope (13 items)
Daily (144 items)
e-shell (9 items)
Hacks (14 items)
PostgreSQL (3 items)
OSX (8 items)
Nintendo DS (0 items)
enlightenment (0 items)
Apache (3 items)
Nintendo Wii (1 items)
Django (24 items)
Music (12 items)
Plone (7 items)
Varnish (0 items)
Lugo (2 items)
Sendmail (0 items)
europython (7 items)
Cherokee (1 items)
self (1 items)
Nature (1 items)
Hiking (0 items)
uwsgi (0 items)
nginx (0 items)
cycling (10 items)
Networking (1 items)
DNS (0 items)

Syndicate this site (XML)

RSS/RDF 0.91

03 noviembre

pkg_add -r and sudo in FreeBSD

strange behaviour indeed, never happened to me before.

I usually install software in my FreeBSD servers using the ports collection instead of installing binary pre-compiled packages (I don't want a flame about this, I prefer to compile the software, period) but, from time to time, I use the package collection too.

Today, while playing with a 8.0-RC2 box, I noticed that pkg_add -r (to install packages remotely from the FreeBSD ftp server) doesn't work properly with sudo:

[nidhogg] ~> sudo pkg_add -r lynx
Error: Unable to get Syntax error, command unrecognized
pkg_add: unable to fetch '' by URL
[nidhogg] ~>

It works fine as root:

nidhogg# pkg_add -r lynx
Fetching Done.

To enable certificate handling for SSL connnections, set
SSL_CERT_DIR and SSL_CERT_FILE in your environment to the
proper values (depending upon which SSL library
/usr/local/bin/lynx uses), as described in:




You may also need to generate keys and certificates as
described in the latter document and your SSL documentation.


Anyone that could explain it? (Probably something related to sudo being more restrictive with the env vars settings?)

Posted by wu at 16:51 | Comments (1) | Trackbacks (0)
<< Latest Amazon order is here! | Main | La champions vuelve a TVE >>
Re: pkg_add -r and sudo in FreeBSD

I think is related to env vars (PKG_PATH, PACKAGEROOT, ...)

I can't test it now in FreeBSD, but I have the same problem with OpenBSD pkg_add (I use to use ports in FreeBSD and packages in OpenBSD).

My solution (at least works in OpenBSD) is to define PKG_PATH in .profile of the user that runs the sudo command, and voilà, it works.

Hope that it helps.

Posted by: paco at noviembre 04,2009 15:51
Re: pkg_add -r and sudo in FreeBSD

You can uncomment a line in /usr/local/etc/sudoers and sudo pkg_add -r will start working. The line is self-described within the sudoers file.

Posted by: don bright at septiembre 03,2012 00:46
Please send trackback to:
There are no trackbacks.
Post a comment