How to fix Suspend/Resume failures with NVMe drives on Linux (Ubuntu as an example)?

I finally made suspend feature work on my Linux laptop with NVME SSD after it gave me a headache the past few days. So how can you do that too?
Suspend failures are not specific to a particular distribution but occur across all Linux distributions, as long as you use an NVME SSD. What we're going to do here is more of a workaround than a fix.
To fix the broken suspend and system freeze after the laptop resumes, you should add The IOMMU=soft kernel parameter to your Grub configuration file.

 
{tocify} $title={Table of Contents}

What is IOMMU?

You can consider an input-output memory management unit (IOMMU) as a chipset component that connects a direct-memory-access–capable (DMA-capable) I/O bus (such as a disk drive) to the main memory.
That means the IOMMU helps to filter and remap interrupts from peripheral devices like SSD, for example.
Unfortunately, when you use Linux on SSD Nvme, the IOMMU does not work as it should when your laptop suspends, making it inoperable until you reset the system.
Until the bug is fixed via a Kernel or firmware update, as a workaround, add the kernel parameter "iommu=soft" to prevent the usage of the hardware IOMMU and use a software replacement.

How to pass the "iommu=soft" parameter to the kernel?

 
To pass the "iommu=soft" parameter to the kernel:
  • Open a terminal window and enter the following command line:
sudo nano (or use your favorite text editor) /etc/default/grub{codeBox}
  • Then add the kernel parameter "iommu=soft" to  "GRUB_CMDLINE_LINUX_DEFAULT" line as follow:
  • Save the change and update the grub configuration file using the update-grub command as root: 
sudo update-grub{codeBox}
  • Reboot and enjoy.
Finally, I hope Linux developers will fix this bug in the next release because we need this feature. Don't we?
 
If you find Linux-Tech&More helpful, consider supporting it on Patreon or Liberapay. For supporting it via Paypal & Crypto currencies contact me.{alertIdea}
Djalel Oukid

Science teacher, PhD student, Master degree in Microbial biotechnology , Microbiologist, designer, video editor, podcaster & blogger. linkedin portfolio github

4 Comments

Comments are welcomed and encouraged on this blog. Spam, abusive and off-topics comments will be deleted. Please read our Comments policy before commenting.

  1. What distro and kernel version are you using?
    What laptop/hardware does this occur on?

    I've been using an NVMe drive for about a year now and never experienced any bug with suspend/resume.

    Please make it clear in your article that this is not a generalized problem but something with your system.

    Thanks.

    ReplyDelete
    Replies
    1. Thanks for your comment.
      However, do a simple search, and you will realize that this issue is common and not specific to my system. So common that there is a dedicated section for it on Arch Wiki.

      Delete
  2. Om more than one occassion, and currently i am experiencing this issue with Almalinux 9 on an HP laptop with an NVME disk. Post logging on after opening the lid, while browsing a web site or doing anythin, the system just freezes up. Keyboard/Mouse does not work and the computer cannot be accessed via ssh.

    ReplyDelete
    Replies
    1. Thanks for sharing your experience with us. The same thing happened to me until I added the IOMMU=soft kernel parameter. How did you fix it?

      Delete
Post a Comment
Previous Post Next Post