2025-11-09T13:32:18Z Walter Alejandro Iglesias <[email protected]>:

On Sun, Nov 09, 2025 at 01:53:35PM +0100, Kirill A. Korinsky wrote:
On Sun, 09 Nov 2025 13:39:27 +0100,
Walter Alejandro Iglesias <[email protected]> wrote:

Hi list,

I followed the instructions here:

  https://www.openbsd.org/faq/ports/ports.html#PortsConfig

The part under "Configuration of the Ports System" where it explains how
to build as a common user.  The text states:

  "Again, ports can be built as a user, but must be installed by root or
   with doas(1)."

But after editing /etc/mk.conf and changing username and group of those directories (including /usr/ports) when I run "make" as a common user I
get this:

  pkg_add: pkg_add must be run as root

What am I missing?


Probably you need

PORTS_PRIVSEP=yes
SUDO=doas

I added those variables to /etc/mk.conf.  Now it has:

  PORTS_PRIVSEP=yes
  SUDO=doas
  WRKOBJDIR=/usr/obj/ports
  DISTDIR=/usr/distfiles
  PACKAGE_REPOSITORY=/usr/packages

I changed user:group of those directories to my user and group, then I
untared pots.tar.gz to /usr/ports and recursevely changed user:group
there too.  I also added the following entries to /etc/doas.conf (as
documented in bsd.port.mk(5)):

  permit keepenv nopass <my_user> as _pbuild
  permit keepenv nopass <my_user> as _pfetch


But I still get:

  $ make
  mkdir /usr/obj/ports: Permission denied at /usr/ports/infrastructure/bin/portlock line 52.   *** Error 255 in /usr/ports/graphics/libplacebo (/usr/ports/infrastructure/mk/bsd.port.mk:2710 'clean': @lock=libplacebo-7.351.0;  export _L...)


I don't know what else to do. :-(

WRKOBJDIR and PACKAGE_REPOSITORY need to be writable by the _pbuild user and DISTDIR by the _pfetch user. I usually leave those directories in their default locations (i.e. don't set them in mk.conf) and run the following:

# install -d -o _pfetch -g _pfetch /usr/ports/distfiles
# install -d -o _pbuild -g _pbuild /usr/ports/{packages,plist,pobj,bulk}

Or if they exist already:

# chown -R _pfetch:_pfetch /usr/ports/distfiles
# chown -R _pbuild:_pbuild /usr/ports/{packages,plist,pobj,bulk}

You can tweak those commands to match the locations specified in your mk.conf.

Reply via email to