Post

ENG | Running virtual machine on Fedora Linux

Quick guide how to run virtual machine on Linux

ENG | Running virtual machine on Fedora Linux

Personal motivation:

I wanted to revisit openSUSE—mainly to see it’s Sway (window manager) setup, without touching my Fedora installation. And to try Fedora Sway spin.

On Fedora KDE, Sway setup is pretty bare with minimal integration.

VirtualBox was avoided because its performance on Windows had been poor, and I wanted to try Linux virtualization stack already for some time.

This note shows the minimal steps needed to prepare libvirt, create a qcow2 disk, and boot an ISO image.

Installing virt-manager

Install packages

1
sudo dnf in virt-manager guestfs-tools virt-viewer libvirt-daemon-config-network
1
2
3
4
5
6
7
8
Transaction Summary:
 Installing:       168 packages
 Upgrading:          4 packages
 Replacing:          4 packages

Total size of inbound packages is 83 MiB. Need to download 83 MiB.
After this operation, 312 MiB extra will be used (install 321 MiB, remove 10 MiB).
Is this ok [y/N]: y

Start service

1
sudo systemctl enable --now libvirtd
1
2
3
4
Created symlink '/etc/systemd/system/multi-user.target.wants/libvirtd.service' → '/usr/lib/systemd/system/libvirtd.service'.
Created symlink '/etc/systemd/system/sockets.target.wants/libvirtd.socket' → '/usr/lib/systemd/system/libvirtd.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/libvirtd-ro.socket' → '/usr/lib/systemd/system/libvirtd-ro.socket'.
Created symlink '/etc/systemd/system/sockets.target.wants/libvirtd-admin.socket' → '/usr/lib/systemd/system/libvirtd-admin.socket'.

Create folder and virtual disk

Note: this can be easily done from gui, left only for reference. Make partition larger than 20GB, it proved insufficient.

1
2
3
mkdir VMs
cd VMs
qemu-img create -f qcow2 ~/VMs/opensuse-slowroll.qcow2 20G
1
Formatting '/home/pavel/VMs/opensuse-slowroll.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=21474836480 lazy_refcounts=off refcount_bits=16

It was fast, so let’s check file size.

1
ls -la
1
2
3
4
total 204
drwxr-xr-x.  2 pavel pavel   4096 Nov 25 19:36 .
drwx------. 34 pavel pavel   4096 Nov 25 19:35 ..
-rw-r--r--.  1 pavel pavel 196928 Nov 25 19:36 opensuse-slowroll.qcow2

It’s dynamic, good. But later I found that 20GB is not enough, especially with development tools, cache of old packages and so on.

Download distro of your liking

Here slowroll was full 5GB iso, whereas netinstall of Tumbleweed is small, so I decided to install Tumbleweed now. Later I found (maybe due to different number of CPUs) that Tumbleweed is faster to install and boot and than Fedora. Curiously Fedora seemed stuck at installing bootloader phase. Plus with network installer, openSUSE already has fresh packages.

