Author Topic: MythTV: Capture cards disappeared - cannot re-add  (Read 2029 times)

wombiroller

  • Guru
  • ****
  • Posts: 340
    • View Profile
MythTV: Capture cards disappeared - cannot re-add
« on: June 28, 2008, 06:45:09 am »
Hi All,

I recently tried to connect a second Myth client to the backend of my core/hybrid. Didn't realise at the time that as I was using a later version of Mythtv the client wasn't compatible. When I tried to connect it advised something along the lines of version 40 won't work with version 31. It offered to upgrade the DB to which I answered NO because I wasn't sure this wouldn't ruin my LMCE box.

Alas - it has anyway. Appears the Capture Cards on the backend were deleted. I can still go into the backend and attempt to add a new capture card. Both of the tuners (0 and 1 - using DVico Dual Digital 2) are still recognized in MythTV, but when I click FINISH - the cards don't get added! (no cards appear in the capture cards screen)

The cards are still there (have /dev/dvb/adapter0 and /dev/dvb/adapter1 directories and as above - add new capture card can see them etc). I have run the mysqlcheck on the database and other steps suggested here http://wiki.linuxmce.org/index.php/MythTV, but everything comes back OK and the other steps (after reboots) don't appear to make any difference.

The only error in the /var/log/mythtv/mythbackend.log is - ERROR: no valid capture cards are defined in the database. It seems to be connected to the DB OK... Connected to database 'mythconverg' at host: localhost.

I'm not really sure what else to do. Can't find anything in google/mythtv.org - though I did see someone else appeared to have the same problem.

Anyone know what to do or have any suggestions?

Thanks!
WR.


 

seth

  • Guru
  • ****
  • Posts: 485
  • A day w/o LinuxMCE is like a day w/o sunshine!
    • View Profile
Re: MythTV: Capture cards disappeared - cannot re-add
« Reply #1 on: September 08, 2008, 04:54:41 pm »
 :'(
This just happened to me last night. My nephew was over, with mythbuntu 804. Tried to connect to the core's backend, and now I have no tuners cards. I have gone through everything you did, and I even actually removed the cards (deleted) them from the core and the MD, then rebooted, they were detected, and my settings were still checked. Let the setup wizard complete, and still nothing.

Then I tried to add them manually with mythtv-setup. I can see the cards, choose the cards, and then they still do not show up. So I am now stuck as you are  >:(. It must have something to do with the database.

I hate to have to think of a re-install, but if that is what it takes......

Let me know if you found anything out.

Regards,


Seth
".....Because Once you've LinuxMCE'd....."
System stats located at my user page:

http://wiki.linuxmce.org/index.php/User:Seth

seth

  • Guru
  • ****
  • Posts: 485
  • A day w/o LinuxMCE is like a day w/o sunshine!
    • View Profile
Re: MythTV: Capture cards disappeared - cannot re-add
« Reply #2 on: September 08, 2008, 05:39:15 pm »
 ;)
OK. After some extensive googling, I have once again been returned to the good old mythtv.org docs. I beleive I know how to fix it.
Apparently when my nephew connecte to the lmce backend, it updated the db schema to the new version sported by mythbuntu 8.04. So following this doc http://mythtv.org/docs/mythtv-HOWTO-23.html#ss23.5 I am going to attempt the following:

take a current mythconverg db dump:

Code: [Select]
mysqldump -u root -p mythconverg -c > /home/public/data/videos/mythtv_hosed.sql
I have a dump from about 3 weeks ago in this same directory called mythbackup.sql.

I will restore the old db
Code: [Select]
mysql -u root -p mythconverg < /home/public/data/videos/mythbackup.sql
After this step I will verify that the cards are there, or at least can be added, by using mythtv-setup.
If this is the case, I will have a good db, but all the shows I have recorded since the last dump. will not be there, and this will not bode well with my users (wife and kids). So I will have to do the following to restore my current recordings tables:

