Mythbuntu 10.10 PART 3 – Storage Groups and Automatic Wake-up/ Shutdown

Previous Articles in this Series:

Installing Mythbuntu in Ubuntu 10.10 with a Hauppauge Nova-T 500 PCI DVB-T

Installing Mythbuntu 10.10 with a Hauppauge Nova-T 500 PCI DVB-T card: PART 2 – Configuration

Having created a working PVR in the previous two articles, in this one we are going to:

  • Configure Storage Groups on a separate partition
  • Set-up MythTV Automatic Wake-up/ Shutdown

Storage Group Configuration

Storage groups are lists of directories which allow you to store MythTV recording files.

When installed the following storage groups are created:

  • Default
  • LiveTV
  • DB Backups
  • Videos
  • Trailers
  • Coverart
  • Fanart
  • Screenshotsunder
  • Banners

Their default storage location is under /var/lib/mythtv/groupname, except Default which stores its files in the directory called recordings.

If your system drive is rather small, you may wish to add an additional hard disk and set-up MythTV to store the above groups on that drive.

Note: these instructions assume that you have not yet used MythTV to record any programs. If you have then you may find that recordings stored in the original location may not be accessible, in which case you will need to move them.

You can add additional directory locations (mount points) in each of the storage groups. MythTV will balance concurrent recordings across the available locations detailed in the storage group in order to balance the I/O load.

When adding additional mount-points to storage groups you must set folder permissions so that the group mythtv has full read/ write access to the drive otherwise MythTv will not work.


You have a second hard disk in your PC which you have set-up in /etc/fstab to mount as /media/data (see Ubuntu Community Documentation on fstab and mounting disks).

Rather than having MythTV store your recordings on your system disk, you want it to store the recordings in a directory called /media/data/mythtv which you have just created using the command

sudo mkdir /media/data/mythtv

Create the directories listed in the screen-shot below in /, these are the same directories found in /var/lib/mythtv/, using the command mkdir /media/data/mythtv/directory name

For example

mkdir /media/data/mythtv/banners

The above directories have to be a member of the Group mythtv, otherwise mythtv will not work as it does not have permission to access these directories. By default it does not have permission.

To do this:

Open Terminal and enter the following to make the directories Recursively Read/ Write for the Owner; Group and Read Only for Others:

sudo chmod -R 775 /media/data/mythtv

then change both the owner and group to mythtv and do this Recursively for all sub-directories:

sudo chown -R mythtv:mythtv /media/data/mythtv

The permissions for the newly created should directories look similar to those in the screenshot below

To double check, open up the file manager Thunar (if you are using Mythbuntu) Applications > Accessories > Thunar File Manager

Navigate to the mythtv directory created above and right click on one of the newly created directories e.g. banners

Select properties from the drop-down menu, and on the properties window select the Permissions tab.

You should see the following

Close the properties window and the Thunar file manager.

Launch Accessories > System > MythTV Backend Setup

Select option 6. Storage Directories

Then starting at the top and working through.

To change the location, select the Storage Group name, pressing <Enter>, then pressing <Enter> again on the directory name (e.g. /var/lib/mythtv/recordings).

For the Default group change the entry to something similar to that in the screen shot below

Select OK

You should now see the new path for the default Storage Group directories.

Press <ESC> to go back to the list of groups.

Now repeat the above process for the next storage group until all have been changed.

<ESC> out of the MythTV Backend Setup in the usual way, and allow mythfilldatabase to run.

Now test that this all works by launching MythTV Frontend and watch some TV.

If you select Watch TV and you just get a black screen and are then reverted back to the main menu, then you have not set-up your directory permissions correctly. MythTV, even when recording writes files into these folders enabling you to rewind live TV or record a program you already partly watched, in full.

Set-up MythTV Automatic Wake-up/ Sleep

By default MythTv is set-up to run 24/7, which may be convenient for you but not great for the environment or if you want to keep down how much you spend on electricity! It can cost over £300 a year keep a PC running 24/7!

The good news is that this is not necessary with MythTV. If you use the ACPI Wakeup feature which comes as standard with most PC BIOSs manufactured in the past 7 years, your PC will automatically wakeup before a recording and shutdown/ suspend after the recording has completed.

The instructions below are a summary of those those found in the MythTV Wiki

Testing whether ACPI Wakeup works on your PC

From Terminal enter

grep -i rtc /var/log/kern.log

You should see something similar to

kernel: [ 0.474924] rtc_cmos 00:04: RTC can wake from S4


kernel: [ 0.474987] rtc0: alarms up to one year, y3k, 242 bytes nvram

The above means that your PC can wake up and that the wakeup time can be set.

You will now need to check the BIOS in the Power Management section (see MythTV Wiki for more details)

