[mythtv-users] Mythfrontend fails if mythtv installed after user mythtv created

Peter Bennett pb.mythtv at gmail.com
Fri Jun 21 20:45:49 UTC 2024


On 6/21/24 16:07, James Abernathy wrote:
>
>
> On Fri, Jun 21, 2024 at 12:44 PM James Abernathy 
> <jfabernathy at gmail.com> wrote:
>
>
>
>     On Fri, Jun 21, 2024 at 12:37 PM James Abernathy
>     <jfabernathy at gmail.com> wrote:
>
>
>
>         On Fri, Jun 21, 2024 at 12:31 PM Peter Bennett
>         <pb.mythtv at gmail.com> wrote:
>
>
>             On 6/21/24 10:52, James Abernathy wrote:
>>
>>
>>             On Thu, Jun 20, 2024 at 6:11 PM James Abernathy
>>             <jfabernathy at gmail.com> wrote:
>>
>>
>>
>>                 On Thu, Jun 20, 2024 at 5:59 PM Mike Perkins
>>                 <mikep at randomtraveller.org.uk> wrote:
>>
>>                     On 20/06/2024 22:46, James Abernathy wrote:
>>                     > On Thu, Jun 20, 2024 at 7:09 AM James Abernathy
>>                     <jfabernathy at gmail.com>
>>                     > wrote:
>>                     >
>>                     >> Not sure where I went wrong. On Debian 12
>>                     Bookworm, if I create the mythtv
>>                     >> group and user before I install the .deb
>>                     packages I can get mythtv setup
>>                     >> using Web App, but with some extra steps.  The
>>                     backend works correctly. The
>>                     >> problem shows up running mythfrontend as a
>>                     mythtv user permission issue.
>>                     >>
>>                     >> If I don't create user mythtv and just install
>>                     the deb packages, Web App
>>                     >> starts showing mythconverg already setup
>>                     completely.  In this case
>>                     >> mythfrontend works.
>>                     >>
>>                     >> Jim A
>>                     >>
>>                     >
>>                     > As a further test case I created a system on
>>                     Kubuntu 24.04 LTS and
>>                     > installed maradb-server.
>>                     >
>>                     > Next I created the mythtv group id 200 and
>>                     mythtv user id 200.  I then
>>                     > added my user, jim, to group mythtv.
>>                     >
>>                     > Then I installed mythtv using the
>>                     ppa:mythbuntu/34. After installation, I
>>                     > rebooted.
>>                     >
>>                     > At this point the Web app came up with no
>>                     issues. The database was already
>>                     > set up without further messing around.
>>                     >
>>                     > So maybe the Debian mythtv packaging does
>>                     something funny if the user and
>>                     > group mythtv is created before installing the
>>                     mythtv packages.  I use the
>>                     > Debian 12 packages for mythtv that I build
>>                     regularly on a VM and store in a
>>                     > repo on my NAS.
>>                     >
>>                     Please note that user/200 and group/200 are
>>                     /still/ in the system uid and gid range. The
>>                     numbers in
>>                     this range can be arbitrarily allocated to
>>                     various susbsytems in random order if and when
>>                     they are
>>                     installed. I do not know if the install mechanism
>>                     has any collision detection.
>>
>>                     It is possible that your previous attempt re-used
>>                     a uid or gid that had already been allocated.
>>
>>                     I always allocate the mythtv user and group
>>                     before installing any software. I make sure I put
>>                     mine
>>                     in the *user* range (> 1000), in my case
>>                     1006/1006. This ensures no accidents or collisions.
>>
>>                     --
>>
>>                     Mike Perkins
>>
>>
>>                 Thanks,  I don't think it's a collision at this point
>>                 in either group our user is. However I just got the
>>                 same error with mythfrontend on Kubuntu 24.04 as I
>>                 got on Debian 12 with the user created before
>>                 installation.
>>
>>                 Either way, I'll test with users> 1000 and see what
>>                 happens.
>>
>>                 The error on mythfrontend is:
>>                 2024-06-20 18:03:04.715443 I  Start up testing
>>                 connections. DB localhost, BE , attempt 0, status
>>                 dbAwake, Delay: 2000
>>                 2024-06-20 18:03:05.248215 E  [DBManager0] Unable to
>>                 connect to database!
>>                 2024-06-20 18:03:05.248264 E  Driver error was [1/1045]:
>>                 QMYSQL: Unable to connect
>>                 Database error was:
>>                 Access denied for user 'mythtv'@'localhost' (using
>>                 password: YES)
>>
>>                 Jim A
>>
>>
>>             After more testing, I've found that this is not related
>>             to whether you have mysql or mariadb as your database. 
>>             It appears that if you don't create your mythtv
>>             user/group ahead of time. Debian 12 and Ubuntu create the
>>             database properly and set up config.xml so that
>>             mythfrontend works.  I did find that on mysql database
>>             you get a Web App warning/error about needing to have the
>>             timezones setup correctly. It gives you the command to
>>             execute in a terminal and that fixes it. On mariadb you
>>             don't get this error.
>>
>>             I have not found a way to setup the mythtv user and group
>>             ahead of the mythtv installation that allows mythfrontend
>>             to work without a permission problem.  It appears that
>>             the backend is working in these cases, but on my test VM
>>             I can't test that without mythfrontend.
>>
>>             Jim A
>>
>>
>>
>             Is the backend on the same VM as the frontend and using
>             the same login user?
>
>             Unable to connect to database looks like a problem with
>             the config.xml. Perhaps this is only set up in the install
>             script if the mythtv user does not yet exist.
>
>             Peter
>
>
>         The backend is on the same VM as the frontend. I'm running it
>         as user jim.  I did not setup config.xml for jim before
>         running mythfrontend,
>
>         That usually happens automatically, I think. I didn't mess
>         with the mariadb cnf files for bind-address since it was on
>         the same VM.
>
>         I tried linking to the same config.xml as the mythtv user
>         config.xml which agrees with the /etc/mythtv/config.xml
>
>         Jim A
>
>
>     Okay, it's fixed now.  What I did was delete the link in
>     /home/jim/.mythtv for config.xml to /home/mythtv/.mythtv/config.xml.
>
>     Then I just copied /etc/mythtv/config.xml to
>     /home/jim/.mythtv/config.xml and that worked.
>
>     So it seems that if you create your own mythtv group and user and
>     manually add user 'jim' to group mythtv.  The web app will
>     configure the backend fine but the config.xml for the use is left
>     to that user to do.
>
>     I previously had to install kodi to test if the backend was
>     working and I could watch live tv that way before I got
>     mythfrontend running.
>
>     Thanks,
>
>     JIm A
>
>
> I just confirmed the fix also on Debian 12. Previous fix was for Linux 
> Mint 21.3 which is Ubuntu 22.04.
>
> So the process is as follows.
>
> 1. On a fresh Debian 12 system or Ubuntu system, set up a file in 
> /etc/sources.list.d/ to include either your local Debian mythtv 
> package repo location or using the ppa on Ubuntu.
> 2. Install mariadb or mysql and if using BTRFS, turn off COW by chattr 
> +C /var/lib/mysql
> 3. Create the mythtv user to the desired gid/uid and add your own user 
> to the mythtv group
> i.e.
> sudo addgroup --gid 1006 mythtv
> sudo adduser --ingroup mythtv --home /home/mythtv --shell /bin/bash 
> --uid 1006 mythtv
> sudo usermod -aG mythtv jim
> 4. I reboot for safety reasons, thensudo apt install mythtv
> 5. point browser to localhost:6544.  The mythconverg database should 
> be set up.
> 6. Continue with the remaining backend setup using Web App and restart 
> the backend with the button at the top.
> 7. In a terminal in your user copy /etc/mythtv/config.xml to 
> ~/,mythtv/config.xml
> 8. Run mythfrontend.
>
> Jim A
>
>
>
The way it  works:

You perform your setup with the browser, and remember what you set for 
Security Pin.

Then log on as a different user (eg jim) and run mythfrontend. It gives 
a screen that says cannot connect database. Arrow to the search button 
and press enter. It gives a list of running backend on  your network. 
select one, enter the pins, and mythfrontend creates your config.xml  
and starts up.

Alternatively instead of using search, you can select Manual entry, 
enter the DB details and it will also create config.xml and start.

I don't think your problems are related to creating the mythtv user 
before installing. I always create it before, so that it has the same id 
number as before. This makes sure your recording files from a prior 
installation have the same user permissions as your new new install.

Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20240621/e6ae4eb0/attachment.htm>


More information about the mythtv-users mailing list