Upgrade to 2:33.1+fixes.202303020919 broke mythweb

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
white_haired_uncle
Senior
Posts: 244
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Upgrade to 2:33.1+fixes.202303020919 broke mythweb

Post by white_haired_uncle »

The (html) error message had a link to creating a ticket, but I don't have a login, so I guess.... here?

Upgraded mythtv on backend to 2:33.1+fixes.202303020919.c273ed0f9a~ubuntu22.04.1, from v33.1+fixes.202302200304.c273ed0f9a~ubuntu22.04.1. This broke mythweb.

Updating /etc/apache2/sites-available/mythweb.conf with correct access info and restarting apache2 fixed the issue.

Tried to attach the backtrace, but "Sorry the board attachment quota has been reached." Anyway, it was trying to access mysql using user ''@'localhost'
white_haired_uncle
Senior
Posts: 244
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: Upgrade to 2:33.1+fixes.202303020919 broke mythweb

Post by white_haired_uncle »

Did it again....

Code: Select all

mythtv-database/jammy,jammy 2:33.1+fixes.202303140136.7f288be61b~ubuntu22.04.1 all [upgradable from: 2:33.1+fixes.202303020919.c273ed0f9a~ubuntu22.04.1]

Code: Select all

Setting up mythtv-database (2:33.1+fixes.202303140136.7f288be61b~ubuntu22.04.1)
...
mysql 'hidden SECURITY_INFO' --execute=CREATE USER IF NOT EXISTS ''@'%' IDENTIFIED WITH mysql_native_password;             ALTER USER ''@'%' IDENTIFIED BY 'lpoJ6DkO';             GRANT ALL ON .* TO ''@'%';  failed, (incorrect admin username/password or syntax?)
Try:
sudo dpkg-reconfigure mythtv-database

root@mythbackend:/var/log/mythtv# dpkg-reconfigure mythtv-database
mysql 'hidden SECURITY_INFO' --execute=CREATE USER IF NOT EXISTS ''@'%' IDENTIFIED WITH mysql_native_password;             ALTER USER ''@'%' IDENTIFIED BY 'lpoJ6DkO';             GRANT ALL ON .* TO ''@'%';  failed, (incorrect admin username/password or syntax?)
Try:
sudo dpkg-reconfigure mythtv-database
mythweb -- http://mythbackend/mythweb/tv/upcoming

Code: Select all

