Skip to content

Instantly share code, notes, and snippets.

@janl
Created April 18, 2025 11:16
Show Gist options
  • Save janl/9afd5f06cf5f144a2cf9afbd79bfc3bb to your computer and use it in GitHub Desktop.
Save janl/9afd5f06cf5f144a2cf9afbd79bfc3bb to your computer and use it in GitHub Desktop.

systemd oneshot service to set sleep boolean on Apple Macbook Pro disks Original by Pier Lim. Posted at https://kerpanic.wordpress.com/2018/03/13/apple-keyboard-get-function-keys-working-properly-in-ubuntu/

/etc/systemd/system/fix_sleep.service:

[Unit]
Description=Job that disables sleep from stopping nvme hardware on MBP

[Service]
ExecStart=/sbin/fixsleep
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

And the actual script:

/sbin/fixsleep:

#!/bin/bash
/bin/echo 0 > /sys/bus/pci/devices/0000\:01\:00.0/d3cold_allowed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment