Bug#1033352: sbuild: autokpgtest-virt-server needs host $HOME
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= \ --purge-deps=never \ --apt-update --apt-upgrade \ --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.
Bug#1033352: sbuild: autokpgtest-virt-server needs host $HOME
Hi josch, On 2024-02-21 08:02, Johannes Schauer Marin Rodrigues wrote: > Quoting Christian Kastner (2023-03-23 09:53:05) >> Attempting to build a package with the autopkgtest-virt-podman backend fails >> because of what I suspect is an issue with $HOME directory handling. podman >> needs $HOME on the host to find containers, but it defaults to >> /sbuild-nonexistent, which I guess is meant for the target enviromnent. > > 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. Best, Christian
Bug#1033352: sbuild: autokpgtest-virt-server needs host $HOME
Hi, Quoting Christian Kastner (2023-03-23 09:53:05) > Attempting to build a package with the autopkgtest-virt-podman backend fails > because of what I suspect is an issue with $HOME directory handling. podman > needs $HOME on the host to find containers, but it defaults to > /sbuild-nonexistent, which I guess is meant for the target enviromnent. is this a duplicate of #1061388? Thanks! cheers, josch signature.asc Description: signature
Bug#1033352: sbuild: autokpgtest-virt-server needs host $HOME
Package: sbuild Version: 0.85.2 Severity: normal Hi josch, Attempting to build a package with the autopkgtest-virt-podman backend fails because of what I suspect is an issue with $HOME directory handling. podman needs $HOME on the host to find containers, but it defaults to /sbuild-nonexistent, which I guess is meant for the target enviromnent. So unless I'm misunderstanding something, when autopkgtest-virt-server=podman, $HOME on the host should just remain $HOME, and $HOME in the target environment can be cleared as usual. Best, Christian Steps to reproduce: # Create a container. This will be tagged 'autopkgtest/debian:unstable' $ autopkgtest-build-podman # Attempt to build a package (src:libocas has no dependencies, so it fails fast) $ sbuild --chroot-mode=autopkgtest --autopkgtest-virt-server=podman --autopkgtest-virt-server-opt autopkgtest/debian:unstable --dist unstable libocas > cannot resolve /sbuild-nonexistent: lstat /sbuild-nonexistent: no such file > or directory > E: Error locking chroot session: skipping libocas # On the host: create a dummy file, repeat build attempt $ sudo touch /sbuild-nonexistent && sudo chmod 644 /sbuild-nonexistent $ sbuild --chroot-mode=autopkgtest --autopkgtest-virt-server=podman --autopkgtest-virt-server-opt autopkgtest/debian:unstable --dist unstable libocas > I: NOTICE: Log filtering will replace 'autopkgtest-virt-dummy-location' with > '<>' > time="2023-03-23T09:26:41+01:00" level=error msg="stat > /sbuild-nonexistent/.config/containers/storage.conf: not a directory" This suggests that podman was the culprit. # On the host: remove the dummy file, link to $HOME instead, repeat $ sudo rm /sbuild-nonexistent && sudo ln -s $HOME /sbuild-nonexistent $ sbuild --chroot-mode=autopkgtest --autopkgtest-virt-server=podman --autopkgtest-virt-server-opt autopkgtest/debian:unstable --dist unstable libocas > Build Architecture: amd64 > Build Type: binary > Build-Space: 20496 > Build-Time: 6 > Distribution: unstable > Host Architecture: amd64 > Install-Time: 16 > Job: libocas > Lintian: pass > Machine Architecture: amd64 > Package: libocas > Package-Time: 34 > Source-Version: 0.97+dfsg-8 > Space: 20496 > Status: successful > Version: 0.97+dfsg-8 Success! $ sudo rm /sbuild-nonexistent