0

System: Operating System: Kubuntu 22.04

Background

Before going into suspend, user space processes and (some) kernel threads get frozen. If the freezing fails, it will either be due to a user space process or a kernel thread failing to freeze.

To freeze a user space process, the kernel sends it a signal that is handled automatically and, once received, cannot be ignored. If, however, the process is in the uninterruptible sleep state (e.g. waiting for I/O that cannot complete due to the device being unavailable), it will not receive the signal straight away. If this delay lasts longer than 20s (=default freeze timeout, see /sys/power/pm_freeze_timeout (in miliseconds)), the freezing will fail.

What is causing the issue: The log & MEGS points to a NFS kernel thread that refuses to freeze.
NFS have been historically known for causing issues like that.

What I have tried:

ps kill -9 PROCESS

It does not kill the frozen process

systemctl stop autofs

or

systemctl stop nfs-kernel-server

Allow the the system to enter into SLEEP / SUSPEND state. But the frozen process are back upon starting either service back !!!

ERROR message

[   43.579170] Freezing of tasks failed after 20.004 seconds (9 tasks refusing to freeze, wq_busy=0):
[   43.579219] task:lockd           state:I stack:    0 pid: 1979 ppid:     2 flags:0x00004000

Question: How can I "unfreeze / unlock" these process ?

DMSG


ps aux


Sergio
  • 51

1 Answers1

2

I encountered this problem a few days ago on Ubuntu 22.04.4 LTS Server Version, and after discovering that it was NFS causing it is when I came across this thread.

The solution for me has been to use the "Alternate answer using systemd" in this thread: How to run a script before suspend?

Create a file with the following and make it executable:

sudo touch /lib/systemd/system-sleep/my_script.sh
sudo chmod +x /lib/systemd/system-sleep/my_script.sh

Edit the file:

sudo nano /lib/systemd/system-sleep/my_script.sh

Paste the following text and use Ctrl+o to save then Ctrl+x to exit:

#!/bin/bash

case $1/$2 in pre/) # commands to be executed before suspend, hibernate, etc. goes below sudo systemctl stop nfs-kernel-server ;; post/) # commands to be executed on wake, resume, etc. goes below sudo systemctl restart nfs-kernel-server ;; esac

And bingo in my case the nfs server is stopped and restarted automatically whenever the system is suspended and awoken, and I no longer have the freezing issue.