Hibernation fails due to resource busy during swap file check

Bug #1962359 reported by bsdz
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Hopefully, the automatically collected information is useful. The issue manifests when I try to hibernate the device. I see the following in the logs:

~$ journalctl --no-hostname -b -1 | tail -6
Feb 25 08:23:54 systemd[1]: nvidia-hibernate.service: Deactivated successfully.
Feb 25 08:23:54 systemd[1]: Finished NVIDIA system hibernate actions.
Feb 25 08:23:54 systemd[1]: Starting Hibernate...
Feb 25 08:23:54 kernel: PM: Image not found (code -16)
Feb 25 08:23:54 systemd-sleep[50360]: Entering sleep state 'hibernate'...
Feb 25 08:23:54 kernel: PM: hibernation: hibernation entry

I looked up error code 16 as EBUSY. This happens when using pm-hibernate or "systemctl hibernate". I played qaround with the nvidia systemd hibernate units but it didn't help.

Hibernate used to work before I upgraded to jammy. I was on focal and bionic before that.

ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: linux-image-5.15.0-18-generic 5.15.0-18.18
ProcVersionSignature: Ubuntu 5.15.0-18.18-generic 5.15.12
Uname: Linux 5.15.0-18-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu78
Architecture: amd64
CasperMD5CheckResult: unknown
CurrentDesktop: ubuntu:GNOME
Date: Sat Feb 26 09:27:29 2022
InstallationDate: Installed on 2019-08-07 (933 days ago)
InstallationMedia: Ubuntu 18.04.2 LTS "Bionic Beaver" - Release amd64 (20190210)
MachineType: Gigabyte Technology Co., Ltd. X399 AORUS XTREME
ProcFB: 0 EFI VGA
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.15.0-18-generic root=UUID=08f6326a-30f9-4f23-bab7-72a48afad354 ro quiet splash resume=UUID=08f6326a-30f9-4f23-bab7-72a48afad354 resume_offset=34816 vt.handoff=7
PulseList: Error: command ['pacmd', 'list'] failed with exit code 1: No PulseAudio daemon running, or not running as session daemon.
RelatedPackageVersions:
 linux-restricted-modules-5.15.0-18-generic N/A
 linux-backports-modules-5.15.0-18-generic N/A
 linux-firmware 20220217.git6342082c-0ubuntu1
SourcePackage: linux
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 12/11/2019
dmi.bios.release: 5.14
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: F5
dmi.board.asset.tag: Default string
dmi.board.name: X399 AORUS XTREME-CF
dmi.board.vendor: Gigabyte Technology Co., Ltd.
dmi.board.version: x.x
dmi.chassis.asset.tag: Default string
dmi.chassis.type: 3
dmi.chassis.vendor: Default string
dmi.chassis.version: Default string
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrF5:bd12/11/2019:br5.14:svnGigabyteTechnologyCo.,Ltd.:pnX399AORUSXTREME:pvrDefaultstring:rvnGigabyteTechnologyCo.,Ltd.:rnX399AORUSXTREME-CF:rvrx.x:cvnDefaultstring:ct3:cvrDefaultstring:skuDefaultstring:
dmi.product.family: Default string
dmi.product.name: X399 AORUS XTREME
dmi.product.sku: Default string
dmi.product.version: Default string
dmi.sys.vendor: Gigabyte Technology Co., Ltd.

Revision history for this message
bsdz (blairuk) wrote :
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote : Status changed to Confirmed

This change was made by a bot.

Changed in linux (Ubuntu):
status: New → Confirmed
Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

Is the swap space big enough? Furthermore, the hibernation failure isn't logged in the dmesg.

Revision history for this message
bsdz (blairuk) wrote :

> Is the swap space big enough?

A good point. This worked on previous versions on Ubuntu with swap (18GB) only 50% of RAM (32GB). I recreated my /swapfile with 38GB and the same issue persists. ie.

$ free -m
               total ...
Mem: 31964
Swap: 38911

> Furthermore, the hibernation failure isn't logged in the dmesg.

That's correct. The machine just stalls with a blank screen. It's still awake as is apparent by motherboard lights. It cannot be awoken in any way and needs to cold restarted using power button.

Curiously if I run smem before I attempt to hibernate, it does not show any processes using swap. ie

$ smem --columns="swap" --no-header | tr -d " " | awk '$1 != 0' | wc -l
0

Revision history for this message
James (morris-570) wrote :

Same here. I have 48GB Ram and 76GB swap partition. Where did you see the error code -16 is EBUSY?

Revision history for this message
bsdz (blairuk) wrote :

For me, when I ran journalctl (see above) the following message was present: "kernel: PM: Image not found (code -16)". The minus sign is prefixed to the error code and 16 is a standard linux kernel error code, i.e.

$ grep 16 /usr/include/asm-generic/errno-base.h
#define EBUSY 16 /* Device or resource busy */

Revision history for this message
zyf0330 (zyf0330) wrote (last edit ):

I am lucky that find the same problem here.
I use Ubuntu 21.10, and the error info is same `kernel: PM: Image not found (code -16)`.
This is my swap info

NAME TYPE SIZE USED PRIO
/dev/nvme1n1p5 partition 32G 0B -2

Revision history for this message
zyf0330 (zyf0330) wrote (last edit ):

Sorry, I am wrong.
Previously, I set "resume=LABEL=Swap" at grub `GRUB_CMDLINE_LINUX` param, and got error msg `kernel: PM: Image not found (code -16)` and resume failed.
After change to set `resume=/dev/xxx-to-swap`, resume works.

But although resume succeeds, error msg `kernel: PM: Image not found (code -16)` still appears in the syslog sometimes.

Revision history for this message
Fabio (fabiofs-br) wrote :

I'm getting this same error after reinstall my system (Linux Mint 20.3 Una base: Ubuntu 20.04 focal).
No workaround which I tried to fix it worked until now, and I'm unable to hibernate my system.

~$ journalctl --no-hostname -b -1 | tail -6

jun 25 16:32:04 kernel: PM: Image not found (code -16)
jun 25 16:32:04 systemd[1]: Starting GRUB failed boot detection...
jun 25 16:32:04 systemd-sleep[6466]: Suspending system...
jun 25 16:32:04 kernel: PM: hibernation: hibernation entry
jun 25 16:32:04 systemd[1]: grub-initrd-fallback.service: Succeeded.
jun 25 16:32:04 systemd[1]: Finished GRUB failed boot detection.

Hope anybody can come up with a solution.

Revision history for this message
bsdz (blairuk) wrote :

I had another look at my hibernation settings and realised my resume offset was wrong in my /etc/default/grub. After updating this with the value from command (found on https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate):

~$ sudo filefrag -v /swapfile | awk '$1=="0:" {print substr($4, 1, length($4)-2)}'

Then hibernate appears to work again. Perhaps this offset changed during an upgrade of my base system to 22.04 and/or changed again when I increased my swap size during this bug.

All this got a little forced on me when my suspend capability stopped working several days ago (after an apt upgrade!). I'll take another look at that again now :-)

Revision history for this message
Fabio (fabiofs-br) wrote :

Well... I may have found a workaround to this problem. It worked in my case at least. The new NVIDIA driver was the culprit.
I had my share of problems with it in hibernation configurations before, so I try to install a old version. Based in this thread found in NVIDIA forums.
https://forums.developer.nvidia.com/t/resume-from-hibernation-fails-with-510-60-02/211025

As soon as I downgraded to NVIDIA Driver 510.54 my hibernation start to work. NVIDIA Driver 470 works too, but it has an issue with my 3 screen setup.
Basically, looks like NVIDIA Driver 510.60.02 introduced this regression.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.