QEMU/KVM: KVM/CPU host, 2-4 GiB, 32 GiB disk, BIOS and UEFI (OVMF with a writable variable store), AHCI for UEFI because OVMF's IDE is slow, the serial console (com0) and the device names the installer shows (ld0, sd0, wd0). Proxmox VE: q35/OVMF or i440fx/SeaBIOS, VirtIO SCSI, the qm create example, boot order, serial socket and the noVNC focus note. The installation chapter points to it. Rebuilt 28 manual pages and the 73-page PDF with page numbers and the chapter outline; www/guide.html updated. The print stylesheet wraps long commands instead of clipping them.
268 lines
13 KiB
XML
268 lines
13 KiB
XML
<!-- License: CNCL 1.0 (Could Not Care Less), see LICENSE at the top of the tree. -->
|
|
<chapter id="vm">
|
|
<title>Installing in a Virtual Machine</title>
|
|
|
|
<para>A virtual machine is the cheapest way to try Makronix: no disk is
|
|
overwritten, a snapshot is one command away, and the same installer runs as
|
|
on real hardware. This chapter gives the settings that matter for QEMU with
|
|
KVM and for Proxmox VE. The values are starting points; the installer is
|
|
the same as on a physical machine (<xref linkend="install"/>).</para>
|
|
|
|
<sect1 id="vm-needs">
|
|
<title>What the VM needs</title>
|
|
|
|
<itemizedlist>
|
|
<listitem><para><emphasis>KVM.</emphasis> A virtual machine without
|
|
hardware acceleration (QEMU's TCG) installs, but slowly. On Linux,
|
|
<filename>/dev/kvm</filename> must exist and your user must be allowed
|
|
to use it; on Proxmox VE, KVM is the default.</para></listitem>
|
|
<listitem><para><emphasis>Memory.</emphasis> 2 GiB installs the system
|
|
and runs the text console; 4 GiB make the MCDE desktop comfortable.
|
|
8 GiB are useful only if the guest runs a browser or another VM.</para></listitem>
|
|
<listitem><para><emphasis>Disk.</emphasis> 32 GiB is a comfortable
|
|
size for the system, the desktop and a few packages. The source set
|
|
needs considerably more; <xref linkend="building"/> explains
|
|
it.</para></listitem>
|
|
<listitem><para><emphasis>Firmware.</emphasis> UEFI (OVMF) or BIOS.
|
|
UEFI is the modern choice; the installer and the boot loader handle
|
|
both. For UEFI, give the VM a writable variable store, not only the
|
|
read-only firmware image.</para></listitem>
|
|
<listitem><para><emphasis>Disk and network devices.</emphasis> VirtIO
|
|
is the fast choice. The installer sees a VirtIO block disk as
|
|
<filename>ld0</filename>, a SCSI or AHCI disk as
|
|
<filename>sd0</filename>, and an IDE disk as
|
|
<filename>wd0</filename>.</para></listitem>
|
|
<listitem><para><emphasis>A display for the desktop.</emphasis> The
|
|
graphical installer and <command>dtlogin</command> need a VGA device.
|
|
<literal>std</literal> is the safe emulation; a serial console is
|
|
enough for a headless installation.</para></listitem>
|
|
</itemizedlist>
|
|
</sect1>
|
|
|
|
<sect1 id="vm-qemu">
|
|
<title>QEMU and KVM</title>
|
|
|
|
<para>Create a disk image first. <command>qemu-img</command> makes a
|
|
sparse qcow2 file; it grows as the installation writes to it.</para>
|
|
|
|
<screen>qemu-img create -f qcow2 makronix.qcow2 32G</screen>
|
|
|
|
<para>The following command starts a BIOS machine with 4 GiB of memory,
|
|
four CPUs, an IDE disk, the DVD image, user-mode networking with SSH
|
|
forwarded to port 2222, and a graphical window:</para>
|
|
|
|
<screen>qemu-system-x86_64 -enable-kvm -cpu host -smp 4 -m 4G \
|
|
-drive file=makronix.qcow2,if=ide,format=qcow2 \
|
|
-drive file=Makronix-0.99.10-amd64-dvd.iso,media=cdrom,readonly=on \
|
|
-boot order=dc \
|
|
-nic user,model=e1000, \
|
|
hostfwd=tcp:127.0.0.1:2222-:22 \
|
|
-vga std -display gtk</screen>
|
|
|
|
<para>If <filename>/dev/kvm</filename> is not available, remove
|
|
<literal>-enable-kvm -cpu host</literal> and add
|
|
<literal>-cpu max</literal>; the installation then runs in emulation and
|
|
takes much longer. Replace <literal>-display gtk</literal> with
|
|
<literal>-display none -serial mon:stdio</literal> for a console-only
|
|
machine; the install media talks on <filename>com0</filename>, as
|
|
<xref linkend="vm-qemu-serial"/> explains.</para>
|
|
|
|
<sect2 id="vm-qemu-uefi">
|
|
<title>UEFI</title>
|
|
|
|
<para>UEFI needs the OVMF firmware and a writable copy of its variable
|
|
store. The paths differ between distributions; these are the Debian
|
|
and Ubuntu names:</para>
|
|
|
|
<screen>cp /usr/share/OVMF/OVMF_VARS_4M.fd OVMF_VARS.fd
|
|
qemu-system-x86_64 -enable-kvm -cpu host -smp 4 -m 4G \
|
|
-machine q35 \
|
|
-drive if=pflash,format=raw,readonly=on, \
|
|
file=/usr/share/OVMF/OVMF_CODE_4M.fd \
|
|
-drive if=pflash,format=raw,file=OVMF_VARS.fd \
|
|
-device ich9-ahci,id=ahci \
|
|
-drive file=makronix.qcow2,if=none,id=hd0,format=qcow2 \
|
|
-device ide-hd,drive=hd0,bus=ahci.0 \
|
|
-drive file=Makronix-0.99.10-amd64-dvd.iso,media=cdrom,readonly=on, \
|
|
if=none,id=cd0 \
|
|
-device ide-cd,drive=cd0,bus=ahci.1 \
|
|
-boot order=dc \
|
|
-nic user,model=e1000, \
|
|
hostfwd=tcp:127.0.0.1:2222-:22 \
|
|
-vga std -display gtk</screen>
|
|
|
|
<para>The AHCI controller is deliberate. OVMF's IDE driver reads a CD
|
|
or a disk so slowly that the boot loader can need minutes for the
|
|
kernel; the tree's own test machines put the disk and the CD on AHCI
|
|
when UEFI is used (<filename>tools/vmsh.sh</filename>).</para>
|
|
</sect2>
|
|
|
|
<sect2 id="vm-qemu-serial">
|
|
<title>A serial console</title>
|
|
|
|
<para>The installer's boot configuration uses
|
|
<filename>com0</filename> at 115200 baud, so a headless machine can be
|
|
installed from a terminal. Run QEMU with the serial line on the
|
|
terminal and no display:</para>
|
|
|
|
<screen>qemu-system-x86_64 -enable-kvm -cpu host -smp 4 -m 4G \
|
|
-drive file=makronix.qcow2,if=ide,format=qcow2 \
|
|
-drive file=Makronix-0.99.10-amd64-dvd.iso,media=cdrom,readonly=on \
|
|
-boot order=dc -display none -serial mon:stdio</screen>
|
|
|
|
<para><literal>Ctrl-A C</literal> switches between the guest console
|
|
and the QEMU monitor; <literal>Ctrl-A X</literal> stops the machine.
|
|
After the installation, boot the disk with <literal>-boot order=c</literal>
|
|
and leave the CD out.</para>
|
|
</sect2>
|
|
|
|
<sect2 id="vm-qemu-disks">
|
|
<title>Which disk the installer shows</title>
|
|
|
|
<para>In the installer's disk menu, the device name tells you which
|
|
bus the disk is on:</para>
|
|
|
|
<itemizedlist>
|
|
<listitem><para><filename>ld0</filename> — a VirtIO block
|
|
device (<literal>if=virtio</literal>). The fastest choice for a
|
|
Linux KVM host.</para></listitem>
|
|
<listitem><para><filename>sd0</filename> — SCSI, AHCI or a
|
|
VirtIO SCSI controller (the Proxmox default).</para></listitem>
|
|
<listitem><para><filename>wd0</filename> — the emulated IDE
|
|
controller (<literal>if=ide</literal>), which is the simplest but the
|
|
slowest.</para></listitem>
|
|
</itemizedlist>
|
|
|
|
<para>After the reboot, remove the CD from the command line (or set
|
|
<literal>-boot order=c</literal>). The installed system starts from
|
|
the disk. The network is <filename>vioif0</filename> for VirtIO and
|
|
<filename>wm0</filename> or <filename>re0</filename> for the emulated
|
|
cards; the installer's DHCP client configures it either way.</para>
|
|
</sect2>
|
|
</sect1>
|
|
|
|
<sect1 id="vm-proxmox">
|
|
<title>Proxmox VE</title>
|
|
|
|
<para>Proxmox VE runs QEMU with KVM and adds its own storage, snapshots
|
|
and a web console. A Makronix VM is an <quote>Other</quote> guest; the
|
|
settings that matter are the machine type, the firmware, the disk bus and
|
|
the display.</para>
|
|
|
|
<para>In the web interface, create a VM with these values:</para>
|
|
|
|
<itemizedlist>
|
|
<listitem><para><guilabel>OS</guilabel>: the DVD image
|
|
<filename>Makronix-0.99.10-amd64-dvd.iso</filename> as the CD/DVD, guest
|
|
type <quote>Other</quote>.</para></listitem>
|
|
<listitem><para><guilabel>System</guilabel>: machine <literal>q35</literal>,
|
|
BIOS <literal>OVMF (UEFI)</literal>, an EFI disk, Secure Boot off. For
|
|
a BIOS VM use machine <literal>i440fx</literal> and SeaBIOS
|
|
instead.</para></listitem>
|
|
<listitem><para><guilabel>Disks</guilabel>: SCSI controller
|
|
<literal>VirtIO SCSI</literal>, 32 GiB. The guest sees it as
|
|
<filename>sd0</filename>.</para></listitem>
|
|
<listitem><para><guilabel>CPU</guilabel>: type <literal>host</literal>,
|
|
4 cores. On a cluster with mixed CPUs, a named model such as
|
|
<literal>x86-64-v2-AES</literal> is needed for migration; it is slower
|
|
but portable.</para></listitem>
|
|
<listitem><para><guilabel>Memory</guilabel>: 4096 MiB (2048 is the
|
|
minimum for a text installation).</para></listitem>
|
|
<listitem><para><guilabel>Network</guilabel>: model
|
|
<literal>VirtIO</literal>, bridge <literal>vmbr0</literal>, firewall as
|
|
your network needs it.</para></listitem>
|
|
<listitem><para><guilabel>Display</guilabel>: <literal>std</literal>,
|
|
and a serial port if you want the text console.</para></listitem>
|
|
<listitem><para><guilabel>Boot order</guilabel>: CD/DVD first, the
|
|
SCSI disk second.</para></listitem>
|
|
</itemizedlist>
|
|
|
|
<para>The same VM from the command line:</para>
|
|
|
|
<screen>qm create 100 --name makronix --ostype other --machine q35 --bios ovmf \
|
|
--efidisk0 local-lvm:1,efitype=4m,pre-enrolled-keys=0 \
|
|
--cpu host --cores 4 --memory 4096 --scsihw virtio-scsi-pci \
|
|
--scsi0 local-lvm:32 \
|
|
--ide2 local:iso/Makronix-0.99.10-amd64-dvd.iso,media=cdrom \
|
|
--boot 'order=ide2;scsi0' --net0 virtio,bridge=vmbr0 \
|
|
--vga std --serial0 socket
|
|
qm start 100</screen>
|
|
|
|
<para><filename>local-lvm</filename> and <filename>local</filename> are
|
|
the storage names of your Proxmox installation; replace them with the
|
|
names in <guilabel>Datacenter > Storage</guilabel>. For a BIOS VM,
|
|
omit <literal>--bios ovmf</literal> and <literal>--efidisk0</literal>, use
|
|
<literal>--machine i440fx</literal>, and keep the same
|
|
<literal>--boot</literal> order.</para>
|
|
|
|
<para>Open the console with <guilabel>Console</guilabel> (noVNC) for the
|
|
graphical installer, or <command>qm terminal 100</command> for the serial
|
|
one. If the web console shows the installer but the keyboard does not
|
|
work, click inside the console once; Proxmox forwards the keyboard only
|
|
after the console has the focus.</para>
|
|
|
|
<para>When the installation is finished, detach the ISO and boot the
|
|
disk:</para>
|
|
|
|
<screen>qm set 100 --boot order=scsi0
|
|
qm set 100 --delete ide2</screen>
|
|
|
|
<para><emphasis>Agent and cloud-init:</emphasis> leave the QEMU guest
|
|
agent off unless you install it in the guest; Makronix does not ship it.
|
|
Proxmox's snapshots and backups work at the block level without it. For
|
|
a consistent backup of a running guest, stop it first or use the guest's
|
|
own backup; a block snapshot of a mounted file system is not a
|
|
transactional backup.</para>
|
|
</sect1>
|
|
|
|
<sect1 id="vm-after">
|
|
<title>After the installation</title>
|
|
|
|
<para>The first boot is the same as on a physical machine: the MCDE login
|
|
screen, the account you created, and the network the installer
|
|
configured. In QEMU's user-mode network, the host reaches the guest's
|
|
SSH server through the forwarded port:</para>
|
|
|
|
<screen>ssh -p 2222 user@127.0.0.1</screen>
|
|
|
|
<para>In Proxmox, the guest is on the bridge and gets an address from the
|
|
network's DHCP server, or the fixed address you configure in the
|
|
installer. The serial console remains available with
|
|
<command>qm terminal 100</command>; log out of it with
|
|
<literal>Ctrl-O</literal>.</para>
|
|
|
|
<para>An encrypted installation works in a VM exactly as on hardware: the
|
|
installer asks for the passphrase, and every boot asks for it again. A
|
|
Proxmox snapshot of an encrypted guest is a snapshot of the encrypted
|
|
blocks; the passphrase is still needed to start it.</para>
|
|
</sect1>
|
|
|
|
<sect1 id="vm-trouble">
|
|
<title>When the VM does not cooperate</title>
|
|
|
|
<itemizedlist>
|
|
<listitem><para><emphasis>The VM starts but the installer does not
|
|
appear.</emphasis> Check the boot order (CD before disk), and give the
|
|
firmware a moment: OVMF scans its devices before it reads the CD. With
|
|
UEFI, make sure the writable variable store is attached; a read-only
|
|
OVMF image cannot keep the boot entries.</para></listitem>
|
|
<listitem><para><emphasis>UEFI is very slow.</emphasis> Move the disk
|
|
and the CD to AHCI (<literal>ich9-ahci</literal> in QEMU, VirtIO SCSI in
|
|
Proxmox). OVMF's IDE driver is the usual cause.</para></listitem>
|
|
<listitem><para><emphasis>The desktop does not start.</emphasis> The
|
|
installer may have completed on a serial console with no VGA device.
|
|
Add <literal>-vga std</literal> (QEMU) or <literal>vga: std</literal>
|
|
(Proxmox), start the graphical installer, and use the full installation
|
|
way if the simple way cannot detect the display.</para></listitem>
|
|
<listitem><para><emphasis>No network.</emphasis> QEMU's user-mode
|
|
network is NAT: the guest can reach out, and the host reaches the guest
|
|
only through a forwarded port. A bridged Proxmox VM behaves like a
|
|
machine on the LAN; check the bridge and the firewall.</para></listitem>
|
|
<listitem><para><emphasis>The keyboard is wrong.</emphasis> The
|
|
installer asks for the keyboard layout; the MCDE session has its own
|
|
setting. A VM console that sends the wrong keys is usually a host
|
|
layout problem, not a guest one.</para></listitem>
|
|
</itemizedlist>
|
|
</sect1>
|
|
</chapter>
|