# Getting suspend and resume to work on a 2017 Macbook Pro

> My system is a MacbookPro (14,1) and I've tested this process on the following distributions.  This may work for other systems and other distributions - if so, let me know.
>
> Ubuntu 22.04 LTS
> Ubuntu 23.10


It appears that suspend partially works after installation, but resuming is completely broken. There are three things that need to be done in order to get this all to work. Also, by "work" I mean that it will function, but it will be pretty slow.  Maybe someone else can work through making this better/faster.

## First, update the graphics drivers.

This system has a builtin Intel Iris graphics card.  I found the update process in Intel's site:

=> https://dgpu-docs.intel.com/driver/client/overview.html Update your graphics drivers using this document

Specifically, I used this section: "2.1.2. Client Intel Package Repository Configuration".  In has you update the repo like this...

```
wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \
  sudo gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg
echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | \
  sudo tee /etc/apt/sources.list.d/intel-gpu-jammy.list

sudo apt update
```

After this, I did a "sudo apt upgrade" and rebooted.

## Disable the d3cold PCIe power state

=> https://github.com/Dunedan/mbp-2016-linux?tab=readme-ov-file#suspend--hibernation From here


Create a new script: "/scripts/resume_fix"
This script can really be anywhere, but needs to be executable (so chmod +x that thing).

```
#!/bin/bash 

echo 0 > /sys/bus/pci/devices/0000\:01\:00.0/d3cold_allowed
```

Then create a service for this script so that it runs at startup and as root:

```
sudo nano /etc/systemd/system/resumefix.service
```

Past in the following, but do adjust your script location if needed.

```
[Unit]
Description=Suspend fix

[Service]
ExecStart=/scripts/resume_fix
     
[Install]
WantedBy=multi-user.target
```

Save that file, then start and enable the service like this:

```
sudo systemctl start resumefix.service
sudo systemctl enable resumefix.service
```

## And... let Logind know you'd like to have your system suspend 

Edit "/etc/systemd/logind.conf" and adjust the following settings to all be uncommented and set to "suspend"

```
HandleLidSwitch=suspend
HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=suspend      # Not sure about this one so mess around with it.
```

One more reboot and ytou're done.  It should work now.


I hope this helps.

> Tregast (the Bumbling) | tregast@sdf.org