---
name: "autopkgtest-build-lxc"
section: "1"
platform: "linux"
package: "autopkgtest"
version: "5.49"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/autopkgtest-build-lxc"
---

# autopkgtest-build-lxc(1)

Create or update autopkgtest container for autopkgtest-virt-lxc

## NAME

autopkgtest-build-lxc - Create or update autopkgtest container for autopkgtest-virt-lxc

## SYNOPSIS

**autopkgtest-build-lxc** \[*--arch=architecture*\] \[*--keyring=path*\] \[*--script=path*\] *distribution release*

Deprecated form:

**autopkgtest-build-lxc** \[*options*\] *distribution release architecture* \[*script*\]

## DESCRIPTION

**autopkgtest-build-lxc** creates or updates an LXC container **autopkgtest-***release* which is suitable for autopkgtest's LXC runner [**autopkgtest-virt-lxc**(1)](/autopkgtest-virt-lxc/1.md).

It calls **lxc-create** with the *distribution* template (which can currently be **debian** or **ubuntu) and** **-r***release* to build a debootstrap-like container, then enables **deb-src** apt sources, and runs **apt-get update.**

If the container already exists, it updates it as unintrusively as possible by first creating a new temporary container **autopkgtest-***release***.new**, and then rsyncing its root file system back to the existing **autopkgtest-***release*. Note that this could cause some side-effects and breakage if you have running containers with ephemeral overlays (i. e. using the **--ephemeral** option), but it does work in general. This update process does not interfere at all if you use **autopkgtest-virt-lxc** with cloning.

Note that you need to call this as root, unless you set up LXC to allow per-user containers. But user containers will not work with many or even most autopkgtests.

## OPTIONS

- **--arch=***ARCH*

  Specify a dpkg architecture name. By default, the native architecture is used.

  The third positional parameter is a deprecated way to specify this.

- **--keyring=***KEYRING*

  Specify the path to a keyring used to verify the apt repository. By default, the choice of keyring will be left to debootstrap. This option is mainly useful for use with a Debian derivative in conjunction with the **MIRROR** environment variable.

- **--script=***SCRIPT*

  Specify the path to a script to be executed inside the container to customize the container. The script must be a POSIX shell script, and should not depend on bash-specific features.

  The fourth positional parameter is a deprecated way to specify this.

## ENVIRONMENT

If the **$AUTOPKGTEST\_KEEP\_APT\_SOURCES** environment variable is set to a non-empty value, **autopkgtest-build-lxc** will keep whatever **/etc/apt/sources.list** was created by **lxc-create**.

Otherwise, if the **$AUTOPKGTEST\_APT\_SOURCES\_FILE** environment variable is set to a non-empty value, for example **AUTOPKGTEST\_APT\_SOURCES\_FILE=/home/me/mydistro/sources.list**, then **autopkgtest-build-lxc** will read that file (on the host system) and use it to populate **/etc/apt/sources.list** in the container; or if the **$AUTOPKGTEST\_APT\_SOURCES** environment variable is set to a non-empty value, for example **AUTOPKGTEST\_APT\_SOURCES=$(cat /home/me/mydistro/sources.list)**, **autopkgtest-build-lxc** will write it directly into **/etc/apt/sources.list** in the container.

When **$AUTOPKGTEST\_APT\_SOURCES\_FILE** or **$AUTOPKGTEST\_APT\_SOURCES** contain sources in the deb822 format, then sources are written to **/etc/apt/sources.list.d/\<distro\>.sources** in the virtual container, rather than **/etc/apt/sources.list.**

You can specify an apt proxy to use in the container in the **$AUTOPKGTEST\_APT\_PROXY** environment variable. If you have an apt proxy configured on the host, the container will automatically use this, otherwise there is no default. In case you want to prevent your local proxy to be picked up you can specify **UNCONFIGURED** as the value for **$AUTOPKGTEST\_APT\_PROXY.**

## EXAMPLES

\# autopkgtest-build-lxc debian sid

$ sudo autopkgtest-build-lxc ubuntu trusty i386

## SEE ALSO

[**autopkgtest-virt-lxc**(1)](/autopkgtest-virt-lxc/1.md), [**autopkgtest**(1)](/autopkgtest/1.md), [**lxc-create**(1)](/lxc-create/1.md), **/usr/share/doc/autopkgtest/**.

## AUTHORS AND COPYRIGHT

**autopkgtest-build-lxc** was written by Martin Pitt \<martin.pitt@ubuntu.com\>

This manpage is part of autopkgtest, a tool for testing Debian binary packages.  autopkgtest is Copyright (C) 2006-2014 Canonical Ltd and others.

See **/usr/share/doc/autopkgtest/CREDITS** for the list of contributors and full copying conditions.
