Installing Debian 12 on a PM or KVM VM

Last updated:02.04.2023

Warning: this page is in development!

Introduction

This page describes the procedure for installing Debian 12 on a physical machine (PM) or a KVM-based VM. The procedure is deliberately kept as short as possible, with most of the work being offloaded to PCMS. Other pages on this website explain how to configure server applications.

Prologue

  1. Prepare DNS entries.
  2. Perform a full backup! Yes, really.
  3. FIX DEV LINK: Prepare Debian 12 amd64 Netinst ISO image (any point version ok) on USB stick.
  4. An internet connection is required.
  5. Review this table of image and partition sizes:
    hardwareprofileimage size (GB)root filesystem size (GB)local filesystem size (GB)other partitionsunallocatednotes
    pmservern/a15200EFI, boot, 16GB swapvariablevirtualisation server
    pmdesktop/laptopn/a25250EFI, boot, 4GB swapvariablelocal for homes & pub
    vmserver2115-EFI, boot, 4GB swap~0.5GBnot virtualisation server
    vmdesktop/laptop36255EFI, boot, 4GB swap~0.5GBlocal for browser cache
    cnserver5n/an/an/an/aimage not partitioned

BIOS configuration

This section is for physical machines only.

  1. torchio, fiori:
    1. disable secure boot
    2. disable quickboot/fastboot
    3. disable Intel Smart Response Technology (SRT)
  2. ragu, sugo:
    1. press ESC (‘Startmenü’) and F10 (‘BIOS Setup’)
    2. Set Datei–>Standard-Setup–>Werkstinst. als Standard speichern
    3. Set Datei–>Standard übernehmen und schließen
    4. Press ESC and F10.
    5. Set Sicherheit–>Systemsicherheit–>Virtualisierungstechnologie: Aktiviert
    6. Set Erweitert–>Systemstart-Optionen–>POST-Meldungen: Aktiviert
    7. Set Erweitert–>Systemstart-Optionen–>POST Verzögerung: 5
  3. halusky:
    1. does not support UEFI

Creating the perfect VM

This section is for VMs only.

Features of this “perfect” VM are:

  1. libvirt-managed volume or DRBD volume
  2. use of UEFI firmware
  3. a graphical console capable of running X11 (provided by the mouse, keyboard, Spice-based display and QXL video)
  4. USB device redirection (allowing a VM to access USB devices attached to where virt-viewer is run from; provided by a suitable USB controller, USB redirector and one Spice channel per concurrently accesses USB device)
  5. a serial console, which is adequate for a typical server (provided by the serial interface)
  6. a lot of unwanted hardware is stripped
  7. Addition of CD-ROM in order to install from ISO images
  8. support for nested KVM-based VMs

The VM is created using scripts.

  1. If not done already then download the virttools module:
    mkdir -p ~/opt
    svn co https://svn.pasta.freemyip.com/main/virttools/trunk ~/opt/virttools
  2. Decide on the volume names: if the VM will have only one disk then <vol-name> should probably be <vm-name>. If the VM will have more than one disk then the <vol-name>s should probably be something like <vm-name>_<one-word-description> or alternatively <vm-name>_disk1, <vm-name>_disk2, etc.
  3. The page that led you here should have specified volume and VM creation commands; run them on one node of the virtualisation cluster now.
  4. Start the VM with:
    virsh start <container-name>
    
  5. Connect to its console.

Pre-partitioning

  1. Boot the media.
  2. halusky: leave the selector bar on ‘Graphical install’ and press <ENTER> (failure to do this will cause halusky to reboot or show only screen flicker).
  3. not halusky: move the selector bar to ‘Install’ (not ‘Graphical install’) and press <ENTER>.
  4. Accept all defaults except as noted below.
  5. At the ‘Configure the keyboard’ window:
    1. delguine:, when prompted ‘Keymap to use:’, select ‘British English’.
  6. THIS DID NOT HAPPEN YET … ONCE ALL HOSTS INSTALLED DELETE THIS: At the ‘Detect network hardware’ window:
    1. if prompted ‘Load missing firmware from removable media?’, select ‘No’.
  7. At the ‘Configure the network’ window:
    1. if prompted ‘Primary network inteface:’, select the primary network interface (probably the first one)
    2. if prompted ‘Hostname:’, enter the system’s hostname.
    3. if prompted ‘IP address:’, enter the system’s IP address, netmask, gateway and DNS server.
  8. At the ‘Set up users and passwords’ window:
    1. , when prompted ‘Root password:’, press <ESC> to get to the main menu and select ‘Configure the clock’ (i.e. skip the ‘Set up users and passwords’ step).
  9. At the ‘Partition disks’ window select ‘Manual’.
  10. Note that:
    1. partition sizes below are specified in bytes (see this article for an explanation)
    2. partitioning schemes described below are:
      1. halusky: “legacy”
      2. fiori, torchio: “virtualisation-raid0-lvm”
      3. pestaroli, testaroli: “virtualisation-raid0-zfs”
      4. <all-others>: “standard”
    3. the choice of partitioning scheme is independent of whether the system is a VM or not.

