KVM Kernel Virtualization Machine on Rocky Linux 9

Wiki.TerraBase.info
Revision as of 12:52, 25 December 2023 by Root (talk | contribs)
Jump to navigation Jump to search

...below are just rough notes from three different sources, including ChatGPT. They are ordered in each section as below from the following sources;

Check for VM Support in CPU;

  • cat /proc/cpuinfo | egrep "vmx|svm"
  • lscpu | grep Virtualization
  • No Comment

Install all the Stuff (for the first two sources there were duplicate items on multiple lines that were cleaned up, oops, no proof reading on their part, huh, just a copy and paste);

  • dnf install qemu-kvm virt-manager libvirt virt-install virt-viewer libguestfs-tools bridge-utils virt-top
  • dnf install qemu-kvm virt-manager libvirt virt-install virt-viewer libguestfs-tools bridge-utils virt-top
  • dnf install qemu-kvm libvirt virt-install virt-manager AND apparently installing virt-manager again (just to make sure)

NOTES: And of course there are about a hundred or so other dependencies that are downloaded and installed too.

ISSUES: bridge-utils virt-top might give issues if attempting to install at the same time, so try installing separately.

Check Installation;

  • lsmod | grep kvm
  • lsmod | grep kvm
  • lsmod | grep kvm AND virsh list --all

Start AND Enable Automatic Starting of the "KVM" Services AND see if they're actually running;

  • sudo systemctl start libvirtd AND systemctl enable --now libvirtd AND systemctl status libvirtd
  • sudo systemctl start libvirtd AND sudo systemctl enable libvirtd AND systemctl status libvirtd
  • sudo systemctl start libvirtd AND sudo systemctl enable libvirtd AND No Comment

Permissions and User Related Stuff;

  • No Comment
  • usermod -aG libvirt $USER AND newgrp libvirt
  • usermod -aG libvirt $(whoami)

Network Connectivity, don't forget that;

...and now comes the part where the above noted references show their true colors. IE, the content in the articles on those websites was not created by the people who own those websites. It was aggregated from other websites and put into a format that Google likes. And does it ever show on the Networking aspect of what they document. In short, ignore it. You'll hose your system if you do what is written. Go ahead and try it (no, don't really do that).

The first issue is with the destruction of a perfectly network interface. The second issue is with the creation of a Bridge Interface that was already created as part of the installation process of QEMU / KVM. Keeping in mind this article here was written based on Rocky Linux 9 and the iteration of QEMU / KVM as of late 2023. Earlier versions may have required the creation of a Bridge Interface.

Tricks, Tips, and Other Useful Information (all of which applies to Rocky Linux 9, and others based on Red Hat)

  • Rocky Linux 9 Network Configuration Files Directory: /etc/Network/Manager/system-connections (NOT /etc/sysconfig/network-scripts)
  • QEMU / KVM Configuration Files: /etc/libvirt/qemu/
    • Heed the warning notes on some of these files as they should not be edited directly. Although a workaround is to edit the files directly, then restart the libvirtd.service (systemctl restart libvirtd.service)
    • virsh net-edit default (it uses the VI editor)
      • VI Editor
        • i = Insert (AKA Edit) Mode
        • ESC = Command Mode
        •  : (Colon) = "Beginning of Command"
        • w = Write (as in :w)
        • x = Exit / Quit and Save (AKA Write) (as in :x)
        • q = Quit (AKA Exit)
  • QEMU / KVM Additional Bridge Configuration: /etc/qemu-kvm/
  • Documentation from QEMU / KVM on Bridges and Networking: https://libvirt.org/formatnetwork.html
  • All, or most of the documentation for Rocky Linux 9 that steers one towards /etc/udev/rules.d is now located in /lib/udev/rules.d
  • Network Remapping End Result(s) (IE, if you want to see how the "Predictable Network Interface Naming" decided on how things were to be done: /sys/class/net
    • In short, here's how it goes with Rocky Linux 9 mapping a physical Network Adapter to a configuration file;
      • Physical Network Adapter (represented by files located in /sys/devices and below / down)
      • Calculations done in the name of "Predictable Network Interface Naming", whose 'scripts' are located in /lib/udev/rules.d/80-net-setu-link.rules and whose result(s) are located in the Symbolic Links located in /sys/class/net (which in turn point to 'device files' in /sys/devices)
      • Configuration File (in /etc/NetworkManger)
      • ⇌ ⇌ ⇌ ⇌ ⇌ ⇌