1
wget https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Current.iso
1
2
3
4
5
6
7
8
HTTP response 302  [https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Current.iso]
Adding URL: https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Snapshot20251124-Media.iso
Adding URL: https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Snapshot20251124-Media.iso
HTTP response 302  [https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Snapshot20251124-MediaAdding URL: https://ftp.sh.cvut.cz/opensuse/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Snapshot20251124-Media.iso
Adding URL: https://ftp.sh.cvut.cz/opensuse/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Snapshot20251124-Media.iso
Saving 'openSUSE-Tumbleweed-NET-x86_64-Current.iso'
HTTP response 200  [https://ftp.sh.cvut.cz/opensuse/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Snapshot20251124-MedopenSUSE-Tumbleweed- 100% [===================================================================>]  362.00M   28.91MB/s
                          [Files: 1  Bytes: 362.00M [26.92MB/s] Redirects: 2  Todo: 0  Errors: ]

Check status

1
sudo systemctl status libvirtd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[sudo] password for pavel:
● libvirtd.service - libvirt legacy monolithic daemon
     Loaded: loaded (/usr/lib/systemd/system/libvirtd.service; enabled; prese>
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
     Active: active (running) since Tue 2025-11-25 19:35:29 CET; 5min ago
 Invocation: d9c5ed9cdc9440eab6d3baf5f6409c0b
TriggeredBy: ● libvirtd-admin.socket
             ● libvirtd-ro.socket
             ● libvirtd.socket
       Docs: man:libvirtd(8)
             https://libvirt.org/
   Main PID: 119543 (libvirtd)
      Tasks: 23 (limit: 32768)
     Memory: 19.2M (peak: 22.5M)
        CPU: 744ms
     CGroup: /system.slice/libvirtd.service
             ├─119543 /usr/bin/libvirtd --timeout 120
             ├─119626 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/d>
             └─119627 /usr/bin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/d>

Run virtual manager GUI

1
virt-manager -c qemu:///session

We need to run virtual machine inside user session rather than system service - it would require root privileges and cause SELinux to complain.

Install distro of your liking

  • (x) Local install media (ISO…
  • Navigate to downloaded ISO
  • (x) Enable storage for this virtual machine
  • (x) Select or create custom storage -> Manage -> Navigate to qcow2 file

Since now we have to go through UI, set iso and disk image and call it a day

Few screenshots from OpenSUSE Few screens from OpenSUSE install, IceWM and openSUSEway

Proceed with packages

This is for openSUSE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sudo zypper in -t pattern openSUSEway devel_C_C++
sudo zypper in jetbrains-mono-fonts ibm-plex-mono-fonts ibm-plex-sans-fonts ibm-plex-serif-fonts inter-fonts
sudo zypper in mc nvim bat ncdu figlet inxi fastfetch zsh btop htop
sudo zypper in clang21 cmake-full
# Add Microsoft repo and import key
sudo zypper addrepo https://packages.microsoft.com/yumrepos/vscode vscode
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
# Add Vivaldi repo and import key
sudo zypper ar https://repo.vivaldi.com/archive/vivaldi-suse.repo
sudo rpm --import https://repo.vivaldi.com/archive/linux_signing_key.pub
sudo zypper ref
sudo zypper in code vivaldi-stable
# Install Steam via flatpak, run it (there was some warning, but it worked)
flatpak install flathub com.valvesoftware.Steam
flatpak run com.valvesoftware.Steam

Tip: sudo -i exists :-)

Add this point virtual disk takes roughly 16GB and we don’t even have KDE.

Note: on Fedora, dnf is quite similar, but

1
2
3
4
sudo rpm --import https://repo.vivaldi.com/stable/linux_signing_key.pub
sudo dnf config-manager --add-repository https://repo.vivaldi.com/stable/vivaldi-fedora.repo
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\nautorefresh=1\ntype=rpm-md\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null

(Horrible commandline comes from official guide)

Then it’s fun to play with systemd-analyze, systemd-analyze --blame, systemd-analyze --critical-chain.

Connecting to host via SSH

Because I failed to make clipboard work, I decided to install SSH. Otherwise I can’t easily copy&paste commands from browser and I don’t want to use personal accounts inside virtual machines.

Install SSH server on guest and enable it in firewall

1
2
3
4
5
6
7
8
9
10
# Install SSH server if not present (on Fedora it's almost certainly installed)
sudo zypper in openssh-server

# Enable and start SSH
sudo systemctl enable --now sshd

# Check firewall (openSUSE & Fedora use firewalld, Fedora has ssh, mdns and dhcpclient already allowed)
sudo firewall-cmd --list-service
sudo firewall-cmd --add-service=ssh --permanent
sudo firewall-cmd --reload

Enable port forwarding from host to guest

Use these two commands to list virtual machines and edit config file (it is created in /tmp)

Alternative is to enable XML editing in Preferences (main application) and then

1
2
3
4
5
6
7
8
9
~ virsh -c qemu:///session list --all
 Id   Name                 State
-------------------------------------
 -    opensusetumbleweed   shut off

~ virsh -c qemu:///session edit opensusetumbleweed
error: unsupported configuration: The <portForward> element can only be used with the 'passt' backend of interface type='user' or type='vhostuser'
Failed. Try again? [y,n,i,f,?]: 
Domain 'opensusetumbleweed' XML configuration edited.

When editing config find <interface> and add backend and portForward.

1
2
3
4
5
6
7
8
<interface type='user'>
  <mac address='52:54:00:xx:xx:xx'/>
  <model type='virtio'/>
  <backend type='passt'/>
  <portForward proto='tcp'>
    <range start='10022' end='10022' to='22'/>
  </portForward>
</interface>

Connect

1
2
3
4
5
6
7
$ ssh pavel@localhost -p 10022
The authenticity of host '[localhost]:10022 ([127.0.0.1]:10022)' can't be established.
ED25519 key fingerprint is SHA256:DGXwkftmBxHgssD1vM5P4tliXMudIIKv89yJOcmrdEk.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[localhost]:10022' (ED25519) to the list of known hosts.
(pavel@localhost) Password: 

Files can be comfortably transferred for example by Thunar and using path sftp://pavel@localhost:10022/home/pavel.

Side note (OpenSUSE vs Fedora)

I’m currently using Fedora, but in my opinion neither of these distros is bad. They are quite similar.

OpenSUSE has unfortunate release cycles. Leap is very conservative, Tumbleweed is a rolling distro with too many updates. New gcc out -> distro recompiled. Zypper used to be slower, but I don’t feel that way today. On the other hand my experince with Fedora KDE spins before 2020 were awful, today it’s perfectly fine.

Strengths of OpenSUSE are, in my opinion, a much better installer with more control. On the other hand, it provides some help during disk partitioning - unlike Fedora, which doesn’t give you many options and doesn’t hold your hand when you’re not just clicking next. Fedora installer feels simple, but it’s harder to use.

Then it has a great implementation of BTRFS. It’s not just yet another filesystem to choose from - it actually provides subvolumes that may have independent snapshots (excluding /home, /var, etc.). Snapshots are done after package installations so rollbacks are possible. But it has some learning curve as it’s hard to know how much disk space is free/used.

Some mysterious advantage of OpenSUSE is that I completely failed to install Fedora on an old notebook (first gen i5) where grub failed to boot or only worked in legacy mode, whereas OpenSUSE worked flawlessly.

The advantage of Fedora is that important packages are upgraded predictably in six-month release cycles; updates of OpenSUSE Tumbleweed are not predictable. There are cases when Fedora can push an update faster (for example, October updates tightly follow the Python update and already include Python in a state where some packages are not ready). But you don’t have to upgrade Fedora the day after release, and Tumbleweed has multiple versions of Python (such as python313).

So I would say, except for the release cycle, OpenSUSE is techically the better distro, but the difference is small, Fedora feels more friendly and has larger community.

Summary

I was not successful in sharing clipboard, which should work out-of-the-box. Virtual machine runs surpringly fast, no problem playing youtube videos. If mouse is captured by virtual machine, LSHIFT+LCTRL helps (maybe LALT?), but when some systemd service starts mouse can leave virtual window. Not during grub phase though.

Changelog

  • 2025-12-07: Added SSH part
This post is licensed under CC BY 4.0 by the author.