Code: [Select]
cd /home/public/data/videos
grep "INSERT INTO \`record\` " mythtv_hosed.sql > restore.sql
grep "INSERT INTO \`recorded\` " mythtv_hosed.sql >> restore.sql
grep "INSERT INTO \`oldrecorded\` " mythtv_hosed.sql >> restore.sql
grep "INSERT INTO \`recordedprogram\` " mythtv_hosed.sql >> restore.sql
grep "INSERT INTO \`recordedrating\` " mythtv_hosed.sql >> restore.sql
grep "INSERT INTO \`recordedmarkup\` " mythtv_hosed.sql >> restore.sql
grep "INSERT INTO \`recordedseek\` " mythtv_hosed.sql >> restore.sql

And then after this step is complete, add the recordings back into the db:
Code: [Select]
mysql -u root -p mythconverg < restore.sql
With any luck, this will resolve my issues.

I will try this tonight, and post my results.

Regards,

Seth
« Last Edit: September 09, 2008, 02:04:35 am by seth »
".....Because Once you've LinuxMCE'd....."
System stats located at my user page:

http://wiki.linuxmce.org/index.php/User:Seth

seth

  • Guru
  • ****
  • Posts: 485
  • A day w/o LinuxMCE is like a day w/o sunshine!
    • View Profile
Re: MythTV: Capture cards disappeared - cannot re-add
« Reply #3 on: September 09, 2008, 02:07:04 pm »
 ;D

Mission successful. I have effectively mapped out the way to fix this. It did require a reboot, and actually using phpmyadmin was the fastest way to get it done.

However the above steps actually work.

I actually went back, to "0" with my database. I took a current dump, then instead of restoring everything back to 3 weeks ago, I went back to day one.

Get a current dump
Code: [Select]
mysqldump -u root -p mythconverg -c > /home/public/data/videos/mythtv_hosed.sqlThen start the process:

Code: [Select]
mysql -u root -p
drop database mythconverg;
create database mythconverg;
exit
Then delete all cards from lmce by using the webadmin hardware tree.
Do a reboot.

Code: [Select]
mysql -u root -p mythconverg < /usr/share/mythtv/sql/mc.sqlFollowed by:
Code: [Select]
mysql -u root -p
create database mythhosed;
exit
Code: [Select]
mysql -u root -p mythhosed < /home/public/data/videos/myth_hosed.sql
Fire up phpmyadin (if you don't have this installed, get it, very nice)
Code: [Select]
sudo apt-get install phpmyadmin
dpkg-reconfigure phpmyadmin   (choose apache2)

Now using phpmyadmin http://dcerouter/phpmyadmin/

- select the mythhosed database
- select operations
- scroll down to the bottom
- choose mythconverg from the database drop down
- make sure "Structure + Data" is checked
- make sure "DROP Database" is checked
- and choose the following items: (one at a time)
- record
- recorded
- oldrecorded
- recordedprogram
- recordedrating
- recordedmarkup
- recordedseek

After you are done, go check your mythtv recordings. They should all be there!

That is it. Perhaps this will be wiki'd later, but as there doesn't seem to be a lot of people with this issue, I will wait a bit.

Regards,

Seth
".....Because Once you've LinuxMCE'd....."
System stats located at my user page:

http://wiki.linuxmce.org/index.php/User:Seth

wombiroller

  • Guru
  • ****
  • Posts: 340
    • View Profile
Re: MythTV: Capture cards disappeared - cannot re-add
« Reply #4 on: September 10, 2008, 03:43:00 am »
Nice work Seth - alas I reinstalled some time ago to fix this. You're much more patient than I am...  ;)

seth

  • Guru
  • ****
  • Posts: 485
  • A day w/o LinuxMCE is like a day w/o sunshine!
    • View Profile
Re: MythTV: Capture cards disappeared - cannot re-add
« Reply #5 on: September 12, 2008, 07:44:34 pm »
 :)
