New Guy Trying to Get My MythTV Box Running

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

Moderator: Forum Moderators

Post Reply
Mountainbreeze
Junior
Posts: 23
Joined: Sun Mar 31, 2024 2:12 pm
United States of America

New Guy Trying to Get My MythTV Box Running

Post by Mountainbreeze »

I have embarked on the journey of retiring BeyondTV and moving to MythTV. I have installed Ubuntu 22.04 and Myth TV 34 (combined FE/BE) on a dedicated box. Problem is, I'm not a Linux guy so I find it difficult to apply the information I find on this forum. I'm taking it slow and with some previously provided help, I am now at the point where I can record and playback TV shows I receive OTA with a HDHomeRun tuner. The next step I want to take is getting the box to shutdown (or is sleep/suspend preferred?) when not in use (not watching and not recording). Ideally, I want to manually start the box to watch recordings and shut it down when done (but not if recordings are in progress). I also want the box to wake itself up to perform scheduled recordings and shut down when done (unless I'm still watching). I found "MythWelcome" which seems to be designed to do most/all of this but I can't figure out how to get it implemented into the system to do all of the above. Again, my lack of Linux knowledge is in my way. Can someone lead me by the hand and help me out? Thanks so much.
white_haired_uncle
Senior
Posts: 300
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: New Guy Trying to Get My MythTV Box Running

Post by white_haired_uncle »

I would do a search on "rtc site:mythtv.org", in particular https://www.mythtv.org/wiki/ACPI_Wakeup.

You're probably not going to understand a lot of what is on that page and it looks a little dated. That's okay. Don't worry about trying to implement all the scripts and such, just poke around with the manual tests. If you can get your machine to wake up automatically outside mythtv, you'll be off to a great start. And if not, at least you'll pick up some of the lingo.

P.S. Do you use a guide service (like Schedules Direct)? If not, keep in mind you won't be getting guide data when the machine is down and as I understand it guide data from OTA is usually only for like 24 hours in the future or something.
Mountainbreeze
Junior
Posts: 23
Joined: Sun Mar 31, 2024 2:12 pm
United States of America

Re: New Guy Trying to Get My MythTV Box Running

Post by Mountainbreeze »

OK, made it a way down the Wakeup wiki. I did the "Manually test wakealarm" and it worked as expected. A couple of things I'm stuck on:

I'm now in the section of the wiki titled "Mythwelcome users (combined fe/be)".

The first thing it says is to "Change the system so that mythwelcome is started instead of mythfrontend." How do I do that?

I have configured the Shutdown/Wakeup options as instructed, then it says "write setwakeup.sh" and provides a script. My question is, where does setwakeup.sh get written to? It looks like maybe it should go in /usr/bin/ but when I try to save the script in that location (using Text Editor) is says "You do not have the permissions necessary to save the file" so I'm not sure what to do here.

Finally (for now), I'm lost as to what the instructions that follow the setwakeup.sh script are trying to get me to do. I ran "sudo visudo" and that spit out a bunch of information but it is not clear to me what I'm supposed to do with it. Something about pasting the line at the end of the file. Paste where?

And when I run

Code: Select all

%mythtv ALL = NOPASSWD: /sbin/shutdown, /sbin/rtcwake, /usr/bin/setwakeup.sh, /usr/bin/mythshutdown
in the terminal window, it responds with

Code: Select all

bash: fg: %mythtv: no such job
so I'm lost here too.
User avatar
bill6502
Developer
Posts: 2337
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: New Guy Trying to Get My MythTV Box Running

Post by bill6502 »

The text isn't entered on the command line. When you edit the sudoers file (visudo), the above line is pasted at the bottom of the file. You should find yourself in an editor. Paste the output here if that doesn't happen and don't continue if you're not editing a file.

Errors when editing sudoers can be prevent all root access. I suggest opening a 2nd terminal session and
typing sudo -i there (so you have a root user available just in case you need to reverse changes made in the window where you're doing the changes to sudoers.) [Since you're self proclaimed new at linux]

You may find that rtcwake is now /usr/sbin/rtcwake rather than /sbin/rtcwake. How do you know? Just type: type rtcwake

I prefer to put additions to sudoers in a new file so that if/when the distribution's package manager releases a new sudoers file, changes are not lost. The following does that:

Code: Select all

sudo visudo --file=/etc/sudoers.d/mythtv
When you're done using visudo, enter sudo -k then sudo -i in the 1st window you opened, just to test the sudo command. If root access no longer works, you can just remove /etc/sudoers.d/mythtv (from the other window I suggested opening.) You type control-D to exit from sudo -i.
Mountainbreeze
Junior
Posts: 23
Joined: Sun Mar 31, 2024 2:12 pm
United States of America

Re: New Guy Trying to Get My MythTV Box Running

Post by Mountainbreeze »

OK, I took the second approach as recommended - I think. Here is what I did...

From a terminal window, I entered the command sudo visudo --file=/etc/sudoers.d/mythtv
Then I entered the text line %mythtv ALL = NOPASSWD: /sbin/shutdown, /sbin/rtcwake, /usr/bin/setwakeup.sh, /usr/bin/mythshutdown and then pressed Ctrl-O. It promped me with File Name to Write: /etc/sudoers.d/mythtv.tmp. I pressed enter and it came back with Wrote 1 line. Then I pressed Ctrl-X to exit.

After that, on the terminal window I entered sudo -k which provided no response. I then entered sudo -i. I was propmted for my password, I entered my password and the prompt line changed to root@MythPC:~# with no other output. I then pressed Ctrl-D which resulted in logout and a return to the bill@MythPC:~$ prompt.

I entered the command type rtcwake and the response was rtcwake is /usr/sbin/rtcwake

I poked around in the directories and found that rtcwake is present in both places (/usr/sbin/rtcwake AND /sbin/rtcwake). Is that OK?

I also observed the presence of /etc/sudoers.d/mythtv.

Now, if all of the above is correct, I still need to know:

1. How to "Change the system so that mythwelcome is started instead of mythfrontend"
2. What does it mean to "write setwakeup.sh". So far, I have done nothing with the setwakeup.sh.
User avatar
bill6502
Developer
Posts: 2337
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: New Guy Trying to Get My MythTV Box Running

Post by bill6502 »

Yes it's OK for rtcwake to appear in multiple places. If you type ls -l /usr/sbin/rtcwake /sbin/rtcwake,
you'll likely find that one of those is a symbolic link to the other (think Windows shortcut).

Q1, I've never used mythweclome. As white_haired_uncle mentioned above, if you have a good Electronic Program Guide, the backend will startup and shutdown when a program you want to record starts and will and shutdown when finished (unless you're running a frontend).

Q2, you don't HAVE to use a setwakeup.sh like script. If you look at yourBackend:6444 -> Backend Setup (gear) -> General -> Shutdown/Wakeup Options -> Command to set wakeup time, you'll see it's already configured to use: sudo /usr/local/bin/SetWakeupTime.sh $time. So you'd edit sudoers (like you just did) and replace /usr/bin/setwakeup.sh with /usr/local/bin/SetWakeupTime.sh. In the Wiki and above, /usr/bin/setwakeup.sh is used and IMHO, that's odd because commands written by us users belong in /usr/local/bin.
Mountainbreeze
Junior
Posts: 23
Joined: Sun Mar 31, 2024 2:12 pm
United States of America

Re: New Guy Trying to Get My MythTV Box Running

Post by Mountainbreeze »

Looks like they are both the same to my untrained eye. One thing that looks odd to me is they both have a date of Apr 9 given I have done all this stuff today (Apr 12).

Code: Select all

bill@MythPC:~$ ls -l /usr/sbin/rtcwake /sbin/rtcwake
-rwxr-xr-x 1 root root 35200 Apr  9 11:32 /sbin/rtcwake
-rwxr-xr-x 1 root root 35200 Apr  9 11:32 /usr/sbin/rtcwake
At this point, I am throwing in the towel. My sincerest thanks to all who have helped me to this point but I have come to the realization that my lack of Linux knowledge is too much of a hindrance to allow me to confidently maintain a MythTV installation. It was a fun ride.
jfbauer
Newcomer
Posts: 14
Joined: Tue Jul 26, 2022 11:43 pm
United States of America

Re: New Guy Trying to Get My MythTV Box Running

Post by jfbauer »

Mountainbreeze wrote:
Wed Apr 17, 2024 9:29 pm
Looks like they are both the same to my untrained eye. One thing that looks odd to me is they both have a date of Apr 9 given I have done all this stuff today (Apr 12).

Code: Select all

bill@MythPC:~$ ls -l /usr/sbin/rtcwake /sbin/rtcwake
-rwxr-xr-x 1 root root 35200 Apr  9 11:32 /sbin/rtcwake
-rwxr-xr-x 1 root root 35200 Apr  9 11:32 /usr/sbin/rtcwake
Not a problem. That is expected. The timestamp is likely from when the package containing rtcwake was installed/updated. As most system now-a-days have /sbin linked to /usr/sbin, you are really seeing two different paths to the identical file.
Post Reply