Virtual Machine

From Maemo Leste Wiki
Revision as of 18:49, 2 March 2020 by Wizzup (talk | contribs)
Jump to navigationJump to search

This page or section is a stub. Ask how you can help improve by visiting #maemo-leste, look at the bugtracker ( or if you are able to contribute to the current page, then you are welcome to do so.

Virtual Machine
Manufacturer Generic
Hardware Features
Software Features

Generic virtual machine target. This is particularly useful when doing development and testing.


There are three different types of images: VirtualBox (.box), QEMU (.qcow2, .vdi) and Vagrant. The VirtualBox image may be converted to a VMware VMDK image which has been reported to perform better and have good hardware acceleration. Converting the qcow2 image to raw allows it to be used on real hardware.


Download latest .vdi.xz image, unpack it with "xz -d" command. Create new Virtual Machine, select "Debian (64-bit)" and 1024MB RAM. Use the downloaded file as virtual hard disk. You are done!


In general something like

 qemu-system-x86_64 -hda maemo-leste-1.0-amd64.qcow2 -enable-kvm -cpu host -smp cores=2 -m 1024

should work. But there seem to be issues with some QEMU versions, for more details see issue#198.

To set up a port forward for SSH, add:

 -nic user,hostfwd=tcp:

And then log in like this (password: toor):

 ssh root@localhost -p 7722

Real hardware

The contents of the qcow2 file can be extracted and copied into hard drives for bare metal BIOS/Legacy CSM booting.

To extract the contents of the qcow2 file, decompress it first and convert it into raw format.

$ xz -d maemo-leste-1.0-amd64-virtual-20180425.qcow2.xz
$ qemu-img convert -f qcow2 -O raw maemo-leste-1.0-amd64-virtual-20180425.qcow2 maemo-leste-1.0-amd64-virtual-20180425.raw

The raw image that it yields, can then be setup as a loopback device, and its partitions mounted.

# losetup --partscan -f maemo-leste-1.0-amd64-virtual-20180425.raw
# mkdir /mnt/maemo-virt
# mount /dev/loop0p1 /mnt/maemo-virt

Setup one Linux partition on the device to be used for booting, format it with a GRUB-compatible filesystem (ext4, for example), then mount it as well.

# cfdisk /dev/sdb
# ...
# mkfs.ext4 /dev/sdb1
# mkdir /mnt/maemo-bare
# mount /dev/sdb1 /mnt/maemo-bare

Change directory to the loop partition, the copy over its contents into the bare metal partition.

# cd /mnt/maemo-virt
# rsync -aAHXv * /mnt/maemo-bare

Once finished copying, bind mount special filesystems into the bare metal Maemo partition, then change root.

# mount --bind /dev /mnt/maemo-bare/dev
# mount --bind /proc /mnt/maemo-bare/proc
# mount --bind /sys /mnt/maemo-bare/sys
# chroot /mnt/maemo-bare /bin/bash

Load the new root's shell profile, install GRUB to the bare metal boot device (/dev/sdb, in this example), then regenerate the GRUB configuration file.

# . /etc/profile
# grub-install /dev/sdb
# grub-mkconfig -o /boot/grub/grub.cfg

After that, you may exit the chroot environment (Ctrl+D), unmount all the filesystems, then reboot the system into your new bare metal Maemo Leste installation.

# umount /mnt/maemo-virt
# umount -AR /mnt/maemo-bare
# reboot

Initial configuration

On the first run you may want to generate ssh host keys and set the timezone. To do so open the "X Terminal" application and run:

sudo su -
dpkg-reconfigure openssh-server
dpkg-reconfigure tzdata

Make the system up-to-date:

apt update
apt upgrade
apt install linux-image-amd64

To get networking to work (at least in virtualbox), launch a shell and do

sudo ifconfig eth0 up
sudo dhclient eth0