I did do up a wiki entry for this. It can also help if you are re-installing LMCE, and you use MythTV to watch your recordings.

http://wiki.linuxmce.org/index.php/Mythtv:RestoreRecordingsAfterUpgrade

Regards,
Seth
".....Because Once you've LinuxMCE'd....."
System stats located at my user page:

http://wiki.linuxmce.org/index.php/User:Seth

JRoque

  • Regular Poster
  • **
  • Posts: 19
    • View Profile
Re: MythTV: Capture cards disappeared - cannot re-add
« Reply #6 on: September 16, 2008, 02:59:33 pm »
Hello Seth, thanks for your help. I'm still new at this and have some of questions - some of which will not make much sense, I guess. Here it goes:

1. My MythTv setup has user "mythtv" and a password generated during initial install. Should we use that instead of "root" with your instructions above?

2. Using PhpMyAdmin, I can see that an old copy (about 3 weeks old) of mythconverg has 74 tables and the new "hosed" one has 82. Can I simply remove those tables that are not in the old copy? This assumes that the extra tables were added by the newer MythTV client I used against the LinuxMCE backend.

3. What does this do?
Code: [Select]
mysql -u root -p mythconverg < /usr/share/mythtv/sql/mc.sql
4. After following your procedure, the tuners were recognized and added to the list of devices. However, when running mythtv-setup, it throws a bunch of "access denied for user mythtv@localhost" and "unable to connect to database" errors. Could that be related to the "root" user owning the new mythconverg db I created in a earlier step?

Thanks,
JR

seth

  • Guru
  • ****
  • Posts: 485
  • A day w/o LinuxMCE is like a day w/o sunshine!
    • View Profile
Re: MythTV: Capture cards disappeared - cannot re-add
« Reply #7 on: September 16, 2008, 03:15:58 pm »
 :)
First question:
Did you actually preform this step:
Quote
mysql -u root -p mythconverg < /usr/share/mythtv/sql/mc.sql

If you did, then this is going back to the default mythconverg database. And in doing so, you would need to change the mythtv user password back to what is identified in your /etc/mythtv/mysql.txt or in mythtv setup:
Code: [Select]
mysql -u root -p
UPDATE user SET Password=PASSWORD('password from the above sources') WHERE user='mythtv';
FLUSH PRIVILEGES;
quit
This will set the mythtv user password to the one required by your system

Next, you will want to ensure this works by running:
Code: [Select]
mysql -u mythtv -p mythconverg
<enter your password>

If you are rejected with an access denied to use mythtv using password (YES), then you need to re grant mythtv permissions:
Code: [Select]
mysql -u root -p
grant all on mythconverg.* to mythtv@"%" identified by "<password from above sources>";
flush privileges;
Make sure you remember to enclose your password in the above line with " ".

This should allow mythtv user to reconnect to the database.

Second question:
Yes you are correct, the previous database is going to be larger, asyou would have made some recordings and such. You can import those tables which are different, from your original dump file, like the recording bits from the wiki into a new database, and then copy them over to the new mythconverg database using phpmyadmin.

This will bring back your recordings and schedules, cutlists, and what not.

Hope this helps,

Regards,

Seth
".....Because Once you've LinuxMCE'd....."
System stats located at my user page:

http://wiki.linuxmce.org/index.php/User:Seth

JRoque

  • Regular Poster
  • **
  • Posts: 19
    • View Profile
Re: MythTV: Capture cards disappeared - cannot re-add
« Reply #8 on: September 16, 2008, 04:26:44 pm »
Thanks a bunch, Seth. I'm taking baby steps here so bear with me if you please.

When I enter
Code: [Select]
mysql -u root -p
UPDATE user SET Password=PASSWORD('my password') WHERE user='mythtv';

I get: ERROR 1046 (3D000): No database selected

If I enter
Code: [Select]
mysql -u root -p mythconverg
UPDATE user SET Password=PASSWORD('my password') WHERE user='mythtv';

