Hibernation is not possible with gcdemu and cdemu-daemon running. (wq_busy=1)
Hello lately I was retrying again to hibernate my system, and found a hint this might be related to cdemu.
And indeed, having gcdemu and cdemu-daemon stopped before issuing a systemctl hibernate command makes it succeed (with the kernel module still loaded).
I found this old bug at the sourceforge project page, which describes a similar problem. But focusses at the vhba kernel module and got closed being not reproducible.
This is the dmesg part of a failing suspend attempt:
[Mo Okt 18 11:32:28 2021] PM: hibernation: hibernation entry
[Mo Okt 18 11:32:28 2021] Filesystems sync: 0.063 seconds
[Mo Okt 18 11:32:28 2021] Freezing user space processes ... (elapsed 0.002 seconds) done.
[Mo Okt 18 11:32:28 2021] OOM killer disabled.
[Mo Okt 18 11:32:28 2021] PM: hibernation: Marking nosave pages: [mem 0x00000000-0x00000fff]
...
[Mo Okt 18 11:32:28 2021] PM: hibernation: Basic memory bitmaps created
[Mo Okt 18 11:32:28 2021] PM: hibernation: Preallocating image memory
[Mo Okt 18 11:32:33 2021] PM: hibernation: Allocated 3045052 pages for snapshot
[Mo Okt 18 11:32:33 2021] PM: hibernation: Allocated 12180208 kbytes in 4.66 seconds (2613.77 MB/s)
[Mo Okt 18 11:32:33 2021] Freezing remaining freezable tasks ...
[Mo Okt 18 11:32:53 2021] Freezing of tasks failed after 20.008 seconds (0 tasks refusing to freeze, wq_busy=1):
[Mo Okt 18 11:32:53 2021] Showing busy workqueues and worker pools:
[Mo Okt 18 11:32:53 2021] workqueue events_freezable: flags=0x4
[Mo Okt 18 11:32:53 2021] pwq 12: cpus=6 node=0 flags=0x0 nice=0 active=0/0 refcnt=2
[Mo Okt 18 11:32:53 2021] delayed: pci_pme_list_scan
[Mo Okt 18 11:32:53 2021] workqueue events_freezable_power_: flags=0x84
[Mo Okt 18 11:32:53 2021] pwq 14: cpus=7 node=0 flags=0x0 nice=0 active=1/0 refcnt=2
[Mo Okt 18 11:32:53 2021] in-flight: 375194:disk_events_workfn
[Mo Okt 18 11:32:53 2021] pool 14: cpus=7 node=0 flags=0x0 nice=0 hung=0s workers=3 idle: 374084 371819
[Mo Okt 18 11:32:53 2021] Restarting kernel threads ... done.
[Mo Okt 18 11:32:53 2021] PM: hibernation: Basic memory bitmaps freed
[Mo Okt 18 11:32:53 2021] OOM killer enabled.
[Mo Okt 18 11:32:53 2021] Restarting tasks ... done.
[Mo Okt 18 11:32:53 2021] PM: hibernation: hibernation exit
I am encountering the same issue on kernel 5.17.
I ended up writing a python script to stop the daemon before hibernation and restart it afterwards.
#!/usr/bin/env python3
from pydbus import SessionBus, SystemBus
from gi.repository import GLib
def prepareForSleep(sleep):
with SessionBus() as sessionbus:
systemd = sessionbus.get(".systemd1")
if sleep == True:
systemd.StopUnit("cdemu-daemon.service", "fail")
else:
systemd.StartUnit("cdemu-daemon.service", "fail")
systembus = SystemBus()
login = systembus.get(".login1")
login.PrepareForSleep.connect(prepareForSleep)
GLib.MainLoop().run()
It depends on pydbus (python3-pydbus).
Hope this helps until someone can solve this. It could also probably be integrated into gcdemu itself, but it's not really a solution.