A non-graphical guide to getting your damned Ubuntu MacBook to suspend and hibernate

So I finally got my white MacBook to do almost all the things I wanted it to, all at once.

  • Suspend
  • Hibernate
  • Wireless

I tried nearly everything suggested in the forums online, to no avail. It got to the point where I decided to reformat my system, install Ubuntu all over again, and take a methodical approach. It worked, but with many hours.

So in the interest of encouraging others to run out, buy a brand new MacBook, and install Ubuntu onto it, here’s what I did.

(Caveat: A lot of this came from the Ubuntu Community MacBook page, which you should always check for updates before going through something like this.)

Step 1. Build and install a custom kernel image

I’ll note here that even though all my commands refer to 2.6.20-15, I still wound up with a kernel marked as 2.6.20-16. It works anyways.

  1. cd /usr/src
  2. sudo apt-get install linux-kernel-dev fakeroot m4
  3. sudo apt-get source linux-image-2.6.20-15-generic
  4. sudo apt-get build-dep linux-image-2.6.20-15-generic
  5. (apply the patch described here)
  6. cd linux-image-2.6.20_2.6.20
  7. export AUTOBUILD=1
  8. sudo debian/rules binary-debs flavours=generic
  9. sudo dpkg -i debian/build/linux-image-2.6.20-16-b98-generic_2.6.20-16.29_i386.deb

Step 2. Build and install custom linux-restricted-modules

This was harder. It required more tweaking of configuration files, some of which was available on KernelCustomBuild; other parts, I had to figure out myself.

  1. sudo apt-get build-dep linux-restricted-modules-2.6.20-15-generic
  2. sudo apt-get source linux-restricted-modules-2.6.20-15-generic
  3. cd linux-restricted-modules-2.6.20-2.6.20.5/
  4. (change abi_version to “16-b98″)
  5. sudo debian/rules debian/control
  6. (change flavours declaration to be just “generic”)
  7. (clear the value of vmware_server_extra_flavours)
  8. (clear the value of vmware_tools_extra_flavours)
  9. (change the value of LTMODEM to 0, because it broke)
  10. sudo debian/rules binary
  11. sudo dpkg -i ../linux-restricted-modules-2.6.20-16-b98-generic_2.6.20.5-16.28_i386.deb
  12. sudo dpkg -i ../linux-restricted-modules-common_2.6.20.5-16.28_all.deb

Step 3. Install ndiswrapper

For this, you don’t need my help. You need to look at Glyph’s “MacBookBuntu Take 2″. Just don’t forget the part about adding ndiswrapper to /etc/default/acpi-support, or it’ll stop working after you come back out of suspend or hibernate.

Step 4. Configure Bluetooth?

Before I reinstalled Ubuntu, I couldn’t get dial-up over Bluetooth to work, despite following Glyph’s very illustrated guide. However, with a new kernel, I’m going to give it another try.

But not until tomorrow.

3 responses to “A non-graphical guide to getting your damned Ubuntu MacBook to suspend and hibernate”

  1. Glyph Lefkowitz said on

    Did you figure out *why* it was necessary to build a custom kernel? I am still happily using everything stock, except the 1.43 ndiswrapper module I built to get the version that actually works with the atheros card in C2D macbooks.

  2. Alex Levy said on

    Beats me. The patch disables most of the ata_host_suspend function, so I guess it’s doing something that the new revision of MacBooks doesn’t support. I really hope this stuff all gets ironed out for Gutsy, but right now, it’s functional.

    There is a bug open for this, but it doesn’t have that many more details on why the problem exists: https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.20/+bug/92635

  3. Alex Levy said on

    In case anyone reading this is experiencing a similar problem, I have the third revision of the MacBook line, which came out in May 2007. Glyph has one of the “rev2″ models, which came out November 2006.

Leave a Reply