Mailing List Archive

Problem with mythconverg_restore.pl
Hi,

The main disk in my mythtv box died (root partition). The disk I used for
all the mythtv recordings is fine, which also has the mythconverg backups
(automatically created by mythtv). But I have no backup of the mysql data
folders themselves.

I'm running 31-fixes on Ubuntu 20.04.

After setting up a new disk with Ubuntu 20.04, installing 31-fixes (which
installs mysql), etc, I tried to run mythconverg_restore.pl. I get the
following error:

$ /usr/share/mythtv/mythconverg_restore.pl --drop_database
--create_database --name mythconverg --filename
mythconverg-1361-20210801074136.sql.gz --verbose

Configuring environment:
- username: mythtv
- HOME: /home/mythtv
- MYTHCONFDIR: /home/mythtv/.mythtv

Parsing configuration files:
- checking: /home/mythtv/.mythtv/config.xml
parsing: /home/mythtv/.mythtv/config.xml
- checking: /home/mythtv/.mythtv/backuprc
parsing: /home/mythtv/.mythtv/backuprc

Applying command-line arguments.

Checking configuration.

Database Information:
DBHostName: localhost
DBPort: 3306
DBUserName: mythtv
DBPassword: XXX
DBName: mythconverg
DBSchemaVer:
DBBackupDirectory: /opt/mythtv/mythconverg_backups
DBBackupFilename: mythconverg-1361-20210801074136.sql.gz
drop_database: yes
create_database: yes

Executables:
mysql_client: mysql
uncompress: gzip -d

Miscellaneous:
partial_restore: no
restore_xmltvids: no
change_hostname: no

Checking database.

Preparing initial database.
Dropping database.
DBD::mysql::st execute failed: Schema directory './mythconverg/' does not
exist at /usr/share/mythtv/mythconverg_restore.pl line 1052.

ERROR: Unable to drop database.
Schema directory './mythconverg/' does not exist

Does anyone know where I have gone wrong?


Thanks in advance,
Justin.
Re: Problem with mythconverg_restore.pl [ In reply to ]
On Thu, 2021-08-05 at 01:46 +0800, Justin Smith wrote:
> Hi,
>
> The main disk in my mythtv box died (root partition). The disk I used
> for all the mythtv recordings is fine, which also has the mythconverg
> backups (automatically created by mythtv). But I have no backup of
> the mysql data folders themselves.
>
> I'm running 31-fixes on Ubuntu 20.04.
>
> After setting up a new disk with Ubuntu 20.04, installing 31-fixes
> (which installs mysql), etc, I tried to run mythconverg_restore.pl. I
> get the following error:
>
> $ /usr/share/mythtv/mythconverg_restore.pl --drop_database --
> create_database --name mythconverg --filename mythconverg-1361-
> 20210801074136.sql.gz --verbose
>
> ...
>
> Does anyone know where I have gone wrong?

Leave off the --drop_database argument. This is a new install of mysql,
so there's no mythconverg database to drop.

David


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Problem with mythconverg_restore.pl [ In reply to ]
On Wed, Aug 4, 2021 at 6:35 PM David Hampton via mythtv-users
<mythtv-users@mythtv.org> wrote:

>
> Leave off the --drop_database argument. This is a new install of mysql,
> so there's no mythconverg database to drop.
>

While my recollection of the script was that
it tried to verify that the database does not
exist before attempting to drop it (so one
should not have run into the issue), perhaps
the "drop database" stmt should be
enhanced with a "if exists" mysql/mariadb
extension which would let processing
proceed.

Would that be a "good first issue" for a
new contributor pull request?
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Problem with mythconverg_restore.pl [ In reply to ]
On Thu, 5 Aug 2021 at 02:21, Mike Perkins <mikep@randomtraveller.org.uk>
wrote:

> On 04/08/2021 18:46, Justin Smith wrote:
>> > $ /usr/share/mythtv/mythconverg_restore.pl --drop_database
>> > --create_database --name mythconverg --filename
>> > mythconverg-1361-20210801074136.sql.gz --verbose
>> <snip>
>> > Preparing initial database.
>> > Dropping database.
>> > DBD::mysql::st execute failed: Schema directory './mythconverg/' does
>> not
>> > exist at /usr/share/mythtv/mythconverg_restore.pl line 1052.
>> >
>> > ERROR: Unable to drop database.
>> > Schema directory './mythconverg/' does not exist
>> >
>> > Does anyone know where I have gone wrong?
>>
>

> Well, you did specify "--drop-database" and you don't have one yet.
>> Fell down that hole myself in the past...
>
>
But mysql tells me I do... Before I ran the restore command, I ran:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mythconverg |
+--------------------+
2 rows in set (0.01 sec)

The mythconverg database is automatically created when you install mythtv
(at least on Ubuntu).

Trying to delete the database manually returns:
mysql> drop database mythconverg;
ERROR 3679 (HY000): Schema directory './mythconverg/' does not exist

I found my problem: I mangled the mysql configuration I moved the mysql
database directory to a separate partition.

Thanks,
Justin.
Re: Problem with mythconverg_restore.pl [ In reply to ]
On 08/04/2021 04:09 PM, Gary Buhrmaster wrote:
> On Wed, Aug 4, 2021 at 6:35 PM David Hampton via mythtv-users wrote:
>
>> Leave off the --drop_database argument. This is a new install of mysql,
>> so there's no mythconverg database to drop.
>>
> While my recollection of the script was that
> it tried to verify that the database does not
> exist before attempting to drop it (so one
> should not have run into the issue), perhaps
> the "drop database" stmt should be
> enhanced with a "if exists" mysql/mariadb
> extension which would let processing
> proceed.
>
> Would that be a "good first issue" for a
> new contributor pull request?

The script connects to the database by name to check if it exists. If
that succeeds, we assume the database (to which we successfully
connected) actually exists ;). If it exists and if --drop_database was
specified, the script will do a DROP DATABASE.

However, the actual error in the OP's case was not that the database
does not exist. It was:

>>> DBD::mysql::st execute failed: Schema directory './mythconverg/'
>>> does not exist at /usr/share/mythtv/mythconverg_restore.pl
>>> <http://mythconverg_restore.pl/> line 1052.
>>>
>>> ERROR: Unable to drop database.
>>> Schema directory './mythconverg/' does not exist

which indicates a problem with the MySQL/MariaDB server configuration.
Even if we had an IF EXISTS, there would be a failure when we next
attempt to alter the schema with, for example, CREATE DATABASE.

The relative directory "." seems suspect to me. It seems that someone
has specified an other-than-default MySQL DATA DIRECTORY that's
conflicting with an other-specified DATA DIRECTORY. This could have
been done with the DATADIR environment variable, the --datadir
command-line option to mysqld, or a datadir option in my.cnf (perhaps in
a subsection limiting it to only some programs). Or, the problem may be
a problem with file system permissions meaning that the user running
mysqld doesn't have appropriate access to the data directory.

I don't know for sure what's going on, but I think the real problem is
the server/system setup.

https://dev.mysql.com/doc/refman/8.0/en/data-directory.html

Mike

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-users
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org