X1 Carbon Gen 6 Sleep on Fedora

Update: Since BIOS version 1.30, the X1 Carbon supports S3 mode when enabled in the BIOS menu (choose “Linux” sleep mode instead of the default “Windows 10”).

Some one-liners, for dealing with the lack of regular sleep states on the X1 Carbon Generation 6.

$ dmesg | grep -i acpi | grep 'ACPI: (supports'
[    0.216048] ACPI: (supports S0 S4 S5)
cat /sys/power/mem_sleep
[s2idle]
cat /sys/power/state

$ sudo dnf install iasl cpio
$ sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.aml
$ iasl -d dsdt.aml
$ patch --verbose < Downloads/X1C6_S3_DSDT.patch
$ iasl -ve -tc dsdt.dsl
$ mkdir -p kernel/firmware/acpi
$ cp dsdt.aml kernel/firmware/acpi
$ find kernel | cpio -H newc --create > acpi_override
$ cp acpi_override /boot
$ sudo grubby --args="mem_sleep_default=deep" --update-kernel /boot/vmlinuz-4.15.6-300.fc27.x86_64
$ sudo grubby --initrd="/acpi_override /initramfs-4.15.6-300.fc27.x86_64.img" --update-kernel /boot/vmlinuz-4.15.6-300.fc27.x86_64

Update BIOS settings (TB3 and Secure Boot)

Mar 05 22:27:18 nomad kernel: ACPI: DSDT ACPI table found in initrd [kernel/firmware/acpi/dsdt.aml][0x23300]
Mar 05 22:27:18 nomad kernel: Lockdown: ACPI table override is restricted; see man kernel_lockdown.7
Mar 05 22:27:18 nomad kernel: ACPI: kernel is locked down, ignoring table override
Mar 05 22:27:18 nomad kernel: ACPI: Early table checksum verification disabled

Successful:

$ dmesg | grep DSDT
Mar 05 23:00:11 nomad kernel: ACPI: DSDT ACPI table found in initrd [kernel/firmware/acpi/dsdt.aml][0x23300]

$ dmesg | grep -i acpi | grep 'ACPI: (supports'
[    0.131256] ACPI: (supports S0 S3 S4 S5)

$ cat /sys/power/mem_sleep
s2idle [deep]