With your BIOS configured you now need to disable the HWclock updates. As we are using Mythbuntu we will use the Ubuntu instructions:



Comment out the line exec hwclock so it looks like the following:

# exec hwclock –rtc=/dev/rtc0 –systohc $tz –noadjfile $badyear

To manually test wakealarm, enter the following commands from Terminal which will wake up the PC 5 minutes after the commands are entered. As the kernel shipped with Mythbuntu 10.10 uses kernel 2.6.35, we will use /sys/class/rtc/rtc0/wakealarm.

Enter the following:

sudo su

echo 0 > /sys/class/rtc/rtc0/wakealarm

echo `date '+%s' -d '+ 5 minutes'` > /sys/class/rtc/rtc0/wakealarm

To check that this has been set correctly enter

cat /proc/driver/rtc

Check the alrm_time field is set to 5 minutes into the future.

Now shutdown your computer and see if it starts back up after approximately five minutes by entering

sudo shutdown -P now

On the basis that the above test worked (if not reference the instructions in the Wiki ) we are now ready to set up this functionality in MythTV.

MythTV Back-end Configuration

From Terminal run


This will shut-down the MythTV back-end and run the set-up program.

From the menu, select 1. General

Keep selecting Next> until you get to the Shutdown/ Wakeup Options menu

and change the default setting so that they look like the following:

  • Untick Block shutdown before client connected
  • Set idle shutdown timeout (secs): 120 (2 minutes although you can make this longer or shorter if you wish)
  • Set Max. wait for recording (min): 15 (you can make this longer or shorter if you wish)
  • Set Startup before rec. (secs): 600 (If you have not disabled the occSave the file.asional disk check on boot, make this time long enough to complete the boot & disk check before the recording should start)
  • Set Wakeup time format: time_t
  • Set Command to set Wakeup Time: sudo sh -c “/usr/bin/ $time” xtube
  • Set Server halt command: sudo shutdown -P now
  • Set Pre Shutdown check-command: mythshutdown –check

The results should look similar to the following screen-shot

Comprehensive information on the various settings on this screen as well as the other General screens can be found in the MythTV Wiki under User_Manual:Detailed_configuration_Backend

Now keep selecting Next> until you get to Finish and select it. You will be returned to the main menu.

Press ESC to exit mythtv-setup and allow it to run mythfilldatabase to complete.

The backend is now configured, we now need to configure the front-end!

MythTV Front-end Configuration

As our Mythbuntu configuration is for a combined Frontend/ back-end there are two options:

  1. Follow the Desktop users instructions in the Wiki
  2. Use Mythwelcome

I’ve found Mythwelcome to be easier to use and understand and it tells you what MythTV is doing, so this is the option we will use for this tutorial.

The first thing we need to do is set-up Mythwelcome to automatically run at start-up

Edit /etc/mythtv/session-settings as sudo

Remove the # from in front of MYTHWELCOME=true

Save the file

We are now going to add Mythwelcome to the list of applications which auto-start on boot-up

From the desktop click on Applications > Settings > Session and Startup and select the Application Autostart tab.

It should look like the following

Click +Add

A Add Program window will appear and compete as follows:

Name: MythWelcome

Description: Startup for MythTV

Command: mythwelcome

Save the changes and exit.

We are now going to setup mythwelcome.

In terminal enter mythwelcome – -setup

We now need to configure Mythwelcome.

Open Terminal and enter

mythwelcome –setup

Configure as follows:

Command to set wakeup time: sudo sh -c “/usr/bin/ $time”
wakeup time format: time_t
nvram-wakeup Resart Command: make sure this is blank
Command to reboot: sudo -H shutdown -h -r now
Command to shutdown: sudo -H shutdown -P now
Command to run Xterm: xterm
Command to run to start the Frontend: /usr/bin/mythfrontend

It should look like the following screenshot

We are now going to create the wakeup script.

Open the following file as sudo in your text editor:


and copy and paste the following:



# set ACPI Wakeup time

# usage: seconds

# seconds – number of seconds from epoch to UTC time (time_t time format)


# set UTCBIOS to true if bios is using UTC time

# set UTCBIOS to false if bios is using local time


%mythtv ALL = NOPASSWD: /sbin/shutdown, /bin/sh, /usr/bin/, /usr/bin/mythshutdown



#utc bios – use supplied seconds



#non utc bios – convert supplied seconds to seconds from

#epoch to local time

SECS=`date -u –date “\`date –date @$1 +%F” “%T\`” +%s`


echo 0 > /sys/class/rtc/rtc0/wakealarm # clear alarm

echo $SECS > /sys/class/rtc/rtc0/wakealarm # write the waketime

Save the file.

We now need to change the permissions of the file so it can be executed. From Terminal enter:

sudo chmod +x /usr/bin/

