The real phone version of Linux, postmarketOS, can already be installed on many older Android phones and give them something useful to do again. postmarketOS is a mobile Linux distribution based on Alpine Linux. It can run applications, including docker. Linux apps designed specifically for phones are also slowly appearing.
See here to learn how to install postmarketOS.
If your phone cannot flash postmarketOS, why not try it in a virtual machine on your computer? With a QEMU/KVM virtual machine, we can experience the current state of phone Linux interfaces. If you need to test apps for phone Linux, this VM is useful too.
postmarketOS officially provides a Generic x86_64 EFI System image, which can be installed on a normal x86 computer like other desktop GNU/Linux systems. However, postmarketOS is based on Alpine Linux, and the package repositories are mostly shared. So if you want to install it as your main desktop system, you might as well install Alpine Linux directly.
The main goal of this article is to set up a development and testing environment so you can see what postmarketOS looks like. Note: virtual machines have a hard time providing graphics acceleration, so Wayland desktop environments may render with bugs.
Below are two ways to install a postmarketOS virtual machine.
1. Install a QEMU Virtual Machine with pmbootstrap#
Use pmbootstrap to customize your desktop environment. This method is suitable for developers.
pmbootstrap is the toolchain used to generate postmarketOS installation files and port new device models. Because pmbootstrap creates a chroot environment, the computer must be running Linux. A virtual machine is fine. WSL is not.
- In this example, the host computer is Ubuntu. Install pmbootstrap with git:
git clone https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
cd pmbootstrap
mkdir -p ~/.local/bin
ln -s "$PWD/pmbootstrap.py" ~/.local/bin/pmbootstrap
pmbootstrap --version- Enter the following command to start configuration:
pmbootstrap init- Next, answer a series of questions. The steps are explained below.
# Initialize.
pmbootstrap init
# Press Enter to use the default work directory (~/.local/var/pmbootstrap)
Work path: Enter
# For the update channel, choose edge, or enter the stable release marked Recommended for best stability.
Channel: edge
# Choose the vendor. Enter QEMU here.
Vendor: qemu
# Choose the AMD64 version. AARCH64 cross-architecture emulation is very slow and cannot use KVM acceleration.
Device codename: amd64
# Create the pmOS user account.
Username: User
# Choose the desktop environment. Phosh, which only supports Wayland, may fail to start, so choose Plasma Mobile or GNOME.
User Interface: plasma-mobile
# Press Enter for everything else.- Then install the system:
pmbootstrap install- Now boot it. pmbootstrap’s default RAM allocation is too small and will be painfully sluggish, so I recommend booting with the following command. It uses the host CPU, allocates 4GB of memory, sets the disk size to 32GB, emulates a phone portrait display, and enables audio. Enter
pmbootstrap --helpto view the available options.
pmbootstrap qemu --cpu max --memory 4096 --image-size 32G --video 720x1080 --audio pa- After booting, you can log into the system from the terminal opened by QEMU, or log in with SSH:
ssh user@VM_IP -p 2222- After booting, the VM window should enter the desktop. Resizing the window changes the display size automatically. The QEMU VM also grabs keyboard and mouse input automatically.
In this example, I chose Plasma Mobile as the interface. Its UI scales with the window. It descends from KDE Plasma, but has become an interface optimized for phones.

After installing the Discover software store, it can act as a frontend for downloading software. App sources are the postmarketOS and Alpine Linux repositories.

A terminal is still mandatory. Recommended packages: chromium, font-noto-cjk, and docker. You can use this to evaluate docker performance on postmarketOS.

Some software just feels like the desktop version. Some software automatically reshapes its UI according to the window size.
The files remain after this VM shuts down, but every time you run pmbootstrap init, the system automatically deletes the old filesystem. Remember to back up the QEMU image under ~/.local/var/pmbootstrap/chroot_native/home/pmos/rootfs/.
2. Manually Install a postmarketOS VM with Virt Manager#
Boot the system with the official prebuilt postmarketOS image. This does not require pmbootstrap.
This method is a bit tedious because postmarketOS does not officially provide an .iso image. It provides an .img file instead, so you have to write it manually with dd. (Note: there is now an os-installer image, but it is mainly intended for installing on real hardware.)
Install Virt Manager on Linux.
Go to the postmarketOS website and download the
Generic x86_64 EFI Systemimage. For example, I chose the Phosh version.After downloading, extract the
.xzfile. You will get an.imgfile.Open Virt Manager and create a new virtual machine. Select Alpine Linux as the system. Choose UEFI for the boot firmware, VGA for the display card, and add a qcow2 virtual disk of at least 64GB. Do not boot it yet.
Before booting, mount the qcow2 file as an NBD device:
sudo modprobe nbd max_part=10
sudo qemu-nbd -c /dev/nbd0 /var/lib/libvirt/images/postmarketos.qcow2- Use
ddto write the postmarketOS image, then remove the NBD device:
sudo dd if=postmarketos-phosh.img of=/dev/nbd0 bs=4M status=progress conv=fsync
sudo qemu-nbd -d /dev/nbd0- Return to Virt Manager, boot the VM, and you can use the system.


