fiji-flo / x1carbon2018s3

S3 suspend for the X1 Carbon 2018
The Unlicense
165 stars 16 forks source link

GRUB2, without initrd. #14

Closed Yawning closed 6 years ago

Yawning commented 6 years ago

If you made it work with other boot loaders please help out

For what it's worth, GRUB2 can handle installing a DSDT override if configured to do so (acpi /boot/dsdt.aml).

There's a script floating around (I got the copy I used from https://blog.michael.kuron-germany.de/2011/03/patching-dsdt-in-recent-linux-kernels-without-recompiling/) to drop into /etc/grub.d so the entry persists through grub2-mkconfig, though it required a minor edit to work on Fedora.

The downside is that the only way to tell if it's working is to examing /sys/power/mem_sleep, but it saves the hassle of messing with cpio.

dal00 commented 6 years ago

Interesting, this looks simpler. I can have a look in a couple of days perhaps.

komali2 commented 6 years ago

Shit makes no sense, yo

I'll try to use my dumb webengineer brain to parse the above blog into steps that work on ubuntu 18, which comes with grub2

Yawning commented 6 years ago
  1. Stick the patched DSDT in /boot (/boot/dsdt.aml).
  2. Stick the script in /etc/grub.d (This is what I use on F28, YMMV).
  3. Add mem_sleep_default=deep to the kernel command line (Edit /etc/default/grub).
  4. Regenerate the grub.cfg file (Ubuntu seems to do this with update-grub).
  5. Reboot.
  6. cat /sys/power/mem_sleep should look like s2idle [deep].
  7. Ignore the problem forever.
komali2 commented 6 years ago

These instructions were clear, and I had no problem following them. Thank you for writing them out. Unfortunately, they did not work. I have no [deep] in my sys/power/mem_sleep, and attempting to add it manually causes "invalid argument" errors.

I might be incorrectly assuming that this fix works for thinkpad x1 yoga, the same as it works for thinkpad x1 carbon. Ah well.

komali2 commented 6 years ago

I wonder if this is because I had to create the 01_acpi file in /etc/grub.d. I don't know much about anything, but all the other 00_whatever or 10_whatever files are green font colored in the terminal, and mine is white, like the sad little README off to the side :(

komali2 commented 6 years ago

Oh, duh, stat on the file, shows Access: (0644/-rw-r--r--), while the 00_header file, for example, has Access: (0755/-rwxr-xr-x). Now I just need to learn enough about permission stuff to get them identical...

dal00 commented 6 years ago

"sudo chmod 0755 yourfile" should do it! -- Sent from my Android device with K-9 Mail. Please excuse my brevity.

komali2 commented 6 years ago

Haha damn, almost had you beat! I had gotten to the point where I was doing sudo chmod myfile 0755 and was trying to figure out the proper order! Thanks for the help :)

komali2 commented 6 years ago

For others: last time, I didn't see the line Found custom ACPI table: .... which I thought was weird, cause I saw it in the script, but now I do, yay! So when you sudo update-grub, it should look like:

caleb@laptop:/etc/grub.d$ sudo update-grub
Generating grub configuration file ...
Found custom ACPI table: /boot/dsdt.aml
Found linux image: /boot/vmlinuz-4.15.0-29-generic
komali2 commented 6 years ago

Huh, still didn't work, oh well, that was about as valiant an effort as I think is possible. I will monitor this repo to see what else crops up. Thanks @dal00 and @Yawning !

ccressent commented 6 years ago

Just a quick note to say that, using GRUB2 on Arch Linux, I've followed @Yawning's instructions and everything works perfectly fine!

~$ dmesg | grep -i "acpi: (supports"
[    0.557055] ACPI: (supports S0 S3 S4 S5)
~$ cat /sys/power/mem_sleep 
s2idle [deep]

Not sure about the downside @Yawning mentioned in his/her original post.

fiji-flo commented 6 years ago

Closing this, since Lenovo added S3 support.