I get: ERROR 1146 (42S02): Table 'mythconverg.user' doesn't exist

I've also tried UPDATE mythtv SET Password=MyPassword but got the same "does not exist" error. I'm probably missing something very basic here, sorry.

Thanks,
JR

seth

  • Guru
  • ****
  • Posts: 485
  • A day w/o LinuxMCE is like a day w/o sunshine!
    • View Profile
Re: MythTV: Capture cards disappeared - cannot re-add
« Reply #9 on: September 16, 2008, 04:33:35 pm »
 ;)
Sorry, yes, you want to select the mysql database. That is where the user accounts are stored:
Code: [Select]
mysql -u root -p mysqlThen perform your maintenance.

Regards,

Seth
".....Because Once you've LinuxMCE'd....."
System stats located at my user page:

http://wiki.linuxmce.org/index.php/User:Seth

JRoque

  • Regular Poster
  • **
  • Posts: 19
    • View Profile
Re: MythTV: Capture cards disappeared - cannot re-add
« Reply #10 on: September 17, 2008, 02:32:33 am »
Hello Seth, thank you!!! That did it. I got bulk of it from a 3 week old db and believe I have the rest in the "hosed" copy.

So to recap, like the original post on this thread, I connected a 0.21 version of MythTV to my LinuxMCE backend. Immediately after that, I lost my tuners and could not add them back. I followed your steps and restored from an old copy I had around.

Last question: is the "hosed" copy broken to a point where I can't copy back to the live db via
Code: [Select]
mysql -u mythtv -p mythconverg < mythtv_backup.sql Presuming the problem is with the schema, can I copy the records back with the above command or is that going to hose the live copy too? From your notes above I understand I can copy each element, one by one but was looking for a quicker way out.

Once again, thank you. You saved me from yet another full install.

JR

seth

  • Guru
  • ****
  • Posts: 485
  • A day w/o LinuxMCE is like a day w/o sunshine!
    • View Profile
Re: MythTV: Capture cards disappeared - cannot re-add
« Reply #11 on: September 17, 2008, 07:36:11 pm »
 ;)
I would not recommend this, as you risk the chance of re-introducing the issue again. Almost everything else in the mythconverg db will be rebuilt the next time mythfilldatabase is run. I have only tried restoring the recordings, and schedules bits as mentioned above. Most of the other tables will have not changed from the original creation, so you can try it, but get a current dump first, then restore the hosed db.

YMMV

Regards,

Seth
".....Because Once you've LinuxMCE'd....."
System stats located at my user page:

http://wiki.linuxmce.org/index.php/User:Seth

stallione

  • Veteran
  • ***
  • Posts: 59
    • View Profile
Re: MythTV: Capture cards disappeared - cannot re-add
« Reply #12 on: December 30, 2008, 06:40:32 pm »
Seth,

Thank you so much for this, I have been trying to find a way to reset the database (A complete mythconverg reset) and now with the help of you post, I have successfully fixed my broken mythtv install.

My issue was that I couldn't configure the tuners (HDHomerun) no matter what I did, the database was totally messed up (after I tried to upgrade mythtv).

So, the only change I did was instead of restoring the database, I recreated it and gave it the appropriate persmission and password and let linuxmce repopulate the database automatically from scratch. Works great!

Here are the steps if it would help someone else.

1. Get your mythtv mysql password (cat /usr/share/mythtv/mysql.txt)

2. Dump and recreate the database
(mysql -u root -p
drop database mythconverg;
create database mythconverg;
exit)

3. Populate the tables
mysql -u root -p mythconverg < /usr/share/mythtv/sql/mc.sql

4. Reset permissions
Log on to mysql - (mysql -u root -p ) no password
then, mysql>grant usage on *.* to mythtv@localhost identified by 'thepasswordfrom step 1';
then, mysql>grant all privileges on mythconverg.* to mythtv@localhost;

5. Restart Mythv-setup from either the command line or the AVWizard and it will do the rest!