---
name: "sbuild-qemu-create"
section: "1"
platform: "linux"
package: "sbuild-qemu"
version: "0.89.3+deb13u4"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/sbuild-qemu-create"
---

# sbuild-qemu-create(1)

QEMU image creator for sbuild

## NAME

sbuild-qemu-create - QEMU image creator for sbuild

## SYNOPSIS

**sbuild-qemu-create** \[**-h**\] \[**--arch=ARCH**\] \[**--install-packages=INSTALL\_PACKAGES\]** \[**--extra-deb=EXTRA\_DEB\]** \[**--components=COMPONENTS**\] \[**--skel=SKEL**\] \[**--authorized-keys=FILE**\] \[**--size=SIZE**\] \[**-o=OUT\_FILE**\] \[**--noexec**\] \[RELEASE\] \[MIRROR\]

Build an image for use with **sbuild-qemu** and **autopkgtest**. **RELEASE** will be debootstrapped from **MIRROR**. This mirror will also be used for the *sources.list* file within the VM. See MIRROR below.

Note that sbuild-qemu-create is just a simple wrapper around [autopkgtest-build-qemu(1)](/autopkgtest-build-qemu/1.md) that automates a few additional steps commonly performed for package-building images.

## OPTIONS

- **-h**, **--help**

  Show this help message and exit.

- **--arch**=ARCH

  Architecture to use. Default is the host architecture. Currently supported architectures are: amd64, arm64, armhf, i386, ppc64el.

- **--install-packages**=INSTALL\_PACKAGES

  Comma-separated list of additional packages to install using **apt-get install** from within the image.

- **--extra-deb**=EXTRA\_DEB

  Package file (.deb) from the local filesystem to install. Can be specified more than once.

- **--components**=COMPONENTS

  Comma-separated list of components to use with *sources.list* entries. Default: main.

- **--skel**=SKEL

  Skeleton directory to use for */root*.

- **--authorized-keys**=FILE

  Install this file as */root/.ssh/authorized\_keys* within the guest. This will automatically install the **openssh-server** package. This supersedes any copying of this file by the --skel option.

- **--size**=SIZE

  Image size to use. Note that the images will be created in qcow2 format, so they won't consume that space right away. Default: 10G.

- **-o**=OUT\_FILE, **--out-file**=OUT\_FILE

  Output filename. If not supplied, then DIST-autopkgtest-ARCH.img will be used.

- **--noexec**

  Don't actually do anything. Just print the [autopkgtest-build-qemu(1)](/autopkgtest-build-qemu/1.md) command string that would be executed, and then exit.

- **--boot**=auto,bios,efi,ieee1275,none

  How the image should boot. Default is BIOS on amd64 and i386, EFI on arm64 and armhf, and IEEE1275 on ppc64el.

## MIRROR

It is **highly recommended** that you use an APT cache, like [approx(8)](/approx/8.md) or [apt-cacher-ng(8)](/apt-cacher-ng/8.md), on the **local** machine (so that the VM can access that cache without much hassle) as a mirror. This will dramatically speed up the package build process. On the author's local machine, installing the build dependencies of even larger packages takes only a few seconds.

If you use a local cache, then ensure that the mirror is accessible from within the guest. Using *http://localhost:9999/debian* or similar will successfully build the image, but APT will fail within the running VM, because to the VM, \`\`localhost'' is something else. An easy workaround is to use an IP address instead, for example *http://192.168.0.123:9999/debian*, assuming the host system has the IP 192.168.0.123.

## SPECIAL CASES

If **RELEASE** is **experimental**, *sources.list* will contain entries for both **experimental** and **unstable**.

If **RELEASE** ends with **-backports**, *sources.list* will contain entries for both **RELEASE** and for the distribution it is based upon. In other words, specifying *bullseye-backports* will also add an entry for *bullseye*.

## SHARING FILES

Among other things, [autopkgtest-virt-qemu(1)](/autopkgtest-virt-qemu/1.md) has built-in support for sharing a directory on the host with the guest, so no further configuration should be necessary when accessing the VM using autopkgtest.

In additon to that, a mount point for a 9p filesystem is added to the VM's */etc/fstab*. This is for cases where the VM is launched via QEMU directly, rather than going through autopkgtest-virt-qemu.

To share a directory on the host with the VM, QEMU should be started with the following additional options:

 **-virtfs local,path=/path/to/host/dir,id=sbuild-qemu,mount\_tag=sbuild-qemu,security\_model=none**

## TTY GEOMETRY

**sbuild-qemu-creates a file** */etc/profile.d/sbuild-qemu-terminal-settings.sh* within the VM. This file reads terminal column and row geometry passed on through from the host, and sets the geometry within the guest using [stty(1)](/stty/1.md).

## EXAMPLES

**$ sudo sbuild-qemu-create unstable http://deb.debian.org/debian**

This will create an image **unstable-autopkgtest-amd64.img** (assuming that the host architecture is amd64) with the unstable distribution.

**$ sudo sbuild-qemu-create bullseye-backports http://deb.debian.org/debian**

This will create an image **bullseye-backports-autopkgtest-amd64.img**, with *sources.list* entries for both bullseye and bullseye-backports.

**$ sudo sbuild-qemu-create --skel DIR unstable http://deb.debian.org/debian**

The files in **DIR** will be copied into /root (that is, root's $HOME). This can be used, for example, to copy an **.ssh/authorized\_keys** file, so that one can connect to the running image using SSH (assuming openssh-server is installed).

**$ sudo sbuild-qemu-create --install-packages openssh-server unstable http://deb.debian.org/debian**

This would install openssh-server. The package will be downloaded in the target environment using 'apt-get'.

A popular package to pre-install this way would be **debhelper**, as it is a build dependency of the vast majority of Debian packages.

**$ sudo sbuild-qemu-create --extra-deb FOO.deb unstable http://deb.debian.org/debian**

This would install the package **FOO.deb** from the local filesystem. Useful, for example, to install additional keyring packages.

## COPYRIGHT

Copyright © 2020-2022 Christian Kastner \<ckk@debian.org\>

## SEE ALSO

[**sbuild**(1)](/sbuild/1.md), [**sbuild-qemu**(1)](/sbuild-qemu/1.md), [**sbuild-qemu-update**(1)](/sbuild-qemu-update/1.md).
