Select Page
MythTV Tips: Clear Job Queue via MySQL and Removing Stuck Recordings

MythTV Tips: Clear Job Queue via MySQL and Removing Stuck Recordings

Had an issue where we had stuck items in the Job Queue. Found that these can easily be removed via the MythTV Frontend, but to do them in mass, MySQL is the way to go. Log into mysql into the mythconverg DB and:

TRUNCATE Table jobqueue;

To remove older recordings that may be stuck in MythTV issue the following MYSQL command:

 DELETE FROM recorded WHERE starttime < ‘YEAR-MONTH-DAY 00:00:00’;

Finally, we had to rework the naming schema using STARTTIMEUTC. So now the user job reads:

/usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl –link /LOCATION/TO/STORE –chanid “%CHANID%” –starttime “%STARTTIMEUTC%” –format ‘%cN-%T-%S-%m%d%y-%G-%i-%s’

HVR2250 Causing Error: getting frontend signal strength failed – Mythbuntu 12.04/14.04

For the past month I have been having issues with my Mythbuntu DVRs. In all systems I was experiencing an odd issue where sometimes the tuners (HVR 2250) would not lock to channels (on both Mythbuntu 12.04 and 14.04). I would confirm the signal strength with a tester, but to no avail. What was more annoying, was that the errors were seemingly random – different channel, different tuners on different days. I would come in and see this:

LockingError

Failed recordings would show up as 0 bytes and with no thumbnail.  When looking at the logs, I did finally find:

E SignalMonitor dvbchannel.cpp:1022 (GetSignalStrength) DVBChan(3:/dev/dvb/adapter1/frontend0): Getting Frontend signal strength failed.#012#011#011#011eno: Invalid argument (22)

And this brought me to Google, only to find that others have had this issue with these Hauppauge tuners:

After looking into the EIT Scan options, I could not find teh direct cause. So, I started experimenting with different tuners.

Changing to HD Homerun tuners has COMPLETELY SOLVED this issue. This leaves me to believe that there is an issue with the drivers/firmware used for the HVR22550 – especially when used with alongside multiple tuners.

Fix Mythlink.pl user jobs in Mythbuntu 14.04

After my upgrade from 12.04 to 14.04 I found that my rename user job via Mythlink.pl was completing successfully but not actually creating the symlink. After some digging I found this is due to using %STARTTIME% in the userjob. Post 0.26+ %STARTTIMEUTC% is required. After fixing that, your user jobs will work again!

 

Fixing: incrementally starting raid arrays

I ran into an issue on a specific Mythbuntu 14.04 machine where the RAID was halting the system on boot-up giving the following error:

incrementally starting raid arrays
mdadm: Create user root not found 
mdadm: create group disk not found 
incrementally started raid arrays

If CTRL-ALT-DEL was pressed, the machine would reboot like normal and the RAID would appear to be OK. After much searching I came across the cause and the fix of this MDADM issue.

FROM: http://serverfault.com/questions/593734/mdadm-boot-error-incrementally-starting-raid-array-ubuntu-server-14-04

The problem was that mpt2sas.ko was not loaded, and thus mdadm couldn’t see any disk. This in turn was caused by a packaging error: when apt was removing unneeded wlan packages like crda, it also auto-removed the linux-image-extra-$VERSION package, which actually owns mpt2sas.ko.

To ensure, that the module gets loaded before the raid modules, I also did a

echo mpt2sas >>/etc/initramfs-tools/modules

After that, reboot and all is fixed!

Ubuntu 14.04 Samba Configuration Writable Share

Full writable samba share for 14.04. Edit /etc/samba/smb.conf :

