Category:QEMU

From postmarketOS Wiki
(Redirected from QEMU)

It is possible to run postmarketOS installations inside a virtual machine with QEMU.

Usage

Install pmbootstrap and initialize it with one of the qemu devices. For each CPU architecture that is supported in postmarketOS, there is a separate qemu "device". As CPU emulation is slow, pick your native architecture (most likely qemu-amd64 or qemu-aarch64). The differences and what works for each architecture is listed on the device specific wiki pages (see the end of this category page for a full list). The wiki page you are reading here has information about everything that is in common for the QEMU device ports.

$ pmbootstrap init  # Choose device, e.g. "qemu-amd64"

Build an image and run QEMU:

$ pmbootstrap install
$ pmbootstrap qemu --image-size=2G

The --image-size=2G parameter will increase the image size to 2GB, so you don't instantly run out of space (by default the image size is as small as possible). Check out pmbootstrap qemu --help for more options. For example the default memory allocation is only 1024, which may not be enough for modern desktop environments.

Network

Qemu's user mode network stack is used. With all UIs except for none, postmarketOS should run a DHCP client on boot that automatically connects to QEMU's DNS server and as a result you should have network available. Note that ICMP (ping) may not work depending on your host (see QEMU's documentation for details).

If you selected none as user interface and don't have network, do one of the following:

a) Select the UI console instead. It is slightly bigger and will automatically start a DHCP client.

b) Use pmbootstrap install --add=networkmanager.

c) Run Alpine's setup tools in the TTY prompt to generate a /etc/network/interfaces file for ifupdown-ng and bring up eth0 manually:

$ sudo setup-interfaces
$ sudo ifup eth0

Audio

Audio is disabled by default. To enable audio, select an audio backend (usually pa for PulseAudio or alsa for ALSA), and pass:

$ pmbootstrap qemu --audio pa

Rootfs location

You could find the postmarketOS rootfs image at ~/.local/var/pmbootstrap/chroot_native/home/pmos/rootfs.

SSH

The default ssh port is 2222. You can access the running QEMU session by ssh -p 2222 user@localhost.

For file transfer, sftp can be used. The port needs to be passed by an uppercase P: sftp -P 2222 user@localhost.

See also