Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libvirt stop working after few minutes #11564

Closed
1 of 2 tasks
Qwarctick opened this issue May 7, 2024 · 8 comments
Closed
1 of 2 tasks

Libvirt stop working after few minutes #11564

Qwarctick opened this issue May 7, 2024 · 8 comments

Comments

@Qwarctick
Copy link

Qwarctick commented May 7, 2024

Windows Version

Microsoft Windows [version 10.0.22631.3447]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.146.1-2

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

After a reboot, start a VM with libvirt with the following command.

# virt-install \
        --name="u26" \
        --import \
        --disk "path=u26.qcow2,format=qcow2" \
        --ram="5120" \
        --vcpus="2" \
        --autostart \
        --hvm \
        --network network=default,model=virtio \
        --arch x86_64 \
        --accelerate \
        --check-cpu \
        --force \
        --watchdog=default \
        --graphics vnc,listen=0.0.0.0 \
        --osinfo detect=on,require=off \
        --debug \
        --noreboot \
        --noautoconsole

After 3 or 4 minutes, the VM will freeze and become unavailable. virsh list still list the VM as running and the qemu process is still here. But I cannot destroy the VM or do anything on the VM (reboot, shutdown, ...):

# sudo virsh reboot u26
error: Failed to reboot domain 'u26'
error: Timed out during operation: cannot acquire state change lock (held by monitor=init-u26)

And the VM loose it's mac adress (don't know if it's related) :

# arp -e
Address                  HWtype  HWaddress           Flags Mask            Iface
_gateway                 ether   00:15:5d:68:d5:2d   C                     eth0
192.168.100.10                       (incomplete)                              virbr1

Expected Behavior

The VM and libvirt should work everytimes.

Actual Behavior

Hello,

Got a problem with libvirt/kvm/qemu VM on my WSL2. After a windows reboot, I can start a VM and connect it to the NAT network. But after a short period of time. libvirt stop working and I can't do anything.

#  virsh list
 Id   Name   State
---------------------
 2    u26    paused
sudo systemctl status libvirtd
[sudo] password for pnl:
● libvirtd.service - Virtualization daemon
     Loaded: loaded (/lib/systemd/system/libvirtd.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2024-05-07 09:23:05 CEST; 6min ago
TriggeredBy: ● libvirtd-ro.socket
             ● libvirtd.socket
             ● libvirtd-admin.socket
       Docs: man:libvirtd(8)
             https://libvirt.org
   Main PID: 6587 (libvirtd)
      Tasks: 23 (limit: 32768)
     Memory: 61.6M
     CGroup: /system.slice/libvirtd.service
             ├─ 534 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/net1.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
             ├─ 535 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/net1.conf --leasefile-ro --dhcp-script=/usr/lib/libvirt/libvirt_leaseshelper
             └─6587 /usr/sbin/libvirtd

May 07 09:23:05 Tech-PNL systemd[1]: Started Virtualization daemon.
May 07 09:23:05 Tech-PNL dnsmasq[534]: bad address at /etc/hosts line 6
May 07 09:23:05 Tech-PNL dnsmasq[534]: read /etc/hosts - 26 names
May 07 09:23:05 Tech-PNL dnsmasq[534]: read /var/lib/libvirt/dnsmasq/net1.addnhosts - 0 names
May 07 09:23:05 Tech-PNL dnsmasq-dhcp[534]: read /var/lib/libvirt/dnsmasq/net1.hostsfile
May 07 09:23:05 Tech-PNL libvirtd[6587]: libvirt version: 8.0.0, package: 1ubuntu7.10 (Marc Deslauriers <marc.deslauriers@ubuntu.com> Fri, 12 Apr 2024 13:48:21 -0400)
May 07 09:23:05 Tech-PNL libvirtd[6587]: hostname: Tech-PNL
May 07 09:23:05 Tech-PNL libvirtd[6587]: internal error: Failed to get udev device for syspath '/sys/devices/virtual/dmi/id'
May 07 09:23:52 Tech-PNL libvirtd[6587]: Cannot start job (modify, none, none) for domain u26; current job is (modify, none, none) owned by (6701 init-u26, 0 <null>, 0 <null> (flags=0>
May 07 09:23:52 Tech-PNL libvirtd[6587]: Timed out during operation: cannot acquire state change lock (held by monitor=init-u26)

I can restart the libvirt service but it results in the same situation after a short period of time.

Diagnostic Logs

No response

Copy link

github-actions bot commented May 7, 2024

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Copy link

github-actions bot commented May 7, 2024

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@Qwarctick
Copy link
Author

Copy link

github-actions bot commented May 7, 2024

The log file doesn't contain any WSL traces. Please make sure that you reproduced the issue while the log collection was running.

Diagnostic information
.wslconfig found
Detected appx version: 2.1.5.0
Found no WSL traces in the logs

@Qwarctick
Copy link
Author

Copy link

github-actions bot commented May 7, 2024

The log file doesn't contain any WSL traces. Please make sure that you reproduced the issue while the log collection was running.

Diagnostic information
.wslconfig found
Detected appx version: 2.1.5.0
Found no WSL traces in the logs

@Qwarctick Qwarctick changed the title Libvirt stop working after 4 minutes Libvirt stop working after few minutes May 7, 2024
Copy link

github-actions bot commented May 7, 2024

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@Qwarctick
Copy link
Author

Qwarctick commented May 16, 2024

Ok problem founded. I installed cloud-init on my machine and it changes the network configuration a few moments after the starts of the distribution. That's why I lost connection to the qemu/KVM.

I got the same problem later in the day. It seems the problem comes with snapd. I saw the following with journalctl -xef :

May 17 10:05:56 CBW-TECH-PNL dbus-daemon[274]: [system] Activating via systemd: service name='org.freedesktop.timedate1' unit='dbus-org.freedesktop.timedate1.service' requested by ':1.11' (uid=0 pid=284 comm="/usr/lib/snapd/snapd ")
May 17 10:05:56 CBW-TECH-PNL systemd[1]: Starting Time & Date Service...
░░ Subject: A start job for unit systemd-timedated.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit systemd-timedated.service has begun execution.
░░
░░ The job identifier is 715.
May 17 10:05:56 CBW-TECH-PNL dbus-daemon[274]: [system] Successfully activated service 'org.freedesktop.timedate1'

I suspect snapd to run a program that change time/date and/or network. After removing snapd, the problem is solved.

I can now use libvirt/qemu/kvm without issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant