[mythtvnz] New install - mythbackend password not accepted

Stephen Worthington stephen_agent at jsw.gen.nz
Wed Apr 7 11:10:32 BST 2021


On Wed, 7 Apr 2021 15:31:30 +1200, you wrote:

>I installed your helper scripts and it is looking good but with a couple 
>of idiosyncrasies.
>
>I was running htop on a second workspace to monitor the stopping and 
>starting of the backend.
>
>When I start myth backend setup  a small dialogue opens stating that 
>myth backend needs to be closed > selecting 'Yes' results in a mythtv 
>dialogue asking for a password - which won't accept the sudo password or 
>any password in the known universe. NB there are two users: the Xubuntu 
>user called myth and mythtv , I don't know if that is enlightening.

There should not be a password request here.  The question about
shutting down mythbackend is new in v31 I think, and will always be
there, but after that there should not be any further dialogs - the
helper script should be run and mythbackend should shut down.

However, shutting down mythbackend has a complication.  When MythTV
programs such as mythbackend or mythfrontend are requested to shut
down externally, there is a bug in the MythTV codebase that happens.
The request to shut down is a "kill -15" aka "kill -SIGTERM".  When
MythTV code receives one of these signals, it mostly shuts down except
for one final thread, which keeps on running.  Sending a second "kill
-15" shortly after the first one will shut down this final thread. The
systemd .service file for mythbackend (mythtv-backend.service) does
not know about this problem as installed from the packages.  It only
sends one "kill -15" and then waits for mythbackend to stop - and
keeps on waiting and waiting and when it finally times out (90?
seconds later), it does a kill -9 on mythbackend which then kills off
the last thread.  The kill -9 happening does no damage as mythbackend
is no longer doing anything, just waiting in that final thread.  But
that long timeout will be affecting you as mythbackend will still be
running when mythtv-setup starts.  So I think you need to install my
fix for this problem:

https://lists.archive.carbon60.com/mythtv/users/627999
(search that page for "mythbackendstop.sh")

Installing this fix will not fix the problem of a password dialog
popping up - that should not be happening with my helper scripts in
place.

>The password dialogue is despatched into the land of wind and ghosts 
>with a simple esc keystroke or clicking 'X' or "Cancel"
>
>A terminal window shows myth backend setup starting.
>
>Myth backend setup opens and states the backend is running and htop 
>confirms this > selecting 'stop backend' closes the message box and 
>,after 10 seconds,myth backend setup is ready for use.
>
>Exiting myth backend setup results in the GUI closing , A terminal 
>window shows myth backend  starting, a mythtv dialogue asking for a 
>password appears which is  closed with an "esc" . A dialogue opens 
>asking if I want to run mythfilldatabase.

I am afraid I just do not understand where that password dialog is
coming from, unless the sudoers setup is not correct.  Check that
setup by doing these commands:

ll /etc/sudoers.d/mythtv-systemctl-helper
cat /etc/sudoers.d/mythtv-systemctl-helper

This is what I get:

root at mypvr:/usr/local/bin# ll /etc/sudoers.d/mythtv-systemctl-helper
-r--r----- 1 root root 70 Jun  7  2020
/etc/sudoers.d/mythtv-systemctl-helper
root at mypvr:/usr/local/bin# cat /etc/sudoers.d/mythtv-systemctl-helper
mythtv,%mythtv ALL=NOPASSWD:/usr/local/bin/mythtv-systemctl-helper.sh

If the sudoers setup was wrong, dismissing the password dialog should
result in the helper script never being run, so mythbackend would just
keep on running.

>htop confirms myth backend is running.
>
>When the helper script commands had the error (typo) the 10 second delay 
>was where the Myth backend setup would hang indefinitely.
>
>Except for the irrelevant password requests it seems to be behaving 
>pretty much the same as my existing Mythbuntu 16.04 installation.
>
>
>>   mysql> select * from settings where data like '%helper%' order by hostname;
>> +---------------------+-----------------------------------------------------------+-------------+
>> | value               | data                                                      | hostname    |
>> +---------------------+-----------------------------------------------------------+-------------+
>> | ServerHaltCommand   | sudo /home/mythtv/bin/mythtv-systemctl-helper.sh halt     | NULL        |
>> | BackendStopCommand  | sudo /home/mythtv/bin/mythtv-systemctl-helper.sh stop     | NULL        |
>> | BackendStartCommand | sudo /home/mythtv/bin/mythtv-systemctl-helper.sh start    | NULL        |
>> | HaltCommand         | sudo /home/mythtv/bin/mythtv-systemctl-helper.sh poweroff | myth-system |
>> | RebootCommand       | sudo /home/mythtv/bin/mythtv-systemctl-helper.sh reboot   | myth-system |
>> +---------------------+-----------------------------------------------------------+-------------+
>> 5 rows in set (0.00 sec)

That all looks right.

>Set up will continue over following days.
>
>Thanks
>
>Paul

BTW The same shutdown bug happens in mythfrontend, so I have a script
that sends it two "kill -15" that I use to shut it down when it
freezes on a bug or otherwise.  Running "killm" will kill only
"mythfrontend.real" and the mythfrontend script will then restart it.
Running "killm x" (any parameter value) will kill the "mythfrontend"
script and then kill "mythfrontend.real", so it will not restart.

To install killm on Ubuntu run this:

sudo su
cd /usr/local/bin
wget http://www.jsw.gen.nz/mythtv/killm
chown root:root killm
chmod u=rwx,og=rx killm
exit



More information about the mythtvnz mailing list