pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Bob woes



As usual, I have (some) stuff on my machine in different places than
usual, so the default Bob config doesn't work for me without a lot of
tweaking.

For one thing, in the past I built a set of packages where the sandboxes
were (as per default) clones of my live system. Unfortunately that went
wrong, since I have a bunch of old libraries around from previous NetBSD
versions.  Somehow one of those started to conflict with a pkgsrc
library (I don't remember which one anymore, sorry), and the whole
resulting set was linking to the wrong one.

So now I'm trying again with a clean sandbox which I created with
pkg_comp1 as I usually do.

I am running into some issue that I think I had before and somehow got
around, but I don't remember how (or maybe it went away "by itself").

I see issues where not all of the dependencies of a package are
installed before it is built. After long searching I found relevant log
files in /root/.local/share/bob/logs/ (can't I set those somewhere else?
Even if it had been in $HOME I would certainly not sought it there).
It's only in /root because you have to run bob as root because of the
null mounts.

Anyway, in /root/.local/share/bob/logs/m4-1.4.21/configure.log I have

=> "/usr/bin/make" ["-C", "/usr/pkgsrc/devel/m4", "configure", "BATCH=1", "DEPENDS_TARGET=/nonexistent"]
=> Bootstrap dependency digest>=20211023: found digest-20220214
=> Checksum BLAKE2s OK for m4-1.4.21.tar.gz
=> Checksum SHA512 OK for m4-1.4.21.tar.gz
===> depends-message [m4-1.4.21] ===> Installing dependencies for m4-1.4.21
=> Tool dependency mktools-[0-9]*: found mktools-20250213
=> Tool dependency cwrappers>=20150314: found cwrappers-20220403
=> Tool dependency checkperms>=1.1: NOT found
=> Verifying /nonexistent for ../../sysutils/checkperms
make[1]: don't know how to make /nonexistent. Stop

make[1]: stopped making "/nonexistent" in /usr/pkgsrc/sysutils/checkperms
*** Error code 2

Stop.
make: stopped making "configure" in /usr/pkgsrc/devel/m4


Why does it find mktools and cwrappers, but not checkperms? All those
packages have been built by now. (I could understand it if none of the
packages were found. In that case I would suspect a mix-up of PKG_DBDIR)

/root/.local/share/bob/logs/m4-1.4.21/pre-clean.log confirms that Bob
seems to know about dependencies in general and installs them:

=> "/usr/sbin/pkg_add" ["-K", "/usr/pkg/pkgdb", "cwrappers-20220403", "digest-20220214", "mktools-20250213"]

so if it's installing all of these, why is it missing checkperms?

Make knows about it (but is then missing digest):

$ nice sudo ./bob  -c $PWD/config.lua sandbox exec
Creating sandbox... done (2.6s)
Entering sandbox /mnt/scratch/scratch/tmp/bobdir2/chroot/0...
sandbox:0 /# set -E
sandbox:0 /# cd /usr/pkgsrc/devel/m4
sandbox:0 /usr/pkgsrc/devel/m4# make show-all-depends
depends:
  pkg   TOOL_DEPENDS=           \
                                checkperms>=1.1:../../sysutils/checkperms \
                                cwrappers>=20150314:../../pkgtools/cwrappers \
                                mktools-[0-9]*:../../pkgtools/mktools \
                                # end of TOOL_DEPENDS (sorted)
  pkg   BUILD_DEPENDS=          # empty
  pkg   TEST_DEPENDS=           # empty
  pkg   DEPENDS=                # empty
  def   _DEPENDS_FILE=          /tmp/pkgsrc/devel/m4/default/.depends
  def   _RDEPENDS_FILE=         /tmp/pkgsrc/devel/m4/default/.rdepends

sandbox:0 /usr/pkgsrc/devel/m4# 

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert                            <rhialto/at/falu.nl>
\X/ There is no AI. There is just someone else's work.           --I. Rose


--[[
  Example configuration file for NetBSD.

  This is designed to work out of the box, but you will almost certainly want
  to customise it for optimum performance.

  Full reference for every section, action, and variable:
  https://docs.rs/bob/latest/bob/config/
]]

-- General configuration variables.
local initdir = "/mnt/scratch/scratch/tmp/bobdir2"

options = {
    build_threads = 4,
    scan_threads = 4,
    -- Log level: error, warn, info, debug, trace.  Override with RUST_LOG env.
    -- log_level = "info",
    log_level = "debug",
}

--[[
  Dynamic resource allocation settings.  Uses statistics from the history db,
  knowledge of upcoming builds, and package weight to make informed choices for
  what MAKE_JOBS and WRKOBJDIR should be set to for each package build.

  If you set MAKE_JOBS or WRKOBJDIR in mk.conf then you must use ?= so that
  bob's environment settings take precedence.

  On first builds with no history, conservative values are used.
  ]]
dynamic = {
    jobs = 6,
    wrkobjdir = {
        tmpfs = "/tmpfs",
        disk = initdir .. "/builder-home",
        threshold = "10G",

        -- By default, builds that failed previously will be assigned to disk
        -- as we cannot guarantee they will fit tmpfs.  Set failed_threshold
        -- to override this when the failed disk usage is under the threshold.
        -- Recommended to be around 50% of the main threshold.
        failed_threshold = "500M",

        -- Some builds use significantly more disk space during the build than
        -- is left at the end when the WRKDIR usage calculations are recorded.
        -- There is no way to accurately catch this, so always_disk forces the
        -- list of specified pkgpaths to always be assigned to disk.
        always_disk = {
            "sysutils/ansible",
        },
    },
}

--[[
    In the sandbox as created by pkg_comp1, you need to run "certctl rehash"
    to install certificates. There also needs to be a user "builder" with
    the same uid as outside.
]]

rhialto = {
    packages_outside = "/mnt/scratch/scratch/packages.amd64-11.0",
    packages_inside = "/usr/pkgsrc/packages",
    distdir_outside = "/vol1/distfiles", -- inside is the same
    sandroot = "/scratch/chroot/pkg_comp.amd64-11.0/default",
    pkgsrc = "/mnt/vol1/rhialto/cvs/pkgsrc",
}

-- Variables that configure pkgsrc, where it is, what packages to build, etc.
pkgsrc = {
    basedir = "/usr/pkgsrc",
    make = "/usr/bin/make",
    -- or pkgpaths = read_pkgpaths("/path/to/file"),
    --[[
    pkgpaths = {
        "mail/mutt",
        "sysutils/coreutils",
    },
    ]]
    pkgpaths = read_pkgpaths("/usr/pkgsrc/pkgchk.conf"),

    --[[
      It is strongly recommended to set up an unprivileged user to perform
      builds.  If this is enabled, there is an action below to automatically
      create the user home directory.  If build_user_home is not set it is
      retrieved via getpwnam(3).
    ]]
    build_user = "builder",
    build_user_home = initdir .. "/builder-home",

    --[[
      On build failure, save files matching these glob patterns from WRKDIR.
    ]]

    save_wrkdir_patterns = {
        "**/CMakeError.log",
        "**/CMakeOutput.log",
        "**/config.log",
        "**/meson-log.txt",
    },

    -- Logs are copied to /root/.local/share/bob/logs/ because we run as root...
}

--[[
  Configure pkg_summary generation.  These are the default values.  Enable
  include_restricted if you are not going to publish the packages and want
  restricted NO_BIN_ON_* packages to be included in the pkg_summary file.

summary = {
    include_restricted = true,
    file_cksum = false,
    compression = { "gz", "zst" },
}
]]

-- The sandboxes section defines where, and how, sandboxes will be created.
sandboxes = {
    basedir = initdir .. "/chroot",

    --[[
      Environment variable configuration for sandboxed processes.  It is
      recommended to be as strict as possible, especially in the "build"
      section used by production build sandboxes, as pollution from the user
      environment can negatively impact builds.  The "dev" section used by
      "bob sandbox exec" is primarily for interactive pkgsrc work, and you
      may want to set useful variables to suit the development environment.
    ]]
    environment = {
        build = {
            clear = true,
            inherit = { "TERM", "HOME" },
            vars = {
                PATH = "/sbin:/bin:/usr/sbin:/usr/bin",
		PACKAGES = rhialto.packages_inside,  -- to override mk.conf's PACKAGES ?=
                BINPKG_SITES = rhialto.packages_inside,  
		DISTDIR = rhialto.distdir_outside,  -- to override mk.conf's DISTDIR ?=
            },
        },
        dev = {
            clear = true,
            inherit = { "TERM", "HOME" },
            vars = {
                -- BINPKG_SITES = "${bob_packages}",
                DEPENDS_TARGET = "bin-install",
                PATH = "${bob_prefix}/sbin:${bob_prefix}/bin:/sbin:/bin:/usr/sbin:/usr/bin",
                PS1 = [["sandbox:${bob_sandbox_id} "'${PWD}# ']],
		PACKAGES = rhialto.packages_inside,  -- to override mk.conf's PACKAGES ?=
                BINPKG_SITES = rhialto.packages_inside,  
		DISTDIR = rhialto.distdir_outside,  -- to override mk.conf's DISTDIR ?=
            },
        },
    },

    --[[
      List of actions to apply for each sandbox.  During creation these actions
      are performed in order, and during destruction they are performed in
      reverse order.
    ]]
    setup = {
        -- Configure NetBSD device nodes.  Note that it is too early to be able
        -- to execute commands inside chroot context, so this is done carefully
        -- outside the chroot.
        { action = "cmd",
          create = "mkdir dev && cp /dev/MAKEDEV /dev/MAKEDEV.local dev/"
                .. " && cd dev && ./MAKEDEV all",
          destroy = "rm -rf dev" },

        { action = "mount", fs = "proc", dir = "/proc" },

        { action = "mount", fs = "tmp", dir = "/tmp", opts = "-s 1G" },
        { action = "mount", fs = "tmp", dir = "/var", opts = "-s 1G" },

        { action = "mount", fs = "null", src = rhialto.sandroot .. "/bin", dest = "/bin", opts = "-o ro" },
        { action = "mount", fs = "null", src = rhialto.sandroot .. "/sbin", dest = "/sbin", opts = "-o ro" },
        { action = "mount", fs = "null", src = rhialto.sandroot .. "/libexec", dir = "/libexec", opts = "-o ro" },
        { action = "mount", fs = "null", src = rhialto.sandroot .. "/lib", dest = "/lib", opts = "-o ro" },
        { action = "mount", fs = "null", src = rhialto.sandroot .. "/usr/bin", dest = "/usr/bin", opts = "-o ro" },
        { action = "mount", fs = "null", src = rhialto.sandroot .. "/usr/include", dest = "/usr/include", opts = "-o ro" },
        { action = "mount", fs = "null", src = rhialto.sandroot .. "/usr/lib", dest = "/usr/lib", opts = "-o ro" },
        { action = "mount", fs = "null", src = rhialto.sandroot .. "/usr/libdata", dest = "/usr/libdata", opts = "-o ro" },
        { action = "mount", fs = "null", src = rhialto.sandroot .. "/usr/libexec", dest = "/usr/libexec", opts = "-o ro" },
        { action = "mount", fs = "null", src = rhialto.sandroot .. "/usr/share", dest = "/usr/share", opts = "-o ro" },
        { action = "mount", fs = "null", src = rhialto.sandroot .. "/usr/sbin", dest = "/usr/sbin", opts = "-o ro" },
        { action = "mount", fs = "null", src = rhialto.sandroot .. "/var/mail", dest = "/var/mail", opts = "-o ro" },

	-- Optional sets or potential to not exist should not cause errors.
        { action = "mount", fs = "null", src = rhialto.sandroot .. "/usr/X11R7", dest = "/usr/X11R7", opts = "-o ro",
          only = { exists = rhialto.sandroot .. "/usr/X11R7" } },
        { action = "mount", fs = "null", src = rhialto.sandroot .. "/usr/games", dest = "/usr/games", opts = "-o ro",
          only = { exists = rhialto.sandroot .. "/usr/games" } },

        { action = "copy", src = rhialto.sandroot .. "/etc", dest = "/etc" },

        { action = "mount", fs = "null", dir = "/tmpfs" },
        { action = "mount", fs = "null", dir = rhialto.distdir_outside },

        -- At this point everything should be set up so that chrooted commands
        -- will execute successfully.  Perform additional chroot setup.
        { action = "cmd", chroot = true,
          create = "mkdir -m 1777 /var/tmp; chmod 1777 /tmp" },

        -- Configure build user home directory if enabled.  Bob automatically
        -- sets bob_build_user* variables when the build user is configured,
        -- and the scripts are executed with 'set -eu', so these should be safe.
        { action = "cmd", only = { set = "pkgsrc.build_user" },
          create = [[
                mkdir -p ${bob_sandbox_path}${bob_build_user_home}
                chown ${bob_build_user} ${bob_sandbox_path}${bob_build_user_home}
          ]],
          destroy = "rm -rf ${bob_sandbox_path}${bob_build_user_home}" },

        -- It is recommended to mount pkgsrc read-only, but you will first need
        -- to configure DISTDIR, PACKAGES, and WRKOBJDIR to other directories.
        { action = "mount", fs = "null", src = rhialto.pkgsrc, dest = pkgsrc.basedir, opts = "-o ro" },
        { action = "mount", fs = "null", src = rhialto.packages_outside, dest = rhialto.packages_inside },
	-- in previous Bobs we had to mount this directory twice, something was using the "outside" name.
        -- { action = "mount", fs = "null", dir = rhialto.packages_outside },
    },

    --[[
      Per-package hook actions.  Any create action will run after the internal
      pre-build script (unpacks bootstrap kit if needed), and any destroy
      action runs before the internal post-build script (wipes PREFIX and
      PKG_DBDIR).

    hooks = {
        -- As an example, ensure clean passwd file and /tmp for each build.
        { action = "cmd",
          create = "cp /etc/passwd ${bob_sandbox_path}/etc/passwd",
          destroy = "rm -rf ${bob_sandbox_path}/tmp/*",
        },
    },
    ]]
}

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index