Fixing Suspend in Xubuntu on the Acer C720 – A Simplified Guide

I am posting this guide as a point-in-time assist after the release of Ubuntu 14.04, to help those looking to fix suspend in Xubuntu on their C720s (and any Chromebook with Haswell architecture or similar hardware). I will do my utmost to keep this updated, but keep in mind that this post is not my first priority. Please remember that messing about with your system instructions can create horrible problems, for which you are responsible – no one is forcing you to make these changes. If they are very intimidating to you, do not take these steps and stick with crouton or ChrUbuntu! If you have anything to add, please let me know. I welcome help and criticism as it helps all of us with our knowledge.   Things to keep in mind:

  • I am not an experienced coder – I understand the instructions below because I have scripting/coding experience, but I am presenting this only to help those who have little to no experience.
  • I am only one person, so have a little patience – I am doing this only as a service to help you, and cannot do much in the way of troubleshooting. If you are having problems, make sure to present them on the G+ post.
  • As the Ubuntu kernel updates, (ie, 14.04.1) I will try to test if anything is broken – I may miss something, so let me know.

My article is derived from the following reddit post: http://www.reddit.com/r/chrubuntu/comments/1rsxkd/list_of_fixes_for_xubuntu_1310_on_the_acer_c720/ After you have followed the guide for installing Xubuntu, make sure to make corrections in order, as suggested in the reddit post. Specifically, you may have trouble with suspend (closing the lid will cause a lock-up requiring a cold start). Here is all the info you need: https://plus.google.com/113736371980021233804/posts/6CgQypQukMa However, after many responses and corrections, you may find the Google+ post by Pedro Larroy a bit confusing. Here’s a distilled version:

add the following to the kernel boot parameters in /etc/default/grub reload grub via update-grub

add_efi_memmap boot=local noresume noswap i915.modeset=1 tpm_tis.force=1 tpm_tis.interrupts=0 nmi_watchdog=panic,lapic

This fix was originally suggested for an earlier kernel – but it has been superseded/replaced by the following scripts, so you will have to make some fixes for Xubuntu 13.10 (stable) or Xubuntu 14.04 . Do not enter the lines above. Only use what I have posted in code below. After making the changes originally posted by Pedro, skip down to the Mike Lim response (I have added formatting to make it easier to read. Hopefully my formatting will work and terminal entries will appear properly):   1. Creating 05_Sound file under /etc/pm/sleep.d/

sudo gedit /etc/pm/sleep.d/05_sound
#####################
#!/bin/sh
# File: "/etc/pm/sleep.d/05_sound"
case "${1}" in
hibernate|suspend)
# Unbind ehci for preventing error
echo -n "0000:00:1d.0" | tee /sys/bus/pci/drivers/ehci-pci/unbind
# Unbind snd_hda_intel for sound
echo -n "0000:00:1b.0" | tee /sys/bus/pci/drivers/snd_hda_intel/unbind
echo -n "0000:00:03.0" | tee /sys/bus/pci/drivers/snd_hda_intel/unbind
sleep 1
;;
resume|thaw)
# Bind ehci for preventing error
echo -n "0000:00:1d.0" | tee /sys/bus/pci/drivers/ehci-pci/bind
# Bind snd_hda_intel for sound
echo -n "0000:00:1b.0" | tee /sys/bus/pci/drivers/snd_hda_intel/bind
echo -n "0000:00:03.0" | tee /sys/bus/pci/drivers/snd_hda_intel/bind
sleep 1
;;
esac
#################
sudo chmod +x /etc/pm/sleep.d/05_sound

2. rc.local editing

sudo gedit /etc/rc.local
#############################
echo EHCI > /proc/acpi/wakeup
echo HDEF > /proc/acpi/wakeup
echo XHCI > /proc/acpi/wakeup
echo LID0 > /proc/acpi/wakeup
echo TPAD > /proc/acpi/wakeup
echo TSCR > /proc/acpi/wakeup
echo 300 > /sys/class/backlight/intel_backlight/brightness
rfkill block bluetooth
/etc/init.d/bluetooth stop
##############################

IMPORTANT: make sure that your script ends with “exit 0” – no quotes. Do not remove this line!   3. grub editing