Partitioning scheme “legacy”

  1. Create a primary partition of size ‘1073741824B’ (i.e. 1024MiB)  at  the beginning of the first disk to be used for ext4 filesystem mounted on /boot.
  2. Create LV root on vg0 of size ‘26843545600B’ (i.e. 25GiB).
  3. Select ‘Finish’ to return to the Manual partitioner.
  4. Use LV root for ext4 filesystem mounted on /.
  5. Save the changes and when warned about the absence of a swap partition continue anyway.

Partitioning scheme “virtualisation-raid0-lvm”

  1. Create a primary partition of size ‘576716800B’ (i.e. 550MiB;)  at the beginning of the first disk to be used for EFI System Partition.
  2. Create a primary partition of the same size  at the beginning of the second disk not to be used.
  3. Create a primary partition of size ‘1073741824B’ (i.e. 1024MiB)  at  the beginning of the first disk to be used for ext4 filesystem mounted on /boot.
  4. Create a primary partition of the same size  at the beginning of the second disk not to be used.
  5. Create a primary partition using all remaining space on the first disk to be used for physical volume for RAID.
  6. Create a primary partition using all remaining space on the second disk to be used for physical volume for RAID.
  7. Select ‘Configure software RAID’, allow the partition manager to write the just-defined partitions to disk.
  8. When prompted ‘Software RAID configuration actions’, select ‘Create MD device’.
  9. When prompted ‘Software RAID device type:’, select ‘RAID0’.
  10. When prompted ‘Activate devices for the RAID0 array:’, select disks /dev/*da3 and /dev/*db3 and select ‘Continue’.
  11. When prompted ‘Write the changes to the storage devices and configure RAID?’, select ‘Yes’.
  12. When prompted ‘Software RAID configuration actions’, select ‘Finish’.
  13. Select the RAID0 device and use it for physical volume for LVM
  14. Select ‘Configure the Logical Volume Manager’, allow the partition manager to write the just-defined partitions to disk.
  15. Create VG vg0 on md0.
  16. Create LV root on vg0 of size ‘26843545600B’ (i.e. 25GiB).
  17. Select ‘Finish’ to return to the Manual partitioner.
  18. Use LV root for ext4 filesystem mounted on /.
  19. Save the changes and when warned about the absence of a swap partition continue anyway.

Partitioning scheme “virtualisation-raid0-zfs”

  1. Create a primary partition of size ‘576716800B’ (i.e. 550MiB;)  at the beginning of the first disk to be used for EFI System Partition.
  2. Create a primary partition of the same size  at the beginning of the second disk not to be used.
  3. Create a primary partition of size ‘1073741824B’ (i.e. 1024MiB)  at  the beginning of the first disk to be used for ext4 filesystem mounted on /boot.
  4. Create a primary partition of the same size  at the beginning of the second disk not to be used.
  5. Determine which is the larger: desired swap space or 4GB.
  6. Create a primary partition of size <desired-swap-in-bytes-or-4294967296>B at  the beginning of the first disk to be used for ext4 filesystem mounted on / (this will be repurposed as swap later).
  7. Create a primary partition of the same size  at the beginning of the second disk not to be used.
  8. Create a primary partition using all remaining space on the first disk not to be used (it will be repurposed for ZFS later but this can’t be specified at this point).
  9. Create a primary partition using all remaining space on the second disk not to be used (it will be repurposed for ZFS later but this can’t be specified at this point).
  10. Save the changes and when warned about the absence of a swap partition continue anyway.

Partitioning scheme “standard”

  1. Create a primary partition of size ‘576716800B’ (i.e. 550MiB;)  at the beginning of the first disk to be used for EFI System Partition.
  2. Create a primary partition of size ‘1073741824B’ (i.e. 1024MiB)  at  the beginning of the first disk to be used for ext4 filesystem mounted on /boot.
  3. Create a primary partition using all remaining space on the first disk to be use for physical volume for LVM.
  4. Select ‘Configure the Logical Volume Manager’, allow the partition manager to write the just-defined partitions to disk.
  5. Create a volume group with name ‘vg0 on the third partition.
  6. On a server: create LV ‘root’ on vg0 of size ‘16106127360B’ (i.e. 15GiB).
  7. On a deskop or laptop: create LV ‘root’ on vg0 of size ‘26843545600B’ (i.e. 25GiB).
  8. Select ‘Finish’ to return to the Manual partitioner.
  9. Use LV root for ext4 filesystem mounted on /.
  10. Save the changes and when warned about the absence of a swap partition continue anyway.

Post-partitioning

  1. At the ‘Software selection’ window:
    1. when prompted ‘Choose software to install:’, deselect everything.
  2. At the ‘Finish the installation’ window:
    1. press <ALT-F2>, activate the terminal by pressing <ENTER> and run:
      chroot /target
      passwd root           #  follow prompts to set password
      exit
      exit

      and then press <ALT-F1> to return to the installer.

  3. If installing a VM then, as the system reboots:
    1. power off
    2. change the boot order to boot from disk
    3. power on
  4. If you modified then kernel command line above (e.g. with nomodeset) then do the same as the system boots up again

Post-basic-OS-installation

  1. Log in as root.
  2. To better align PMs/VMs with containers, run:
    apt-get autoremove --purge tasksel-data emacsen-common isc-dhcp-common \
                               util-linux-locales
  3. If the “virtualisation-raid0-zfs” partitioning scheme was used then move the root filesystem to ZFS.
  4. Install and run PCMS.

      See also