Add the following line to your /etc/sudoers by entering sudo visudo and then copying and pasting the line at the end of the file the following line:

%mythtv ALL = NOPASSWD: /sbin/shutdown, /bin/sh, /usr/bin/

Save the file.

From Terminal enter mythwelcome, a screen similar to the following will be displayed

Press m on the keyboard, the following screen will be displayed

Select Lock Shutdown and press Enter.

If you did not do this, then your Mythbuntu PC would automatically shut itself down!

When you have finished working on the Mythbuntu PC, repeat the above but this time select Unlock Shutdown.

The PC will then shut itself down according to the parameters set above for MythTV, you will see a screen similar to that below with a countdown from 180 seconds.

The first few times you run MythTV you may find that the countdown restarts when it gets close to 10 seconds left, whilst frustrating this seems to be normal behaviour for a new install.

MythTV is now configured for ACPI Wakeup/ Shutdown, we just need to test it for real!

A Final Test – Recording a Program!

Personally I place a Mythwelcome icon on the desktop, alternatively open up Terminal or press ALT-F2 and enter mythwelcome, the following screen will be displayed (you may need to Lock Shutdown to prevent MythTV from shutting down the PC).

Select Start Frontend, the following menu will be displayed.

As we are interested in managing our recordings, select the Manage Recordings menu items.

Select Schedule Recordings and then select Programme Guide in the subsequent menu.

A screen similar to the following will be displayed

Select a programme in the guide which you wish to record and then press enter.

The following screen will be displayed

Once in this recording menu, you will seeSave the file. that the default option is Do not record this programme. Choose an appropriate recording option.

The full set of options are as follows:

  • Do not record this programme
  • Record only this showing [S] at this specific time and this station
  • Record one showing of this title [F] from any of the times which appear in the TV listing (no good for episodes)
  • Record in this timeslot every week [W] records weekly, same channel, day and time ignoring title and program information
  • Record one showing of this title every… [F}
  • Record in this timeslot every day [T]
  • Record one showing of this title every day [F] Record one showing of this show a day based on the program title
  • Record at any time on this channel [C] Records a show any time the title appears on this station
  • Record at any time on any channel [A]

More information is available on these options at the MtyhTV Wiki

In addition to the above you have Schedule Options. Which help refine way in which the recording is made, and preventing duplicate recordings.

As the broadcasters can be very unreliable for starting and ending their programs on time, I set recording to start and end 1 minute early.

The Post Processing menu allows you to do set the following options

Probably the two most useful options here is Commercial removal and transcoding the recording.

The MythTV Wiki has excellent documentation on “Using A Myth Box From Day To Day” which clearly explains how to fully use MythTV for day to day recordings, including using the remote control. This is well worth reading.

When you have finished setting up your recordings, ESC back to the Welcome to MythTV screen and remember to select Unlock Shutdown by pressing m.


If you try to shutdown the MythTV PC less than 20 minutes before it is due to perform a recording, it will not shutdown as it will not consider itself to be in an idle state.

The following keys are useful in all MythTV menus

  • m for menu
  • i for information
  • e for edit

Final Comment

I was going to include configuring the remote control in this article, but on investigation it appears be be a complete “train crash” mainly because the 1.20 driver does not work with the remote and you need to downgrade the driver. If you are feeling brave, try what is suggested in this post in Ubuntu Forums for Mythbuntu. When I get some more time I’ll look into this again.

Powered by Blogilo


6 thoughts on “Mythbuntu 10.10 PART 3 – Storage Groups and Automatic Wake-up/ Shutdown

  1. The remote does work with the new firmware, it’s just handled differently. Under /dev/input/by-path you should see a filename along the lines of pci-whatever-ir with the final -ir as the indicator. Edit /etc/lirc/hardware.conf to replace the default filename of /dev/lirc0 with this the name you just found.

    Another approach is to run

    dpkg-reconfigure lirc

    and select the filename there.

  2. Further comment on remotes:
    The remote depends on the firmware being loaded. The firmware is only loaded after a cold boot. The reboot command may do a warm boot so after installing the firmware package you will need to power down and restart the computer otherwise the firmware might not be reloaded and neither the remote nor the tuners will work.

    1. Ian,

      Like all iconic products, myths are created about how things happen. Getting the stock remote to work seems to be one of them. Maybe that is why MythTV is called what it is called!

      Thank you for you comments, I’ll give it a try.

  3. In the above, when you wrote:

    sudo chown -R mythtv:mythtv /media/data/mythtv

    one of the mythtv is the user and one is group.

    which is which?

  4. We’re a group of volunteers and starting a new scheme in our community. Your site offered us with valuable info to work on. You’ve done
    an impressive job and our entire community will be grateful to you.

Leave a Reply

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

You are commenting using your 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