Wednesday, August 1, 2018

Suspend Issues with the Lenovo ThinkPad X1 Carbon 6th Generation

UPDATE 2018/09/12:
And the final solution seems to be at hand!  Lenovo has released 0.1.30, and that apparently re-adds S3 sleep to the ACPI tables:

https://brauner.github.io/2018/09/08/thinkpad-6en-s3.html

UPDATE 2018/09/07:
So, it appears that there is a new firmware version available from Lenovo, 0.1.28, the patch no longer cleanly applies, and Adrian has re-rolled it:

https://lisas.de/~adrian/?p=1328

Thanks, Adrian, that's a much easier way to reliably patch the ACPI tables!

I'll update this post, later, with an updated step-by-step guide.

ORIGINAL POST:
Those of you who have the new (and very nicely built!) Lenovo ThinkPad X1 Carbon 6th generation, and who run Linux, may have noticed that suspend doesn't work properly.  I'm running Fedora 28, but this problem has been reported on Arch and Ubuntu, as well.  The issue seems to be that the X1 is using a new suspend technology called "Windows Modern Standby," or S0i3, and has removed classic S3 sleep.  S0i3 technology was added to the mainline Linux kernel with v4.13, but there is apparently a BIOS bug preventing this from working properly.

To work around this problem, we need to patch the ACPI DSDT tables, created by the BIOS, to re-add S3 sleep.  There's a fantastic guide here, which was written by Erik Sonnleitner of the University of Applied Sciences of Upper Austria.

To summarize his excellent directions:
  • In the BIOS, set "Thunderbolt BIOS Assist Mode" to Enabled, and disable secure boot.
  • Install "iasl" and "cpio"
  • Once the system has booted whichever Linux distribution that you use, dump the DSDT table
sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.aml
  • Reverse compile the DSDT table
iasl -d dsdt.aml
  • Download the patch, and patch your decompiled code
    • I had to hand-patch hunk #7, by hand, but this wasn't a big deal
patch --verbose < X1C6_S3_DSDT.patch
  • Compile your updated DSDT code
iasl -ve -tc dsdt.dsl
  • Create a new ACPI override package
mkdir -p kernel/firmware/acpi
cp dsdt.aml kernel/firmware/acpi
find kernel | cpio -H newc --create > acpi_override
sudo cp acpi_override /boot

  • Now, you need to update your grub.cfg
sudo sed -i 's/quiet"/quiet mem_sleep_default=deep"/' /etc/default/grub
echo GRUB_EARLY_INITRD_LINUX_CUSTOM=acpi_override | sudo tee -a /etc/default/grub
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
  • The second change won't work immediately, on Fedora, as GRUB_EARLY_INITRD_LINUX_CUSTOM isn't yet supported
  • So, we need to update the grub boot config, and then manually update the initrd entries to add the new ACPI overlay, before booting the initial ramdisk
sudo sed -i 's/initrd16 \/initramfs/initrd16 \/acpi_override \/initramfs/' /boot/grub2/grub.cfg
  • Upon reboot, suspend should work properly.

2 comments:

  1. Terrific post. Worked like a charm on both RHEL Workstation 7.5 and Fedora 28.

    ReplyDelete
  2. Consumer electronics are those electronics that we use in our daily life. Consumer electronics makes our daily work so easier. There are so many types of consumer electronics that we use in our daily life. If you want to buy the best consumer electronics then you can visit our site. Consumer electronics WA

    ReplyDelete