Ubuntu 18.04 crashes / freezes after sleep / suspend

I recently installed Ubuntu 18.04 on my ASUS X512D, and I have a problem resuming from sleep mode: the screen is black (with a working pointer) or corrupted and the only thing I can do is manually reboot the computer (and loose my work). Pretty annoying for a laptop..

Computer: AMD Ryzen R5 / AMD Radeon Vega 8 / Dual boot with WIN10 Link for specs: ASUS Zenbook S512DA-EJ162T

A picture of my corrupted screen: Corrupted screen after sleep mode

What I tried:

  • Switching to lightdm, even worse (not even the pointer on screen) so I got back to gdm3
  • Updating kernel (I tried several ones, now I run the lastest mainline one, 5.2.5)
  • A lot of things from forums and other AskUbuntu posts

I also went to Software update > additional drivers and it doesn't show any proprietary driver

Another element, I had to reinstall Ubuntu because on the first try the GPU was not recognized and Ubuntu said in the settings Unknown screen. I guess buying a computer with an AMD proc was not such a good idea to use it with Ubuntu..

Thank you to anyone who'd try helping me!


I finally managed to fix it, and here are the steps for people having the same issue.

1. Switch from gdm3 to lightdm

To do this, open a terminal and type sudo apt-get install lightdm, or sudo dpkg-reconfigure lightdm and when asked, select lightdm as your default display manager

2. Try the fix

  1. Start your system and wait for the GRUB menu to show (if you don't see a GRUB menu, press and hold the left Shift key right after starting the system).

  2. Now highlight the kernel you want to use, and press the e key. You should be able to see and edit the commands associated with the highlighted kernel.

  3. Go down to the line starting with linux and add at the end: amd_iommu=off. Generally, the end of the line will look like this: quiet splash amd_iommu=off

  4. Now press Ctrl + x to boot.

  5. Open your session and try suspending by closing the lid

3. Make the fix permanent

  1. From a terminal (or after pressing Alt + F2) run:

    gksudo gedit /etc/default/grub

    (or use sudo nano if gksudo or gedit are not available) and enter your password.

  2. Find the line starting with GRUB_CMDLINE_LINUX_DEFAULT and append amd_iommu=off to its end. For example:

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash amd_iommu=off"

    Save the file and close the editor.

  3. Finally, start a terminal and run:

    sudo update-grub

    to update GRUB's configuration file (you probably need to enter your password).

I also noticed that you cannot suspend with a long press on the power button in the top-right Ubuntu menu, as it results to a crash on wake up.

--

Sources:

https://bbs.archlinux.org/viewtopic.php?pid=1858315#p1858315

https://askubuntu.com/a/19487/981926

https://askubuntu.com/a/152381/981926