[sourcecode language=”plain”]
[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = SERVERNAME
security = user
map to guest = bad user
dns proxy = no
#============================ Share Definitions ==============================
[SHARENAME]
path = /path/to/share
browsable =yes
writable = yes
guest ok = yes
read only = no

[SHARENAME2]
path = /path/to/share
browsable =yes
writable = yes
guest ok = yes
read only = no
[/sourcecode]

 

Software RAIDs over 2TB in Ubuntu 14.04 – The Easy Way!

Setting up and dealing with software RAIDs in Linux can be a pain – especially if you have drives over the old 2TB limit. After many setups over the years, here is the best way on Ubuntu systems (or any system that uses MDADM).

If you drives are over 2TB in size start at step 1, otherwise skip to step X. In this example,. I have the OS installed to /dev/sda1 , the RAID1 I want to set up include 4TB drives on /dev/sdb and /dev/sdc:

1. Verify the drives are labeled what you thought: fdisk -l /dev/sdb  AND fdisk -l /dev/sdc

2. To create a partition start GNU parted: 

  • parted /dev/sdb
  • (parted) mklabel gpt
  • Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?Yes/No? yes
    (parted)
  • (parted) unit TB
  • (parted) mkpart primary 0.00TB 4.00TB
  • (parted) print
  • (parted) quit

3. Repeat steps for each drive that will be in the array. In this case just SDB and SDC.

4. Once the large partitions are in place, format the drives with: mkfs.ext3 /dev/sdb1 AND mkfs.ext3 /dev/sdc1

5. Now that all the partitions are set up, and those partitions have been formatted, it is time to set up the array using MDADM.

6. Install MDADM: apt-get install mdadm

7. Install MDADM web admin (makes everything easy):

  • On Ubuntu, create the following file: /etc/apt/sources.list.d/webmin.list and add the following lines to it:
  • # Repository for Webmin
  • deb http://download.webmin.com/download/repository sarge contrib
  • apt-key adv –keyserver keyserver.ubuntu.com –recv-keys D97A3AE911F63C51
  • apt-get update
  • apt-get install webmin

8. Use your browser to access your webmin panel at the following url: https://localhost:10000

9.To administer the Software RAID using webmin login as a sudo-er, go to the page Hardware > Linux RAID, select create RAID and the type you wish with the specific drives you want to use. 

10. To watch the progress of your RAID syncing: watch -n3 cat /proc/mdstat

11. Mount the volume – edit FSTAB – ENJOY!

 

 

Net Neutrality: Geeks Trolled

This video, and most of my fellow geeks, are completely missing the big issue with Net Neutrality and, are frankly, being duped!

The Net Neutrality approach of having the FCC mandate rules for what providers can and can’t do is addressing a symptom of the issue/concern without dealing with the problem. This video, and most net neutrality advocates, are advocating for setting a precedent where the government has jurisdiction over internet.

Instead of advocating for allowing the government to make the rules of the internet, demand the government get out of the process and allow for ISP competition over cable. The current cable oligopoly (government mandated monopoly) means that most Americans have little to no choice in their broadband provider which results in the Net Neutrality Issue.

If we had true broadband ISP competition then any of us could change providers when one ISP decided it was going to block specific traffic – the market would self regulate. Instead, we have government regulations fostering a situation creating a threat to the freedom of speech, and somehow, making the government the police of the internet with more regulations is the key to fixing it?

The answer is simple, but politically distasteful for any politician needing a campaign finance boost: allow competition in the cable market. Tell the cable companies that they had decades of a cornered market to repay them for their infrastructure build outs…now they must compete like everyone else.

Instead of agreeing with net neutrally because of silly videos like the one above, or because it’s popular, do what geeks do best – think about it. Lets work together to make sure that the internet stays free for all. And if you are really looking for a video about this issue, may I suggest:

MythTV DVR Setup Guide – Recording 24/7 – Hauppauge 2250 + Handbrake Transcoding

This guide is intended to outline the general setup procedure for a DVR system that has multiple tuners using MythBuntu 12.04 and Hauppauge 2250 tuners.

mythbuntu-logo

1. Install the base MythBuntu 12.04 operating system.

2. Set root password

[sourcecode language=”plain”]
sudo passwd XXXXXXXX
[/sourcecode]

3. Update Ubuntu / Mythbuntu Dist

[sourcecode language=”plain”]
apt-get update
apt-get upgrade
apt-get dist-upgrade
[/sourcecode]

4. Once in the OS, the first step will be getting the firmware loaded for the tuner cards.

[sourcecode language=”plain”]
mkdir /home/mythtv/dvr-firmware
cd /home/mythtv/dvr-firmware
wget http://www.larrystendebach.com/DVR-Files/v4l-saa7164-1.0.3.fw
wget http://www.larrystendebach.com/DVR-Files/v4l-saa7164-1.0.3-3.fw
wget http://www.larrystendebach.com/DVR-Files/dvb-fe-tda10048-1.0.fw
wget http://www.larrystendebach.com/DVR-Files/NXP7164-2010-03-10.1.fw
wget http://www.larrystendebach.com/DVR-Files/v4l-saa7164-1.0.2.fw
sudo cp *fw /lib/firmware
reboot
[/sourcecode]

    • Check if firmware installed correctly: dmesg | grep saa7164
    • On the 3rd or 4th line you should see what you are looking for it will look like this: [card=8,autodetected]
    • Now we need to enter this card number into modprobe.d/options.conf file  – sudo nano /etc/modprobe.d/options.conf
    • place this line of code in the file: options saa7164 card=x
      • *x = your card’s number*
    • Reboot and check mythtv backend to see if it is listed correctly.

5. Run Mythbackend Setup

    • For the Hauppauge 2250, set them up as DVB tuners. Each can be multiplexed up to 4 times per tuner on the card.
    • Make sure to scan for channels with each tuner. MythTV seems to use this information to determine which tuners have access to which channels. Skipping some of your tuners will lead to recording conflicts / not being able to use all your tuners.
    • Set up a program data via Schedules Direct: schedulesdirect.org
    • If scanning does not show all the channels expected, try to increase the tuning and scanning delay. Sometimes even changing this to 10+ seconds will help during the scanning phase.
    • If an internal TV system is in use and the channel numbers have been remapped, use the channel editor after scan to enter the correct XMLTV ID for that channel and it will resolve any issues. the XMLTV ID can easily be found within the Schedules Direct channel lineup.

6. Set up file naming user job: /usr/share/doc/mythtv-backend/contrib/user_jobs/mythlink.pl –link /path/to/mythtv/videos –chanid “%CHANID%” –starttime “%STARTTIME%” –format ‘%cN-%T-%S-%m%d%y-%G-%i-%s’

7. Download MythBrake Script (remember to edit the file to fix directories and language).

[sourcecode language=”plain”]
cd /home/mythtv/
wget http://www.larrystendebach.com/DVR-Files/mythbrake.sh
[/sourcecode]

8.Set up transcoding job via Mythbrake: /path/to/mythbrake.sh “%DIR%” “%FILE%” “%CHANID%” “%STARTTIME%” “%TITLE%” “%SUBTITLE%” “%CATEGORY%”

[sourcecode language=”plain”]
sudo add-apt-repository ppa:stebbins/handbrake-releases
sudo apt-get update
sudo apt-get install handbrake-gtk handbrake-cli
[/sourcecode]

    • Make sure to change the mythbrake.sh script to have English as the primary language and correct permissions on the source, destination and log folders.

9. Set up recording rules

    • To record each show on a channel 24/7, create a custom recording rule in the MythTV frontend or MythWeb: channel.callsign = ‘CALLSIGN’ . Make sure to press the test button to make sure the callsign is correct. After which, click the record button and select to record this show any time on this channel. Select your user jobs in the Post Processing tab, and click the record button to save.

 BONUS. Helpful Commands

  • See back-end log quickly: mythbackend –logpath
  • Force full program data refresh: mythfilldatabase –dd-grab-all
  • Organize each days recordings into a folder with that days date: wget http://www.larrystendebach.com/DVR-Files/dailymove.sh
    • Then create a cron: */15 * * * * sh /path/to/dailymove.sh
  • Fix mythweb downloads:
    • sudo ln -s /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enabled/cgi.load
    • nano /etc/apache2/mods-available/mime.conf
    • AddHandler cgi-script .cgi .pl
    • Restart Apache2
  • In order to fix handbrake cli in 14.04
    • sudo apt-add-repository ppa:stebbins/handbrake-snapshots
    • sudo apt-get update
    • sudo apt-get upgrade
    • apt-get dist-upgrade