sudo gedit /etc/default/grub
######################################
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash tpm_tis.force=1"
######################################

4. update grub

sudo update-grub
sudo update-grub2

IMPORTANT – for those with little to no programming/scripting experience: Hash marks (#) represent “commenting out” – anything following the hash mark on a line will be ignored. Be aware that the comment lines are not necessary, but should be included. Comments help you keep track of what changes you’ve made. This should work perfectly for 13.10, but if you find you have trouble, go back to the G+ post and read through some of the issues. For instance, I keep bluetooth shut off, and have never had the bluetooth issues described in the responses. For those of you using 14.04, the following response from Jimmy Capizzi should addresses additional issues found with suspend. Again, make sure to update grub after you are finished:   1. create sound suspend file in /systemd

sudo mkdir /usr/lib/systemd/system-sleep/
sudo gedit /usr/lib/systemd/system-sleep/cros-sound-suspend.sh
#####################################################
#/usr/lib/systemd/system-sleep/cros-sound-suspend.sh
#!/bin/bash
case $1/$2 in
pre/*)
# Unbind ehci for preventing error
echo -n "0000:00:1d.0" | tee /sys/bus/pci/drivers/ehci-pci/unbind
# Unbind snd_hda_intel for sound
echo -n "0000:00:1b.0" | tee /sys/bus/pci/drivers/snd_hda_intel/unbind
echo -n "0000:00:03.0" | tee /sys/bus/pci/drivers/snd_hda_intel/unbind
;;
post/*)
# unBind ehci for preventing error
echo -n "0000:00:1d.0" | tee /sys/bus/pci/drivers/ehci-pci/unbind
# bind snd_hda_intel for sound
echo -n "0000:00:1b.0" | tee /sys/bus/pci/drivers/snd_hda_intel/bind
echo -n "0000:00:03.0" | tee /sys/bus/pci/drivers/snd_hda_intel/bind
;;
esac
#####################################################

Save the gedit file, and you are done. Restart your Chromebook and test suspend. Hopefully, this is helpful to you. It’s a lot to take in and digest through various links, but my intent is only to help clarify for beginners. I welcome all feedback! I really hope this helps simplify your Xubuntu installation on your Chromebook. Good luck!

EDIT (2014-06-11) – I have made a few formatting corrections to the code. I did not realize that I was getting leading spaces on the lines until I copied and pasted code from this article to a new Kubuntu installation on the C720. Also added a line to the Mike Lim fix (last bit of scripting) to make the appropriate directory (see comments for this article). I can confirm that, as of the writing of this edit, suspend works properly using Kubuntu 14.04 and the now current kernel, if you follow these steps. The ChruBuntu installation will default to Kubuntu 12.04 LTS, but I “upgraded” to 14.04 to avoid compiling random kernels.

EDIT (2014-08-12) – I have added the “sleep 1” statements from the G+ post referenced in this article to the “05_sound” script as suggested in the comment made by Michael Conner. I was aware of this fix when I originally wrote this post, but did not see much positive feedback on G+ (and it appeared to be superseded by later fixes), so I left it out of the original script. I can confirm that there are no more wonky responses to sleep/suspend regarding sound after minimal testing. Thanks to Michael for checking in and testing on his own!

Advertisements

35 thoughts on “Fixing Suspend in Xubuntu on the Acer C720 – A Simplified Guide

  1. The suspend in systemd (Last step for 14 ubuntu) Does not work, the directory for sleep is not there, not allowing me to save.

    1. The file does not exist because you have not created it yet.

      Do the following:

      Copy paste this into a terminal session:
      “sudo gedit /usr/lib/systemd/system-sleep/cros-sound-suspend.sh”

      At this point, you should be prompted for your root password and when that is provided, a “gedit” window will open (text editor with root permissions, due to the “sudo” command). Copy paste the text from my article above and click save.

      If you just open a text editor window, and copy/paste it will not save because you have not opened it with root permissions.

      If the cammand above does not work, make sure you have gedit installed by typing:

      “sudo apt-get install gedit” in a terminal window.

      Let me know if this helps.

      1. Could not find the file “/usr/lib/systemd/systerm…eep/cros-sound-suspend.sh”.

        A gedit window does appear.

  2. Run this to create the directory:

    sudo mkdir /usr/lib/systemd/system-sleep

    Then run the below to create the file :

    sudo gedit /usr/lib/systemd/system-sleep/cros-sound-suspend.sh

  3. Hi!

    Trying this out on the c720, running on chrubuntu 14.4, with kernel 3.14.4. Before rebooting, I just wanted to let you know that you do seem to have a formatting issue: when copy&pasting the code from firefox to gedit, i get ‘smart quotes’ intead of normal ” ones.

    Are you using the tag?

    1. I will attempt to correct the formatting shortly – I noticed someome had mentioned the issue on a reddit post in /r/chrubuntu, but I am not familiar with “smart quotes,” so I wasn’t sure what needed correcting. Hopefully you’l see the change within the next hour or so.

      1. Yeah – I collected this info and tested prior to the release of 3.14.4, I think. Doesn’t Chrubuntu normally include an earlier code kernel?

    1. Glad to hear – really just wanted to help, since the G+ page looked like it was starting to confuse people a bit, and I really think Chromebooks make excellent Linux laptops, for the most part.

  4. For 14.04 Kubuntu do I do only the Step #1 or do I start with the first Step #1 and go thru 1-4 then run the second Step 1? or replace the 1st Step 1 with the 2nd Step 1? Just a little confusing so I want to make sure before doing.
    Thanks

    1. The steps start with the coding formatted text and you run through all of them in sequence. Suspend will work properly with Kubuntu 14.04, but audio may not return properly, in which case you may need to restart. I am researching a fix for this now.

    2. I have not found a real solution to this. All solutions appear to be for an earlier kernel. Restarting definitely works (and takes very little time). I am currently using a ChrUbuntu install, with an upgrade to Kubuntu 14.04. I have the same issues. The fix may be just to move back to an earlier version/kernel until someone figures this out. Honestly, for me this is not a deal breaker – restarting takes a total of 20 seconds and is almost as good as suspend, in terms of not losing browsing or open app windows. And I prefer the current plasma desktop to earlier versions of KDE in Kubuntu.

      1. Yea, the time to restart isn’t that big of a deal to me either. If a fix where available, sure I would install it,but meanwhile, I’ll get by with with I have just fine.

        Thanks for looking into this though…

  5. Phil, thanks for sharing your expertise!

    I’ve used your solution and it works very well. However, I am trying to enable my Acer C720 to wake from suspend upon input from the keyboard when connected to either the USB 2.0 or USB 3 inputs and while the lid is closed. Perhaps this is too much to ask for but I’d like to use it with an external monitor. Suspend works perfectly well with your solution. However, both the EHCI and XHCI are disabled in /proc/acpi/wakeup. Here’s output from my terminal:

    will@willxubook:~$ cat /proc/acpi/wakeup
    Device S-state Status Sysfs node
    LID0 S4 *disabled
    TPAD S3 *disabled pnp:00:00
    TSCR S3 *disabled pnp:00:01
    HDEF S3 *enabled pci:0000:00:1b.0
    EHCI S3 *disabled pci:0000:00:1d.0
    XHCI S3 *disabled pci:0000:00:14.0

    After a little research I found that these commands will enable EHCI and XHCI so that I can wake my device in the exact way I described above.

    echo EHCI > /proc/acpi/wakeup
    echo XHCI > /proc/acpi/wakeup

    However, EHCI and XHCI will become disabled again upon reboot. Is there a way to ensure that these remain enabled after a reboot? I realize you may not have any advice but your instructions were so close to my issue I thought it was work asking.

    Thanks!

    Will

    1. Hey Will, I will look into this. Seems like someone should have posted a fix to this now. And I totally get it – I have used my C720 for testing media connections in the past and this would frustrate me. And it’s perfectly suitable for a part-time desktop replacement, if that’s your goal.

      Give me a day or two to work some answers out for you.

      1. Thanks so much, Phil!

        My C720 is a transitional machine for me: I’m using it to get my feet wet with Xubuntu and Emacs as my primary writing and organizing tools. It’s been about two months but so far, so good. Eventually, I may choose a laptop with better out of the box hardware support from Xubuntu. But I have actually had a pretty good experience so far. I just don’t understand what continues to disble the /proc/acpi/wakeup settings for EHCI and XHCI.

        Also, keep on trucking with your blog. I have really enjoyed reading it.

        Thanks again!

      2. Will – I know this response is out of Chronological sequence, but I just realized this comment is separate from your comment of 7-19 – something that was not clear to me from my email notifications. I’ll have to monitor the comments a little more closely.

        Here’s my plan: my research for a fix isn’t working out well. I’m going to fix the suspend issues with corrections suggested by Michael Conner, test and post them to the script(s) above.

        Afterward, I will confirm that suspend does not work properly under the conditions you mentioned and see if I can wrap in a fix specifically addressing HDMI.

        Thanks for your continued patience!

      3. Phil, thanks for your reply! I appreciate your sharing what you’ve learned. I’m not at all sure how to troubleshoot it right now. But I am looking forward to the kernel release in late September or early October that should incorporate some other fixes for the C720, like the touchpad. Sorry I can’t cite this now. Not sure where I read it anymore.

        All the best,

        Will

      4. Hey Phil,

        The email I received this prompted me to ask: have you found a way to permanently configure EHCI and XHCI to allow wakeup? Just thought I’d ask.

        Will

      5. Hey Will, sorry to make you wait so long for this response and for my work on the HDMI suspend. Unfortunately, I have not found any quick fixes for this – most articles addressing this are quite old, but I’ll keep looking. I haven’t given up! Yet. 😉

  6. Thanks for this, Phil.

    I noticed that I was having problems with the sound not resuming after suspend. On that Google+ discussion, Hugh Greenberg posted on 10 December 13 that adding two “sleep 1” statements to the 05_Sound script fixed the random sound not resuming thing:

    # File: “/etc/pm/sleep.d/05_Sound”.
    case “${1}” in
    hibernate|suspend)
    # Unbind ehci for preventing error
    echo -n “0000:00:1d.0” | tee /sys/bus/pci/drivers/ehci-pci/unbind
    # Unbind snd_hda_intel for sound
    echo -n “0000:00:1b.0” | tee /sys/bus/pci/drivers/snd_hda_intel/unbind
    sleep 1
    ;;
    resume|thaw)
    # Bind ehci for preventing error
    echo -n “0000:00:1d.0” | tee /sys/bus/pci/drivers/ehci-pci/bind
    # Bind snd_hda_intel for sound
    echo -n “0000:00:1b.0” | tee /sys/bus/pci/drivers/snd_hda_intel/bind
    sleep 1
    ;;
    esac

    Seems to work for me on Mint 17 (14.04 base).

    1. Confirmed with my testing as well. Added the statements to the sleep/resume script “05_sound” and will make a note in the edits section of my post. Thanks for catching this – I am sure it will relieve some frustration of other folks reviewing this post.

  7. Have a fresh Ubuntu 14.04 install on a Chromebook c720p. Everything seems to be working well including suspend/resume! Wow! One strange thing though, is that when shutting down after a resume, it hangs indefinitely and requires forced manual restart followed by power off. Not that big a deal but worth looking into.

  8. Thanks so much for this post! I’ve finally got suspend/resume working properly on my (Ubuntu) Chromebook, meaning I can use it on the train to/from work without having to worry about it not suspending or shutting down properly when I put it in my bag.

    For people who like to automate things here’s a little snippet from my auto-configuration scripts that deploys the scripts in this blogpost:
    # Fixes for suspend/resume from https://philipalban.wordpress.com/2014/04/25/fixing-suspend-in-xubuntu-on-the-acer-c720-a-simplified-guide/
    install -o root -g root -m 755 05_sound /etc/pm/sleep.d/05_sound
    install -o root -g root -m 755 rc.local /etc/rc.local
    mkdir -p /usr/lib/systemd/system-sleep && install -o root -g root -m 755 cros-sound-suspend.sh /usr/lib/systemd/system-sleep/

  9. Good advice.
    I would recomment, that you wrap it like e.g.,:

    if (grep TPAD /proc/acpi/wakeup |grep enabled); then
    echo TPAD > /proc/acpi/wakeup
    fi

    just in case you happe to set the wakeup-options multiple times.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s