On 2024-02-21 09:22, Christian Kastner wrote:
> On 2024-02-21 08:02, Johannes Schauer Marin Rodrigues wrote:
>> is this a duplicate of #1061388?
> 
> I *think* so, but I'm not sure.
> 
> The cause definitely seems to be the same: on the host, prior to opening
> the chroot, $HOME is set to /sbuild-nonexistent, which triggers these
> two bugs.
> 
> I'm not sure because I don't know if the $HOME thing above is buggy ,or
> it's correct (though strict) and autopkgtest-build-podman, incus, or
> something else needs fixing.
> 
> For example, in #1061388, a possible fix in incus is mentioned.
> 
> From my current understanding, this wouldn't work for podman, because
> its attempted use of $HOME/.config/local/*.conf is not just legitimate,
> I'd actually call it required.

I'm happy to say that I've found a workaround.

podman needs $HOME for runtime configuration and storage location, but
$HOME cannot be used even when put in ENVIRONMENT_FILTER.

However: podman also looks into the XDG_ directories, which *can* be
added to ENVIRONMENT_FILTER.

So by

(1) adding

  XDG_CACHE_HOME
  XDG_CONFIG_HOME
  XDG_DATA_HOME

to $environment_filter in .sbuildrc, and

(2) assuming that one has created a suitable container image with
autopkgtest-build-podman,

(3) one can run an autopkgtest with the podman backend as follows:

  $ export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
  $ export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
  $ export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"

  $ sbuild \
        --chroot-mode=autopkgtest \
        --autopkgtest-virt-server=podman \
        --autopkgtest-virt-server-opt=<image-tag> \
        --purge-deps=never \
        --apt-update --apt-upgrade \
        --dist <dist> \
        <...>

If not for one missing variable->path mapping, one could even explicitly
set podman-specific variables, which would make integration much easier
because they could not affect any other part of sbuild.

Reply via email to