I am playing with QEMU. Here I found some prebuilt OS images:
http://docs.openstack.org/trunk/openstack-compute/admin/content/starting-images.html
But they are all meant for a 64-bit system while my system is 32 bit. Does anyone know if there is any 32-bit prebuilt image online?
So I can directly use them and not need to bother with the installation.
Thanks.
This answer contains detailed steps for the following setups:
All was tested on an Ubuntu 18.04 host targeting 18.04 guests.
Cloud image amd64
The Ubuntu cloud images are pre-installed images that allow your to boot directly without doing the usual desktop system installation. See also: https://serverfault.com/questions/438611/what-are-ubuntu-cloud-images
GitHub upstream.
After QEMU starts, you might have to hit enter for the boot menu to show. Select
Ubuntu
from there.Then, the beginning of boot says:
but even if you don't press any key, boot continues after a short timeout. Go upvote this bug report: https://bugs.launchpad.net/cloud-images/+bug/1726476
Once boot finishes, login with:
ubuntu
asdfqwer
Internet works normally.
Cloud image arm64
TODO: I noticed that there is a bug that happens sometimes when using this: https://bugs.launchpad.net/cloud-images/+bug/1818197
Very similar to amd64, but we need some UEFI black magic for it to boot.
GitHub upstream.
debootstrap
amd64Not a pre-made image, but it downloads all pre-built packages, so it is also fast, but also much more configurable and useful.
GitHub upstream.
This boots without any systemd errors or warnings.
Now from the terminal, login with
root
/root
, and then check that the Internet works with the following commands:We used
nc
as explained at https://stackoverflow.com/questions/32341518/how-to-make-an-http-get-request-manually-with-netcat/52662497#52662497 because:wget
andcurl
are not installed by defaultping
does not work from QEMU by default: https://unix.stackexchange.com/questions/473448/how-to-ping-from-the-qemu-guest-to-an-external-urlAnalogous Debian version: https://unix.stackexchange.com/questions/275429/creating-bootable-debian-image-with-debootstrap/473256#473256
Build your own kernel
Since we are here:
This produced the exact same config and I believe used the exact same source code as the packaged Ubuntu that
debootstrap
downloaded as explained at: Where can I get the 11.04 kernel .config file?Then I patched it with:
and rebuild:
and it did print my message during boot:
The rebuild was not very fast though, so maybe there is a better command? I just waited for it to say:
and went ahead with the run.
debootstrap arm64
The procedure was similar to the amd64 one, but with the following differences:
1)
We must do a two stage
debootstrap
:--foreign
to just download the packageschroot
--second-stage
using QEMU user mode emulation +binfmt_misc
See also: What is debootstrap --second-stage for
the default kernel boot fails at the end with:
[ 0.773665] Please append a correct "root=" boot option; here are the available partitions: [ 0.774033] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
The empty partition list indicates that there is a serious error with the disk driver, after a bit of trying the missing option is:
I think it works when I use the ISO because the modules must get loaded from the initrd.
I tried to use other disk types, but virtio is the only valid value for
-drive if=
when-M virt
, which is the saner machine type nowadays.Therefore we must recompile our own kernel with that option enabled, as explained here: When cross-compiling the kernel, how can I stop it making from clean every time when I just want to modify one file?
Ubuntu devs should turn this CONFIG
y
by default! It is very useful!TODO: the network is not working, the error message is:
Here is the fully automated script:
GitHub Upstream.
Desktop image
See: How to run Ubuntu desktop on QEMU?
It does require going through the installer manually, but it is the most stable thing you can possibly do, and totally fine if you just want to get a VM for interactive use running from time to time.
For aarch64, I haven't gotten the desktop working yet maybe keep an eye out for: How to run Ubuntu 16.04 ARM in QEMU?
Debian aarch64
https://gist.github.com/philipz/04a9a165f8ce561f7ddd and change
sudo mount /dev/nbd0p2
tonbd0p1
.A quick Google search revealed the following (I have not tried any of them):
Also, you can use vmbuilder(referred here as
ubuntu-vmbuilder
) to quickly create Ubuntu images to KVM, VirtualBox, etc.As a last resort, you can use
qemu-img
command to convert disk images from VirtualBox/VMware to a format more suited to QEMU/KVM (this may not be needed: I think QEMU/KVM can work with other image types like vdi or vmdk).NOTE: If you are using a 32bit OS you cannot run 64bit virtual machines with KVM. But QEMU is an emulator, so it should let you run 64bit vm's on a 32bit operating system. But the performance overhead will probably be huge!
Refer to http://cloud-images.ubuntu.com/ which contains cloud images which can be used with qemu/kvm.
https://www.turnkeylinux.org/ has been around for ages. They have a huge catalog downloadable, premade "appliance" like images in numerous formats (ova, iso, vdmk, openstack, xen). They even can launch an image right in AWS for you.
When I want to start exploring a particular stack or need to knock out a problem, I frequently will download on of their images, convert it to a cow2 and use it.
You can also grab images from https://app.vagrantup.com/boxes/search or https://virtualboxes.org/images/ and convert them as well.