[Solved] Mythwelcome cannot shut down computer
Moderator: Forum Moderators
-
- Newcomer
- Posts: 12
- Joined: Fri Jun 14, 2019 9:10 pm
- Location: Northern California
[Solved] Mythwelcome cannot shut down computer
I cannot get mythwelcome to shutdown the computer on a new Myth installation, I assume this is because the status is always reporting "MythTV is locked by a user" but I haven't been able to figure out why it is always locked when I don't have any other apps running.
Going to the menu via 'M' then selecting 'Unlock Shutdown' doesn't affect it at all.
Every 30 seconds in mythshutdown.log I'm getting "E CoreContext main.cpp:277 (getStatus) Shutdown is locked" and "I CoreContext main.cpp:369 (getStatus) Mythshutdown: --status returned: 16" which just confirms what I am seeing.
Frontend and backend are running fine, I can record and watch recordings.
My user account is set for autologin in /etc/lightdm/lightdm.conf and I have mythwelcome set to autolaunch in ~/.config/autostart/mythwelcome.desktop (Exec=/usr/bin/mythwelcome). I launch mythfrontend from mythwelcome manually.
Is there something wrong with this setup? Let me know if I need to post additional information, such as the list of running processes owned by my login, if that would help.
Thanks for any suggestions.
Going to the menu via 'M' then selecting 'Unlock Shutdown' doesn't affect it at all.
Every 30 seconds in mythshutdown.log I'm getting "E CoreContext main.cpp:277 (getStatus) Shutdown is locked" and "I CoreContext main.cpp:369 (getStatus) Mythshutdown: --status returned: 16" which just confirms what I am seeing.
Frontend and backend are running fine, I can record and watch recordings.
My user account is set for autologin in /etc/lightdm/lightdm.conf and I have mythwelcome set to autolaunch in ~/.config/autostart/mythwelcome.desktop (Exec=/usr/bin/mythwelcome). I launch mythfrontend from mythwelcome manually.
Is there something wrong with this setup? Let me know if I need to post additional information, such as the list of running processes owned by my login, if that would help.
Thanks for any suggestions.
Last edited by Steve Goodey on Mon Jun 17, 2019 6:03 am, edited 1 time in total.
Reason: Added (Solved) to title.
Reason: Added (Solved) to title.
MythTV v29.1-13-g329c235, fixes/29, Library API : 29.20180316-1
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.
Re: Mythwelcome cannot shut down computer
The MythShutdownLock is not 0. Try: mythshutdown --unlock
It's a counter, it may not simply = 1 . curl yourBackendHostNameOrIP:6544/Myth/GetSetting?Key=MythShutdownLock\&HostName=_GLOBAL_
will show its value.
It's a counter, it may not simply = 1 . curl yourBackendHostNameOrIP:6544/Myth/GetSetting?Key=MythShutdownLock\&HostName=_GLOBAL_
will show its value.
-
- Newcomer
- Posts: 12
- Joined: Fri Jun 14, 2019 9:10 pm
- Location: Northern California
Re: Mythwelcome cannot shut down computer
Thanks for the info Bill, I tried mythshutdown --unlock a few times, no change. But I'm doing that from a terminal window which should prevent a shutdown. I tried the URL http://[my IP address]:6544/Myth/GetSetting?Key=MythShutdownLock\&HostName=_GLOBAL but I only get
I will close this browser so that only mythwelcome is running. If anything changes, I'll post an update.
and no value to be seen. I forgot to mention this is a frontend-backend combined machine, everything is local. I did check netstat -nao | grep :6544 and gotThis XML file does not appear to have any style information associated with it. The document tree is shown below.
<String/>
Am I doing something wrong to show the counter value? I'm not aware of doing anything except mythshutdown --unlock to affect the counter.tcp 0 0 0.0.0.0:6544 0.0.0.0:* LISTEN off (0.00/0/0)
tcp6 0 0 [::]:6544 [::]:* LISTEN off (0.00/0/0)
I will close this browser so that only mythwelcome is running. If anything changes, I'll post an update.
MythTV v29.1-13-g329c235, fixes/29, Library API : 29.20180316-1
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.
Re: Mythwelcome cannot shut down computer
I dropped the trailing _ after _GLOBAL (fixed it), plus if run from a browser, leave off the backslash
before the ampersand (it's there to avoid spinning off the command in the shell.)
before the ampersand (it's there to avoid spinning off the command in the shell.)
Re: Mythwelcome cannot shut down computer
Code: Select all
mythshutdown --check
Code: Select all
mythshutdown --unlock
-
- Newcomer
- Posts: 12
- Joined: Fri Jun 14, 2019 9:10 pm
- Location: Northern California
Re: Mythwelcome cannot shut down computer
I'm back to look at this again. The URL [my_ip]:6544/Myth/GetSetting?Key=MythShutdownLock&HostName=_GLOBAL_ gives me a count of 38 in Firefox and 15 in chromium. Then running mythshutdown --unlock a dozen times then refreshing the web pages or newly pasting in the URL still reports 38 in FF and 15 in chrome.
I thought that the idea of mythwelcome was to only shut down the machine when it was idle and not to shut down if you are using the desktop, such as an xterm, browser, etc. Doesn't doing all this testing with a browser and terminal always qualify as keeping the system active?
My ultimate goal is to use ACPI wakeup, which I have verified to work on my box (HP Z210 desktop), to wake up the machine for the next recording if I don't power on to watch something. But first I think I need to get it to be idle so that it can shut down. And I shouldn't have to teach other members of the household to open up an xterm and run shutdown.
Thanks for the help so far. Any other suggestions?
I thought that the idea of mythwelcome was to only shut down the machine when it was idle and not to shut down if you are using the desktop, such as an xterm, browser, etc. Doesn't doing all this testing with a browser and terminal always qualify as keeping the system active?
My ultimate goal is to use ACPI wakeup, which I have verified to work on my box (HP Z210 desktop), to wake up the machine for the next recording if I don't power on to watch something. But first I think I need to get it to be idle so that it can shut down. And I shouldn't have to teach other members of the household to open up an xterm and run shutdown.
Thanks for the help so far. Any other suggestions?
MythTV v29.1-13-g329c235, fixes/29, Library API : 29.20180316-1
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.
-
- Newcomer
- Posts: 12
- Joined: Fri Jun 14, 2019 9:10 pm
- Location: Northern California
Re: Mythwelcome cannot shut down computer
Hit the URL from my laptop and got a 0, so I logged out of my TV user and let it autologin and autostart mythwelcome. The status is now idle, no recordings currently taking place, and next schedulted recording is next Thursday. Logged in via SSH and the only myth things running are the backend and mythwelcome. I'll give it the 15 minutes to shutdown on its own.
MythTV v29.1-13-g329c235, fixes/29, Library API : 29.20180316-1
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.
-
- Newcomer
- Posts: 12
- Joined: Fri Jun 14, 2019 9:10 pm
- Location: Northern California
Re: Mythwelcome cannot shut down computer
Just sitting there idle. Tomorrow I will have to see if there is anything in the logs.
MythTV v29.1-13-g329c235, fixes/29, Library API : 29.20180316-1
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.
Re: Mythwelcome cannot shut down computer
I would ignore that URL Bill gave you I think what you are seeing is the BE caches the settings so what you get back is the old cached value. The status returned by mythshutdown is always correct since it read/writes the value direct from the database.
Re: Mythwelcome cannot shut down computer
Paul's right, but it's the backend sending the same ETag even if the value changed,
so any browser that returns ETags and gets a 304. It's a backend bug (that
was fixed in v31-Pre on 2019-06-18.)
so any browser that returns ETags and gets a 304. It's a backend bug (that
was fixed in v31-Pre on 2019-06-18.)
- dizygotheca
- Developer
- Posts: 267
- Joined: Wed Sep 03, 2014 9:02 am
Re: Mythwelcome cannot shut down computer
No, the backend will attempt to shutdown the machine when Myth is idle; it has no concept of the machine being idle.I thought that the idea of mythwelcome was to only shut down the machine when it was idle and not to shut down if you are using the desktop, such as an xterm, browser, etc. Doesn't doing all this testing with a browser and terminal always qualify as keeping the system active?
Myth is idle when the backend isn't doing anything and all frontends have disconnected.
Originally the only way for frontends to disconnect was for them to exit. However that's a one-way ticket and the backend status couldn't be displayed afterwards. Automatically starting a frontend during unattended recordings also prevented shut down. MythWelcome filled that hole by showing a screen during the state of 'backend is running but this frontend isn't'.
What Myth version ? For a long time the frontend has contained an "Idle Screen" that duplicates MythWelcome functionality making it obsolete.
https://www.mythtv.org/wiki/Idle_Screen
I think mythshutdown also runs the "Pre Shutdown check-command" script https://www.mythtv.org/wiki/Setup_Gener ... up_Options
That's the (user-defined) place to block shutdown if the desktop is in use, someone is logged in etc.
Do you have something configured there that is always blocking shutdown ?
mythbackend -v system --loglevel debug
should show more detail of where it is blocking
Note the scripts on https://www.mythtv.org/wiki/ACPI_Wakeup are fragile and behave differently on different OS/versions.
Re: Mythwelcome cannot shut down computer
How it used to work is you would set mythshutdown --check as the "Pre Shutdown check-command". It does checks like see if the BE is busy recording, mythtranscode is running a job, mythfilldatbase is running, mythcomflag is running, we are about to start recording, shutdown has been locked (ie mythshutdown --lock has been called) etc.
There's been a case of too many cooks meddling with it and so the original concept of mythwelcome and mythshutdown has become a little confused so who knows how it is supposed to work now.
There's been a case of too many cooks meddling with it and so the original concept of mythwelcome and mythshutdown has become a little confused so who knows how it is supposed to work now.
-
- Newcomer
- Posts: 12
- Joined: Fri Jun 14, 2019 9:10 pm
- Location: Northern California
[Solved] Mythwelcome cannot shut down computer
Thanks everybody for chiming in. I discovered an incorrect shutdown command in mythtv-setup. On the Backend Control page, which I had not visited before (partly because it was scrolled off the bottom of the displayed list), the Stop command was set to Start was set to These must have been default settings in fixes/29 that I'm running. (Full disclosure: I originally installed Mythbuntu 16.04 then upgraded to Ubuntu 18.04. I only realized after this upgrade that there is no Mythbuntu 18.04.) I changed the 2 commands to and start respectively.
On the test I ran a few hours ago, it shut down as expected!! I will do some more testing for various combinations of activity vs. idle state, and for ACPI wakeup. Since it did shutdown, I'm changing the topic as solved (not sure if I'm doing that correctly). Thanks again for the help.
Code: Select all
sudo sv stop mythbackend
Code: Select all
sudo sv start mythbackend
Code: Select all
sudo /etc/init.d/mythtv-backend stop
On the test I ran a few hours ago, it shut down as expected!! I will do some more testing for various combinations of activity vs. idle state, and for ACPI wakeup. Since it did shutdown, I'm changing the topic as solved (not sure if I'm doing that correctly). Thanks again for the help.
MythTV v29.1-13-g329c235, fixes/29, Library API : 29.20180316-1
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.
- Steve Goodey
- Moderator
- Posts: 219
- Joined: Fri Feb 07, 2014 6:30 pm
- Location: Colchester, England
Re: [Solved] Mythwelcome cannot shut down computer
Hi, you needed to change the subject in the first post to get [Solved] to show in the forum topic list. I've done that for you.I'm changing the topic as solved (not sure if I'm doing that correctly).
Don't forget the Wiki.
-
- Newcomer
- Posts: 12
- Joined: Fri Jun 14, 2019 9:10 pm
- Location: Northern California
Re: [Solved] Mythwelcome cannot shut down computer
Thanks Steve.
I think what fixed it was changing the check command from checklogin.sh that I found in the Wiki to /usr/bin/mythshutdown --check. Not only is the check working and shutting down the system when it is idle, my ACPI setup is working! Great to have this working now. I never could get it working on my previous installations on different hardware and earlier versions of mythtv.
I think what fixed it was changing the check command from checklogin.sh that I found in the Wiki to /usr/bin/mythshutdown --check. Not only is the check working and shutting down the system when it is idle, my ACPI setup is working! Great to have this working now. I never could get it working on my previous installations on different hardware and earlier versions of mythtv.
MythTV v29.1-13-g329c235, fixes/29, Library API : 29.20180316-1
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.
with HDHR3 tuner on Ubuntu 18.04 Bionic Beaver and lightdm.