0

I have a *.qcow2 image from my old OS, it contains Windows 10. Then I copied it to the new OS and tried to install it. I followed the method written here "How to create a new domain from an existing base image in virsh".

But my VM does not appear from virsh? (virsh list --all) Then how do I get virsh to detect my new VM? Or how do I run my VM from the command line if virsh can't detect?

Here are some commands that I run in the terminal window:

$ sudo virt-sysprep -a /home/vm-images/win10.qcow2 
[sudo] password for ita: 
[   0.0] Examining the guest ...
[   4.9] Performing "abrt-data" ...
[   4.9] Performing "backup-files" ...
[  27.3] Performing "bash-history" ...
[  27.3] Performing "blkid-tab" ...
[  27.3] Performing "crash-data" ...
[  27.3] Performing "cron-spool" ...
[  27.3] Performing "dhcp-client-state" ...
[  27.4] Performing "dhcp-server-state" ...
[  27.4] Performing "dovecot-data" ...
[  27.4] Performing "logfiles" ...
[  27.4] Performing "machine-id" ...
[  27.4] Performing "mail-spool" ...
[  27.4] Performing "net-hostname" ...
[  27.5] Performing "net-hwaddr" ...
[  27.5] Performing "pacct-log" ...
[  27.5] Performing "package-manager-cache" ...
[  27.6] Performing "pam-data" ...
[  27.6] Performing "passwd-backups" ...
[  27.6] Performing "puppet-data-log" ...
[  27.6] Performing "rh-subscription-manager" ...
[  27.7] Performing "rhn-systemid" ...
[  27.7] Performing "rpm-db" ...
[  27.7] Performing "samba-db-log" ...
[  27.7] Performing "script" ...
[  27.7] Performing "smolt-uuid" ...
[  27.7] Performing "ssh-hostkeys" ...
[  27.8] Performing "ssh-userdir" ...
[  27.8] Performing "sssd-db-log" ...
[  27.8] Performing "tmp-files" ...
[  27.8] Performing "udev-persistent-net" ...
[  27.9] Performing "utmp" ...
[  27.9] Performing "yum-uuid" ...
[  27.9] Performing "customize" ...
[  27.9] Setting a random seed
virt-sysprep: warning: random seed could not be set for this type of guest
[  28.2] Performing "lvm-uuids" ...
$ virt-install -n windows-10 --connect=qemu:///system --description "Windows 10" --os-type=win10 --ram=2048 --vcpus=1 --disk path=/home/vm-images/win10.qcow2,bus=virtio,size=12 --network default --boot hd

Starting install...
Domain creation completed.
You can restart your domain by running:
  virsh --connect qemu:///system start windows-10
$ virsh list --all
 Id   Name   State
--------------------

1

You forgot the virsh command line option --connect qemu:///system.

Because you aren't running virsh as root, it defaults to qemu:///session, which shows only VMs running under your user account.

  • Yes ... It's work. My old OS is Ubuntu, and now I use Debian Bullseye. On Ubuntu I don't need to add --connect qemu:///system to the command line, I think it's the same in Debian. – Ita Subagja Sep 7 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.