My Complete virtman libvirt setup  [Solved]

Message
Author
User avatar
korilius
Posts: 83
Joined: Sat Oct 15, 2022 9:31 pm

My Complete virtman libvirt setup

#1 Post by korilius »

I had some problems the last time I set up virtman. I was on another Debian based system. When I blew Ubuntu away on this rig with 23.6, I copy/pasted these instructions and everything is working without a hitch and no pesky SPICE errors. Thought I'd share. It works for me. Do your research and use at your own risk.

Virtualization Management Setup (Debian 12 / Ubuntu 22+)

Table of Contents
  • Prerequisites
    Installation
    Groups & Services
    Default Network Enable[
    Spice Console Fix
    QEMU-img Support
    Storage Pool Setup
    .desktop Wrapper (Conditional)
    Remote Host Management
Prerequisites
  • []Debian 12 or Ubuntu 22+
    []Root or sudo access
  • VM host with ≥ 2 GB RAM
Installation

Code: Select all

sudo apt update
sudo apt install --yes virt-manager libvirt-daemon-system libvirt-clients qemu-kvm qemu-utils bridge-utils gir1.2-spiceclientgtk-3.0 virt-viewer
Groups & Services

Code: Select all

sudo usermod -aG libvirt,kvm $(whoami)
sudo systemctl enable --now libvirtd
Default Network Enable

Code: Select all

sudo virsh net-start default
sudo virsh net-autostart default
Spice Console Fix
Reinstall GTK bindings:

Code: Select all

sudo apt install --reinstall gir1.2-spiceclientgtk-3.0
QEMU-img Support
Ensure non-raw formats (e.g.,

Code: Select all

qcow2
) can be created:

Code: Select all

sudo apt install --yes qemu-utils
sudo systemctl restart libvirtd
Storage Pool Setup (Example only: replace device paths and mount points with your own setup)
  • []Format & mount:

    Code: Select all

    sudo mkfs.ext4 /dev/sdb1
    sudo mkdir -p /mnt/vm-disks /mnt/vm-isos
    echo '/dev/sdb1 /mnt/vm-disks ext4 defaults 0 2' | sudo tee -a /etc/fstab
    sudo mount -a
    
    []Define pools:

    Code: Select all

    sudo virsh pool-define-as vm-disks dir --target /mnt/vm-disks
    sudo virsh pool-define-as vm-isos  dir --target /mnt/vm-isos
    sudo virsh pool-build vm-disks vm-isos
    sudo virsh pool-start vm-disks vm-isos
    sudo virsh pool-autostart vm-disks vm-isos
    
.desktop Wrapper (Conditional)
If GUI-launched consoles still fail:

Code: Select all

cat <<'EOF' | sudo tee /usr/share/applications/virt-manager.desktop
[Desktop Entry]
Type=Application
Name=Virtual Machine Manager
Exec=env XAUTHORITY=$HOME/.Xauthority virt-manager
Icon=virt-manager
Terminal=false
Categories=System;
EOF
Remote Host Management

Code: Select all

virt-manager --connect qemu+ssh://user@remote/system
Guide - How to ask for help

Please @korilius when replying to me
Desktop: MX-23.6_x64 “Libretto”, KDE | ASUS mb | Ryzen 5 5500 cpu | Nvidia 3060 12gb gpu | 48gb mem | (2) Crucial 1Tb ssd

User avatar
oops
Posts: 2054
Joined: Tue Apr 10, 2018 5:07 pm

Re: My Complete virtman libvirt setup  [Solved]

#2 Post by oops »

Nice tuto, Tkx for sharing. (I have not tested , I already have it with KVM and virtual-manager too)
Pour les nouveaux utilisateurs: Alt+F1 pour le manuel, ou FAQS, MX MANUEL, et Conseils MX Conseils Debian - Info. système “quick-system-info-mx” (QSI) ... Ici: System: MX-19-23_x64 & antiX23_x32 runit

User avatar
AVLinux
Posts: 3260
Joined: Wed Jul 15, 2020 1:15 am

Re: My Complete virtman libvirt setup

#3 Post by AVLinux »

Wow great!

I don't like VBox all that much and Gnome Boxes is OK but I wanted to learn how to use libvirt etc but it seemed pretty difficult, thanks for sharing!

mgold1
Posts: 31
Joined: Thu May 16, 2019 12:26 am

Re: My Complete virtman libvirt setup

#4 Post by mgold1 »

Requirement: systemd

I used the default init system, and it was not systemd.

Code: Select all

[CODE]Snapshot created on: 20250803_1745
System:
  Kernel: 6.14.10-2-liquorix-amd64 [6.14-13~mx23ahs] arch: x86_64 bits: 64 compiler: gcc v: 12.2.0 parameters: audit=0
    intel_pstate=disable amd_pstate=disable BOOT_IMAGE=/boot/vmlinuz-6.14.10-2-liquorix-amd64
    root=UUID=<filter> ro quiet splash
  Desktop: Xfce v: 4.20.0 tk: Gtk v: 3.24.38 info: xfce4-panel wm: xfwm v: 4.20.0 vt: 7
    dm: LightDM v: 1.32.0 Distro: MX-23.6_ahs_x64 Libretto April 13  2025 base: Debian GNU/Linux 12
    (bookworm)
Machine:
  Type: Desktop Mobo: ASRock model: B650 PG Lightning serial: <superuser required> UEFI: American
    Megatrends LLC. v: 3.10 date: 10/24/2024
CPU:
  Info: model: AMD Ryzen 7 7700 bits: 64 type: MT MCP arch: Zen 4 gen: 5 level: v4 note: check
    built: 2022+ process: TSMC n5 (5nm) family: 0x19 (25) model-id: 0x61 (97) stepping: 2
    microcode: 0xA601209
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache: L1: 512 KiB
    desc: d-8x32 KiB; i-8x32 KiB L2: 8 MiB desc: 8x1024 KiB L3: 32 MiB desc: 1x32 MiB
  Speed (MHz): avg: 2996 high: 3000 min/max: 3000/3800 boost: enabled scaling:
    driver: acpi-cpufreq governor: ondemand cores: 1: 2995 2: 2993 3: 2994 4: 3000 5: 2993 6: 2993
    7: 2983 8: 3000 9: 3000 10: 3000 11: 3000 12: 3000 13: 3000 14: 3000 15: 3000 16: 3000
    bogomips: 121365
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities:
  Type: gather_data_sampling status: Not affected
  Type: ghostwrite status: Not affected
  Type: indirect_target_selection status: Not affected
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: old_microcode status: Not affected
  Type: reg_file_data_sampling status: Not affected
  Type: retbleed status: Not affected
  Type: spec_rstack_overflow mitigation: Safe RET
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
  Type: spectre_v2 mitigation: Enhanced / Automatic IBRS; IBPB: conditional; STIBP: always-on;
    PBRSB-eIBRS: Not affected; BHI: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: NVIDIA TU116 [GeForce GTX 1660 SUPER] vendor: Shenzhen Colorful Yugong and Development
    driver: nvidia v: 535.247.01 non-free: 530.xx+ status: current (as of 2023-03) arch: Turing
    code: TUxxx process: TSMC 12nm FF built: 2018-22 pcie: gen: 3 speed: 8 GT/s lanes: 16
    bus-ID: 01:00.0 chip-ID: 10de:21c4 class-ID: 0300
  Device-2: AMD Raphael vendor: ASRock driver: amdgpu v: kernel arch: RDNA-2 code: Navi-2x
    process: TSMC n7 (7nm) built: 2020-22 pcie: gen: 4 speed: 16 GT/s lanes: 16 ports: active: none
    empty: DP-1, DP-2, DP-3, HDMI-A-1, Writeback-1 bus-ID: 12:00.0 chip-ID: 1002:164e
    class-ID: 0300 temp: 48.0 C
  Device-3: Microdia Webcam Vitade AF type: USB driver: snd-usb-audio,uvcvideo bus-ID: 3-9.3:8
    chip-ID: 0c45:6366 class-ID: 0102 serial: <filter>
  Display: x11 server: X.Org v: 1.21.1.7 compositor: xfwm v: 4.20.0 driver: X:
    loaded: amdgpu,nvidia unloaded: fbdev,modesetting,nouveau,vesa alternate: nv dri: radeonsi
    gpu: nvidia,amdgpu display-ID: :0.0 screens: 1
  Screen-1: 0 s-res: 3840x1080 s-dpi: 96 s-size: 1017x286mm (40.04x11.26")
    s-diag: 1056mm (41.59")
  Monitor-1: DVI-D-0 pos: right res: 1920x1080 hz: 60 dpi: 81 size: 600x340mm (23.62x13.39")
    diag: 690mm (27.15") modes: N/A
  Monitor-2: HDMI-0 pos: primary,left res: 1920x1080 hz: 120 dpi: 81
    size: 600x330mm (23.62x12.99") diag: 685mm (26.96") modes: N/A
  API: OpenGL v: 4.6.0 NVIDIA 535.247.01 renderer: NVIDIA GeForce GTX 1660 SUPER/PCIe/SSE2
    direct-render: Yes
Audio:
  Device-1: NVIDIA TU116 High Definition Audio vendor: Shenzhen Colorful Yugong and Development
    driver: snd_hda_intel bus-ID: 3-9.3:8 v: kernel chip-ID: 0c45:6366 pcie: class-ID: 0102 gen: 3
    serial: <filter> speed: 8 GT/s lanes: 16 bus-ID: 01:00.1 chip-ID: 10de:1aeb class-ID: 0403
  Device-2: AMD Rembrandt Radeon High Definition Audio driver: snd_hda_intel v: kernel pcie:
    gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 12:00.1 chip-ID: 1002:1640 class-ID: 0403
  Device-3: AMD Family 17h/19h/1ah HD Audio vendor: ASRock driver: snd_hda_intel v: kernel pcie:
    gen: 4 speed: 16 GT/s lanes: 16 bus-ID: 12:00.6 chip-ID: 1022:15e3 class-ID: 0403
  Device-4: Microdia Webcam Vitade AF type: USB driver: snd-usb-audio,uvcvideo
  API: ALSA v: k6.14.10-2-liquorix-amd64 status: kernel-api tools: alsamixer,amixer
  Server-1: PipeWire v: 1.0.0 status: off with: 1: pipewire-pulse status: off 2: wireplumber
    status: off tools: pw-cat,pw-cli,wpctl
  Server-2: PulseAudio v: 16.1 status: active tools: pacat,pactl,pavucontrol
Network:
  Device-1: Realtek RTL8125 2.5GbE vendor: ASRock driver: r8169 v: kernel pcie: gen: 2
    speed: 5 GT/s lanes: 1 port: e000 bus-ID: 0e:00.0 chip-ID: 10ec:8125 class-ID: 0200
  IF: eth0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  IF-ID-1: lxcbr0 state: down mac: <filter>
  IF-ID-2: surfshark_ipv6 state: unknown speed: N/A duplex: N/A mac: <filter>
  IF-ID-3: surfshark_wg state: unknown speed: N/A duplex: N/A mac: N/A
Bluetooth:
  Device-1: Edimax Bluetooth Adapter type: USB driver: btusb v: 0.8 bus-ID: 3-3.3.1:9
    chip-ID: 7392:c611 class-ID: e001 serial: <filter>
  Report: hciconfig ID: hci1 rfk-id: 1 state: up address: <filter> bt-v: 3.0 lmp-v: 5.1
    sub-v: d922 hci-v: 5.1 rev: dfc6
  Info: acl-mtu: 1021:6 sco-mtu: 255:12 link-policy: rswitch hold sniff park
    link-mode: peripheral accept service-classes: object transfer
  Device-2: USB2.0-BT type: USB driver: btusb v: 0.8 bus-ID: 5-2:2 chip-ID: 33fa:0010
    class-ID: e001
  Report: ID: hci0 rfk-id: 0 state: down bt-service: N/A rfk-block: hardware: no software: no
    address: <filter>
  Info: acl-mtu: 0:0 sco-mtu: 0:0 link-mode: peripheral accept
Drives:
  Local Storage: total: 5.46 TiB used: 1.74 TiB (31.8%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:1 vendor: Kingston model: SNV2S1000G size: 931.51 GiB
    block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s lanes: 4 type: SSD serial: <filter>
    rev: CBG04418 temp: 38.9 C scheme: GPT
  ID-2: /dev/nvme1n1 maj-min: 259:0 vendor: Samsung model: SSD 990 PRO with Heatsink 1TB
    size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s lanes: 4 type: SSD
    serial: <filter> rev: 5B2QJXD7 temp: 36.9 C
  ID-3: /dev/sda maj-min: 8:0 model: SSD1TB size: 931.51 GiB block-size: physical: 512 B
    logical: 512 B speed: 6.0 Gb/s type: SSD serial: <filter> rev: 1234 scheme: GPT
  ID-4: /dev/sdb maj-min: 8:16 type: USB vendor: Western Digital model: WD30EZRX-00D8PB0
    size: 2.73 TiB block-size: physical: 4096 B logical: 512 B type: HDD rpm: 5400 serial: <filter>
    scheme: GPT
Partition:
  ID-1: / raw-size: 186.25 GiB size: 182.27 GiB (97.86%) used: 31.13 GiB (17.1%) fs: ext4
    dev: /dev/nvme0n1p2 maj-min: 259:3
  ID-2: /boot/efi raw-size: 256 MiB size: 252 MiB (98.46%) used: 274 KiB (0.1%) fs: vfat
    dev: /dev/nvme0n1p1 maj-min: 259:2
  ID-3: /home raw-size: 745.01 GiB size: 732.24 GiB (98.29%) used: 86.35 GiB (11.8%) fs: ext4
    dev: /dev/nvme0n1p3 maj-min: 259:4
Swap:
  Kernel: swappiness: 15 (default 60) cache-pressure: 100 (default)
  ID-1: swap-1 type: file size: 6 GiB used: 0 KiB (0.0%) priority: -2 file: /swap/swap
Sensors:
  System Temperatures: cpu: 47.0 C mobo: N/A
  Fan Speeds (RPM): N/A
  GPU: device: nvidia screen: :0.0 temp: 41 C fan: 48% device: amdgpu temp: 49.0 C
Repos:
  Packages: 2964 pm: dpkg pkgs: 2943 libs: 1603
    tools: apt,apt-get,aptitude,gnome-software,nala,synaptic pm: rpm pkgs: 0 pm: flatpak pkgs: 21
  No active apt repos in: /etc/apt/sources.list
  Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list
    1: deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/debian.list
    1: deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
    2: deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
  Active apt repos in: /etc/apt/sources.list.d/google-earth-pro.list
    1: deb [arch=amd64] http://dl.google.com/linux/earth/deb/ stable main
  Active apt repos in: /etc/apt/sources.list.d/mx.list
    1: deb http://la.mxrepo.com/mx/repo/ bookworm main non-free
    2: deb http://la.mxrepo.com/mx/repo/ bookworm ahs
  Active apt repos in: /etc/apt/sources.list.d/plex-mx.list
    1: deb https://downloads.plex.tv/repo/deb public main
  Active apt repos in: /etc/apt/sources.list.d/spideroakone.list
    1: deb https://apt.spideroak.com/ubuntu/ release restricted
  Active apt repos in: /etc/apt/sources.list.d/surfshark.list
    1: deb https://ocean.surfshark.com/debian stretch main
  Active apt repos in: /etc/apt/sources.list.d/warpdotdev.list
    1: deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/warpdotdev.gpg] https://releases.warp.dev/linux/deb stable main
  Active apt repos in: /etc/apt/sources.list.d/waydroid.list
    1: deb [signed-by=/usr/share/keyrings/waydroid.gpg] https://repo.waydro.id/ bookworm main
Info:
  Processes: 571 Uptime: 3h 59m wakeups: 1 Memory: 30.44 GiB used: 10.92 GiB (35.9%) Init: SysVinit
  v: 3.06 runlevel: 5 default: graphical tool: systemctl Compilers: gcc: 12.2.0 alt: 12
  Client: shell wrapper v: 5.2.15-release inxi: 3.3.26
Boot Mode: UEFI
[/code]

User avatar
AVLinux
Posts: 3260
Joined: Wed Jul 15, 2020 1:15 am

Re: My Complete virtman libvirt setup

#5 Post by AVLinux »

@korilius

I'm a bit hazy on your Storage Pool section.. I use MX Disk Manager to mount my external drives and partitions and I have a dedicated partition on an SSD for VM's I use with Gnome Boxes

Code: Select all

$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0   1.8T  0 disk
├─sda1        8:1    0 931.5G  0 part /media/VMWARE
└─sda2        8:2    0 931.5G  0 part /media/ARDOUR
I'm not exactly sure how sda1 'VMWARE' fits in with your suggestions if it's not under /mnt/ in an fstab file..? I'm probably missing the obvious here but drive mount stuff is not my forte, it's one of those things that 'just works' so well with MX that you don't even think about it..

Post Reply

Return to “Software / Configuration”