Fatal error: Uncaught Error: Undefined constant "tmpl" in /usr/share/mythtv/mythweb/modules/_shared/tmpl/_errors/site_down.php:19 Stack trace: #0 /usr/share/mythtv/mythweb/includes/errordisplay.php(186): require_once() #1 /usr/share/mythtv/mythweb/includes/database.php(97): tailored_error() #2 /usr/share/mythtv/mythweb/includes/init.php(43): require_once('...') #3 /usr/share/mythtv/mythweb/mythweb.php(20): require_once('...') #4 {main} thrown in /usr/share/mythtv/mythweb/modules/_shared/tmpl/_errors/site_down.php on line 19
[Note: that error from mythweb is not the error we really want to see. That's a separate error where the code that is supposed to report a db connection error is also broken]

fix:

Code: Select all

root@mythbackend:/var/log/mythtv# cp /etc/apache2/sites-available/mythweb.conf.dpkg-old /etc/apache2/sites-available/mythweb.conf
root@mythbackend:/var/log/mythtv# systemctl restart apache2
User avatar
bill6502
Developer
Posts: 2299
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Upgrade to 2:33.1+fixes.202303020919 broke mythweb

Post by bill6502 »

Hi,

Next time, I'd post a diff of the two files:

Code: Select all

diff /etc/apache2/sites-available/mythweb.conf.dpkg-old /etc/apache2/sites-available/mythweb.conf
Hide the password if you like.
white_haired_uncle
Senior
Posts: 244
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: Upgrade to 2:33.1+fixes.202303020919 broke mythweb

Post by white_haired_uncle »

Sorry, thought I did. Probably put it in the file that wouldn't attach.

Code: Select all

mythbackend$ diff /etc/apache2/sites-available/mythweb.conf*
70,73c70,73
<       setenv db_server        ""
<       setenv db_name          ""
<       setenv db_login         ""
<       setenv db_password      "lpoJ6DkO"
---
>       setenv db_server        "localhost"
>       setenv db_name          "mythconverg"
>       setenv db_login         "mythtv"
>       setenv db_password      "i&wldf,,4"

Hmm, I think I see the problem:

Code: Select all

root@mythbackend:~/.mythtv# more config.xml 
<Configuration>
  <Database>
    <PingHost>0</PingHost>
    <Host></Host>
    <UserName></UserName>
    <Password>lpoJ6DkO</Password>
    <DatabaseName></DatabaseName>
    <Port>3306</Port>
  </Database>
The backend/database used to run on a different machine. I assume that password in root's config.xml was generated when I installed on the new VM, it's not one I've ever used. And since I don't run things like mythtv-setup as root, it probably never got populated with the correct values. Everything else db related works fine, as mythtv's config.xml has the correct info, but the upgrade is running as root.

Probably also explains why I had to edit mythweb.conf when I first set up the new backend, even though it says it's no longer needed.
Last edited by white_haired_uncle on Fri Mar 24, 2023 2:35 am, edited 1 time in total.
User avatar
bill6502
Developer
Posts: 2299
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Upgrade to 2:33.1+fixes.202303020919 broke mythweb

Post by bill6502 »

See if this exists: /etc/mysql/debian.cnf (it's only readable by root). If it's there,
then try this: sudo mysql --defaults-file=/etc/mysql/debian.cnf . You should end
up with a mysql prompt.

The code where the 'hidden SECURITY_INFO' text prints was last changed in April of 2020.
white_haired_uncle
Senior
Posts: 244
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: Upgrade to 2:33.1+fixes.202303020919 broke mythweb

Post by white_haired_uncle »

bill6502 wrote:
Fri Mar 24, 2023 2:30 am
See if this exists: /etc/mysql/debian.cnf (it's only readable by root). If it's there,
then try this: sudo mysql --defaults-file=/etc/mysql/debian.cnf . You should end
up with a mysql prompt.

The code where the 'hidden SECURITY_INFO' text prints was last changed in April of 2020.
That works. This concerns me a bit:

Code: Select all

MariaDB [(none)]> select host,user from mysql.user;
+----------------+------------------+
| Host           | User             |
+----------------+------------------+
| %              |                  |
| 172.30.219.%   | mythtv           |
| 172.30.219.110 | mythtv           |
| 192.168.124.1  | mythtv           |
| localhost      | debian-sys-maint |
| localhost      | mariadb.sys      |
| localhost      | mysql            |
| localhost      | mythtv           |
| localhost      | root             |
+----------------+------------------+
I don't think that first line is really a problem, unless there's some way I don't know of to access mysql with a null user name. Still, no matter how misconfigured my (config.xml?) my myth setup is, this seems like something that shouldn't be allowed to happen.

If I were to update root's config.xml, and run dpkg-reconfigure mythtv-database, would that be a valid test? I do have a libvirtd snapshot taken just before the upgrade, but I've had recordings since then and I don't know enough about snapshots to know if I can make a second/current one, revert to the old one
to test, and then get back to where I am now.
User avatar
bill6502
Developer
Posts: 2299
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Upgrade to 2:33.1+fixes.202303020919 broke mythweb

Post by bill6502 »

I'd move the .mythtv directory to .was_mythtv or at least fix the empty <UserName></UserName>.
I don't have one on my test host. There was one last changed in 2014 on my production box. The
only file in it was config.xml (which matched my 'normal' config.xml files.)

I'm loathe to modify the packaging scripts to address this issue (even though I agree with you that
the missing name shouldn't cause an issue). If empty, a reasonable guess would be 'mythtv', but there
are users that don't use that and I don't want to stomp on their choices. Although I disagree with
not using the standard.
white_haired_uncle
Senior
Posts: 244
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: Upgrade to 2:33.1+fixes.202303020919 broke mythweb

Post by white_haired_uncle »

What's been bugging me is why /root/.mythtv/config.xml never got populated. Seems like that's destined to cause problems. While I didn't build the backend from source, I did notice this:

https://www.mythtv.org/wiki/Build_from_ ... base_Setup

Code: Select all

Run mythtv-setup. This will automatically create your database or upgrade your previous mythconverg database schema to the latest version:

mythtv-setup

If config.xml has not been created, setup will prompt for database info. You can then continue with setting up your system in mythtv-setup. 
mythtv-setup
Seems to me like that should be

sudo mythtv-setup
User avatar
bill6502
Developer
Posts: 2299
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Upgrade to 2:33.1+fixes.202303020919 broke mythweb

Post by bill6502 »

mythtv-setup should be run as user mythtv. I updated the Wiki.
Post Reply