[Solved] Mythbackend shutdown issues with systemd.

For discussion of topics specific to MythTV on linux
Post Reply
x_driver
Junior
Posts: 26
Joined: Tue Nov 24, 2015 9:15 pm
United States of America

[Solved] Mythbackend shutdown issues with systemd.

Post by x_driver » Sat Jul 27, 2019 11:21 pm

The process to shutdown mythbackend via systemd was working great, however now it takes well over a minute and doesn't work when suspending/resuming. I can't seem to find any log files in /var/log/mythtv so I'm not sure where to start. Any ideas? The terminal output below is systemctl status mythbackend after running systemctl stop mythbackend.

Code: Select all

● mythbackend.service - MythTV Backend
   Loaded: loaded (/usr/lib/systemd/system/mythbackend.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mythbackend.service.d
           └─override.conf
   Active: deactivating (final-sigkill) (Result: exit-code) since Sat 2019-07-27 16:08:07 MST; 5min ago
  Process: 1884 ExecStop=/usr/bin/mythshutdown --setscheduledwakeup (code=exited, status=1/FAILURE)
 Main PID: 1132 (mythbackend)
    Tasks: 2 (limit: 4915)
   Memory: 66.7M
   CGroup: /system.slice/mythbackend.service
           └─1132 [mythbackend]

Jul 27 16:09:45 HTPC systemd[1]: mythbackend.service: Killing process 1489 (n/a) with signal SIGKILL.
Jul 27 16:09:45 HTPC systemd[1]: mythbackend.service: Killing process 1670 (MythSocketThrea) with signal SIGKILL.
Jul 27 16:09:45 HTPC systemd[1]: mythbackend.service: Killing process 1672 (MythSocketThrea) with signal SIGKILL.
Jul 27 16:09:45 HTPC systemd[1]: mythbackend.service: Killing process 1685 (n/a) with signal SIGKILL.
Jul 27 16:09:45 HTPC systemd[1]: mythbackend.service: Killing process 1751 (PT29) with signal SIGKILL.
Jul 27 16:09:45 HTPC systemd[1]: mythbackend.service: Killing process 1752 (PT30) with signal SIGKILL.
Jul 27 16:09:45 HTPC systemd[1]: mythbackend.service: Killing process 1753 (PT31) with signal SIGKILL.
Jul 27 16:11:16 HTPC systemd[1]: mythbackend.service: Processes still around after SIGKILL. Ignoring.
Jul 27 16:12:46 HTPC systemd[1]: mythbackend.service: State 'stop-final-sigterm' timed out. Killing.
Jul 27 16:12:46 HTPC systemd[1]: mythbackend.service: Killing process 1132 (mythbackend) with signal SIGKILL.
Last edited by x_driver on Mon Aug 05, 2019 9:32 pm, edited 1 time in total.

User avatar
pgbennett
Developer
Posts: 322
Joined: Mon Apr 27, 2015 5:41 pm
United States of America

Re: Mythbackend shutdown issues with systemd.

Post by pgbennett » Sun Jul 28, 2019 4:13 pm

The ExecStop setting is incorrect in your systemd setup. That run of mythshutdown only sets a scheduled wakeup time but does not shut down the backend. I recommend to remove the ExecStop from the service file. systemd by default uses a kill command that is trapped by mythtbackend and that will do an orderly shutdown.

If you want the system to wakeup again at the next recording then you should set the appropriate wakeup command in mythtv-setup. Note that the wakeup time will only be set if mythbackend itself initiates the shutdown using the shutdown command you set in mythtv-setup. If you manually issue a system shutdown the wakeup time would not be set.

mytrhshutdown is not needed to be used in the normal setup. It may be helpful in some unusual cases, but I have not found a need for it.

x_driver
Junior
Posts: 26
Joined: Tue Nov 24, 2015 9:15 pm
United States of America

Re: Mythbackend shutdown issues with systemd.

Post by x_driver » Wed Jul 31, 2019 2:11 am

I'll give it a try and post back, thx.

User avatar
bill6502
Developer
Posts: 1399
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Mythbackend shutdown issues with systemd.

Post by bill6502 » Mon Aug 05, 2019 12:00 am

Info only, the mythtv package from Arch has ExecStop=/usr/bin/mythshutdown --setscheduledwakeup
in its mythbackend.service file.

x_driver
Junior
Posts: 26
Joined: Tue Nov 24, 2015 9:15 pm
United States of America

Re: Mythbackend shutdown issues with systemd.

Post by x_driver » Mon Aug 05, 2019 9:30 pm

pgbennett and bill,

Thanks for the help. There was an ExecStop=/usr/bin/mythshutdown --setscheduledwakeup in my mythbackend.service file. I deleted it and uncommented the one with the propershutdown command. Works great.

Post Reply