If you have a one or more frontends scattered throughout your home, then you will want to consider how to reduce the power consumption, both for your wallet's sake and due to the environmental impact. This guide shows you how the author configured a Mythbuntu 8.10 system to realise power savings.

The author is a user of Mythbuntu but has not been associated with its development. This document is the result of lots of searching, reading and testing over many months and builds on, and integrates a lot of work done by other frustrated people.


The author's main objective was to be able to use the remote control to suspend a frontend and have a working system when it was resumed. This really should work 'out-of-the-box' or at least be easy to configure - maybe in a future release!

The possible approaches considered:

  • Shut down the system when you are not using it. Unfortunately starting up Mythbuntu or shutting it down can take some time, and this impacts useability.
  • Suspend to disc - a viable approach.
  • Suspend to RAM - realises a good compromise of power-saving and usability.

Ideally, suspending and resuming the frontend should be initiated using the remote. This guide provides details on the former but not the latter. The author currently uses a key-press to resume the suspended system.

This document also aims to overcome two main problems experienced by the author:

  • The remote not working after a suspend/resume
  • Mythfrontend failing to interact properly with the backend resulting in failed TV playback etc.


The instructions provided here work on Mythbuntu 8.10 and have not been tested on other versions, though they are generic enough so they should work with most recent releases.

These instructions are not suitable for a system that runs a Mythtv backend server as it will interfere with recording programs.


Modify Mythtv main menu

The solution chosen to allow the suspend action to be initiated by the remote was to add a mainmenu option. To do this, you need to edit /usr/share/mythtv/mainmenu.xml and add the following lines where it suits you:

     <text>Power off MythTV</text>
     <action>EXEC /mythtv/common/scripts/mythtv-suspend </action>

The script /mythtv/common/scripts/mythtv-suspend is one that we will create, and its name and location are obviously up to you.

A good reason to use a main menu option to suspend the system is that it forces the users to exit live-TV playback. Suspending in the middle of live-TV playback can cause backend tuners to remain allocated and no longer be available to other frontends. This normally requires the backend service to be restarted.

Create script used by pm-utils

Create the script /usr/lib/pm-utils/sleep.d/01mythtv and give it the same permissions as other scripts already in the folder. Add the following contents:


. /usr/lib/pm-utils/functions

case "$1" in
    # kill existing mythfrontend as it will more than likely not work correctly after resume
    killall mythfrontend.real
    # unload lirc modules (specific to your setup - see /etc/lirc/hardware.conf, REMOTE_MODULES=...)
    # this is needed when the remote fails to work after a resume
    modunload lirc_dev lirc_mceusb2

    # reload lirc modules (see comments above)
    modreload lirc_dev lirc_mceusb2
    # restart mythfrontend
    sudo -H -u mythtv sh -c 'DISPLAY=:0.0 /mythtv/common/scripts/mythtv-resume'

The author uses a Windows Media Center remote and the reader will need to customise the script if another remote type is used. Open the file /etc/lirc/hardware.conf and use the modules identified in the REMOTE_MODULES= command in the modunload and modreload lines.

The final sudo line must be customised by modifying the -u mythtv to specify the name of the logged in user that the frontend runs under.

Note that the frontend is killed by the suspend action and will be restarted when the system is woken. This is done to ensure that the frontend is fully functional after a suspend.

Create the suspend script

Create the script /mythtv/common/scripts/mythtv-suspend. Note that the name and location are up to you, just make sure that its executable by the running user. Also, this script gets invoked by the changes made to the frontend mainmenu so make sure that the same filename is used.

# Handle mythfrontend suspend

# unmount network (CIFS) file systems (obviously system specific)
sudo umount -a -t cifs 

# Handle mythfrontend suspend - the pm-suspend script has options that are worth checking out:
sudo /usr/sbin/pm-suspend

The author mounts network shares to have common access to videos, music etc. These are mounted as CIFS filesystems. The author has experienced incidents of problems shutting down and suspending with these shares mounted, so they are unmounted before the suspend action is taken.

Create the resume script

Create the script /mythtv/common/scripts/mythtv-resume. Note that the name and location are up to you, just make sure that its executable by the running user. Also, this script gets invoked by the 01mythtv script so make sure that the same filename is used.

# Handle mythfrontend resume

# allow time for network to re-establish
sleep 3
# remount any CIFS file systems unmounted in suspend action
sudo mount -aF -t cifs
/usr/bin/mythfrontend &

Modify sudo security

Many of the actions performed in the scripts require sudo rights. The soultion would not be workable if the user is prompted for the sudo password. The sudo command can be configured to not prompt for a password by changing /etc/sudoers. The reader is encouraged to read up on the security implication of any changes made to this file before implementing the changes described here.

Add the following line to /etc/sudoers:

        %admin ALL=NOPASSWD: ALL
  • or something similar that fits your security profile. You could list just the commands that you want to allow to run without a password.

In this case members of the admin group don't need to supply a password for any sudo command, thus we need to make sure that the mythfrontend user is a member of the admin group.



The following aspects should be further refined or implemented:

  • Adding support for resume by remote. This will probably never be fully implemented, as it is very hardware dependent, requiring changes to BIOS settings, lirc configuration changes and probably more. The author has set his system BIOS to allow any key to bring the system out of suspension and that is a 90% solution that may be suitable for some readers.

  • Better integration with Mythtv. Directly changing files like mainmenu.xml is problematic as changes to themes will likely kill the changes that you made. Ideally, the theme files would be updated.
  • Integrate with a frontend/backend power saving solution. Some of the answers are here.


This document has described how the reader can modify a Mythbuntu system to suspend and resume the system in a manner that is relatively user-friendly, overcomes problems with remotes not working and hanging frontends, and will save power.

There are probably more elegant ways of doing this, but the author has yet to discover them. Knowledgable readers are encouraged to refine and update the instructions presented here.

CategoryInstallation CategoryPowerManagement

MythTV/PowerSaving (last edited 2009-01-29 21:34:48 by ron-simdata)