How To Update Plex Plugin TrueNAS

Once upon a time, during the dark ages, we had to run several shell commands–like savages–to get the Plex plugin in TrueNAS (or FreeNAS, if you go back that far) to update. One had to fetch, then unpack the tarball, then move to the right directory, change ownership, and finally run the script! It was quite a pain when Plex was coming out with a new update every week (or so it seemed), and got to be more annoying than productive.

Fortunately, we don’t have to live like animals anymore because [mstinaff] wrote a nice, simple shell script to take care of all the heavy lifting! You can even set it up as a cron task to run on schedule (for when Plex decides to start issuing updates every few days again).

Let’s start by assuming that you know how to access your TrueNAS jails. On the Jails dialog, open Plex, then DO NOT CLICK “Update”. Click “Shell”.Once you’ve got your root prompt in the shell, download the updater by invoking the following command:
fetch https://raw.githubusercontent.com/mstinaff/PMS_Updater/master/PMS_Updater.sh

From here, you can just run the shell script with sh PMS_Updater.sh

Automating Plex updates on TrueNAS with cron jobs

To set up a cron job on your TrueNAS installation, navigate to the Tasks > Cron Jobs dialog. Click the “ADD” button to create a new cron job and give it a descriptive name such as “Plex update”. Then, enter the following in the “Command” field:

/usr/local/bin/iocage exec [plexjail] /bin/sh /usr/local/PMS_Updater/PMS_Updater.sh -r -a -v

Substitute the name of your Plex jail for [plexjail]. Mine is just called “plex“. The -r flag will keep your installation clean by removing the older packages before installing the new one. The -a flag automatically updates to the newest version without user intervention. Finally, the -v flag runs the script in verbose mode, so you’ll have a log available just in case anything goes wrong.

Set the “Run As User” field to root, and set your preferred schedule. I run mine weekly on Sunday nights. From here, make sure your job is enabled, and click “SAVE”. Now, you shouldn’t have to make another manual Plex update again!

How To Install The Homebrew Channel To Nintendo Wii

My wife’s Wii has been languishing on a shelf for the past several years, so I wanted to breathe a little life back into it. Ever since the NES Classic launched a wave of “mini” self-contained consoles, I wanted to extend that kind of convenience to all the consoles in our collection. There’s a much different experience playing a game on something resembling the original hardware than there is using an emulator on a PC, but I wanted to be able to do it without the wear and tear on optical drives or having to worry about damaged discs. So, I decided to install a USB loader on the Wii in order to be able to play those discs from backups stored on a hard drive and keep the originals in their cases for posterity!

Installing The Wii Homebrew Channel using str2hax

There are several different ways to install The Homebrew Channel on the Nintendo Wii, but this guide will be using str2hax since I don’t have an SD card available at the moment. (I’ll fix that soon.)

In the Wii settings menu, click on “Internet”, then “Connection Settings”, then your current connection.

From there, select “Change Settings” and skip forward until you reach the DNS settings (“Auto-Obtain DNS”) menu. Select “No” and then click “Advanced Settings”. Type in 18.188.135.9 as the primary and secondary DNS. Press “OK” and perform the connection test. If the connection was successful, you can click “No” to skip the system update.

Go back to Internet settings, then click “User Agreements”, then “Yes”. The system will appear to freeze for a couple of minutes. This is normal. In about 1.5-2 minutes, you will get a screen featuring a pixelated Rainbow Dash taking a nap. Welcome to the HackMii installer. Click “I ACCEPT” and wait for the installer to download.

After another few minutes, you will get a warning screen declaring that the software you are using is to be distributed free of charge and is not allowed to be exchanged for money. Thirty seconds later, “Press 1 to continue” will flash on the screen. Press 1 to continue.

On the Hackmii installer main menu, highlight “Install the Homebrew Channel” using the D pad, and press A to select. Select “Continue” once the installation is finished. At this point, I would install BootMii, but my SD card was having problems. I opted to skip this step and revisit it later once I knew my SD card worked, so for now, select “Exit”. (BootMii can be installed by launching the Hackmii Installer from The Homebrew Channel.)

Install Priiloader for brick protection

Since BootMii didn’t want to install yet, I opted to install Priiloader to have a level of brick protection. This application is a custom bootloader that allows you to select how you want the Wii to boot (either to stock system menu or to any number of bootable apps you can install). It also allows you to run recovery discs in case of a bricked system, so it’s pretty invaluable when embarking on this hackery nonsense. The trick to using any old SD card is making sure that you do a full (overwrite) format as FAT32. Once that’s formatted, you can download the Priiloader installer from GitHub, unzip the archive, and drop the “apps” folder into the root of your SD card.

A note about the Wii SD card

Homebrew apps on the Wii SD card live in a folder called “apps” in the root directory. Inside the “apps” folder, each app will have its own folder, and each app folder will contain a “boot.dol” or “boot.elf” file, an “icon.png” file, and a “meta.xml” file. If you’re having trouble with any Homebrew apps, check to make sure all these conditions are met.

Install Priiloader through The Homebrew Channel

Insert the SD card into the slot on the front of the Wii and launch The Homebrew Channel from the system menu. Click the Priiloader Installer and follow the directions on the screen. Once you return to The Homebrew Channel, power off the Wii.

Configure Priiloader

To boot into Priiloader, hold the RESET button while powering on the Wii. Once Priiloader loads, you can release RESET. For the initial configuration, highlight “System Menu Hacks” with the D-pad and select with A. For the initial configuration, enable “Region Free EVERYTHING”, “Block Disc Updates”, “Block Online Updates”, “Auto-Press A at Health Screen”, and “Replace Health Screen with Backmenu”. Save your settings, the press B to return to the main menu. Highlight “System Menu” to boot to the Wii home screen.

How To Install USB Loader GX on Wii

Now that we have The Homebrew Channel available to us, we can install a few niceties that can breathe a little life back into the unsupported mid-aughts console. First among these, we’ll need the ability to run custom firmware for the Wii (referred to as IOS). To do this, we’ll need the dx2 cIOS Installer. Download the application, unzip the archive, and place it in the apps folder of the SD card. Once the SD card is in the Wii, you can run the installer from The Homebrew Channel.

Install custom firmware on the Wii

Once the application loads, press A to continue, then match the settings as seen below:

Select cIOS: v10 beta52 d2x-v10-beta52

Select cIOS base: 57

Select cIOS slot: 249

Select cIOS version: 65535

Press A twice to install, then press A again to install the next cIOS:

Select cIOS: v10 beta52 d2x-v10-beta52

Select cIOS base: 56

Select cIOS slot: 250

Select cIOS version: 65535

Again, press A twice to install, then press A again to install the final cIOS needed:

Select cIOS: v10 beta52 d2x-v10-beta52

Select cIOS base: 38

Select cIOS slot: 251

Select cIOS version: 65535

Press A twice to install, then B to exit once completed.

Install USB Loader GX through Homebrew Browser

Download Homebrew Browser and place on the SD card like with the previous apps. Back on the Wii, launch The Homebrew Channel and select Homebrew Browser. At the very least, you’ll want to install USB Loader GX, Wii Mod Lite, and Nintendont. USB Loader GX is a full-fledged system menu replacement for Wii (and can be launched at boot through Priiloader) that will launch backup titles from a USB hard drive as well as install games to the hard drive. Wii Mod Lite will let you install custom channels to the system menu. Nintendont works inside USB Loader GX to handle launching GameCube games. Both apps are listed under the “Utilities” heading and should be at the very top (sort by popularity). Once the apps are installed, you can exit the Homebrew Browser.

A few notes about using USB Loader GX

USB Loader GX can be launched from the Homebrew Channel or through Priiloader. To launch from Priiloader, you’ll have to point the “Installed File” setting to the application and set the auto boot to “Installed File”.

The loader takes a few seconds longer than the stock Wii system menu to load because it’s checking for a USB hard drive. Also: make sure to use a USB hard drive. Flash drives tend to not work with USB Loader GX.

If a game does not load from the hard drive, try using a different cIOS. Select the problematic game, then click “Settings”. Click “Game Load”, then “Game IOS”. Enter the IOS you wish to try (249, 250, or 251), then click “OK”. Return to the banner screen and attempt to load the game. If the game doesn’t load, rinse and repeat. GBATemp has a pretty extensive compatibility list available here.

Installing USB Loader GX as a channel

If you prefer to keep the stock system menu on the Wii, you can still easily load USB Loader GX as a channel (saving you the step of having to go through The Homebrew Channel to launch). To do this, you’ll need to install the forwarder WAD. Download the WAD from the website and drop it in a folder called “wads” on your SD card. From The Homebrew Channel, launch Wii Mod Lite. Use the D-pad to select “WAD Manager”, then navigate to the wads folder on the SD card. Highlight the WAD file that you want to install and press A twice to install. Once installed, use the HOME button to return to the system menu. USB Loader GX will now appear as a channel!

Restoring Wii Online Services With RiiConnect24 and Wiimmfi

There is something kinda fun about those early internet apps that landed on the Wii. They’re definitely not worth anything more than historical curiosity at this point, but I think they’re still worth having around for play with. Then again, I like to use a 40-year-old luggable to play games on because it’s interesting, so maybe I’m not the best judge of this.

Restore online services with RiiConnect24

First, hit up the RiiConnect24 GitHub and download the latest version of the WAD patcher. It’s a pretty straightforward endeavor from there to just run the batch or sh file (depending on your OS flavor preference). Just follow the directions and be patient.

Once the patcher has done its job, return your SD card to the Wii and launch Wii Mod Lite from the Homebrew Channel. Like we did with the USB Loader GX channel WAD, select the files you want to install, then press A twice to install the batch. One thing to note: there may be an update to one of the service channels listed in the batch with the base channel WAD. Do NOT attempt to install the update WAD with the batch as it will likely fail. Exclude the update, install the batch, then install the update WAD. If you forget, you’ll need to uninstall both the update and the base WAD, then install one at a time.

Patching Wii Mail

From the Homebrew Channel, launch the RiiConnect24 Mail Patcher. Follow the instructions on screen, then press HOME when it’s finished. You’ve got mail!

Connecting to the new servers

Just like we did for str2hax, we’ll need to change the Wii’s DNS servers. Go to Wii Settings, Internet, and Connection Settings, then scroll to the “Auto-Obtain DNS” page. Select “No” then “Advanced Options” and enter 164.132.44.106 as the primary DNS and 1.1.1.1 as the secondary DNS.

Click “Confirm” and “Save” then “OK” to perform the connection test. Of course, don’t update the Wii.

Return to the Settings menu, and select “WiiConnect24” to make sure that “WiiConnect24” and “Standby Connection” are both enabled.

Finally, return to the “Internet” section and read/agree to the User Agreement.

Enable Wiimmfi for online play

Since Nintendo shuttered the Nintendo Wi-Fi Connection, officially-sanctioned online play has been dead. However, thanks to dedicated fans of the system, robust online play still exists on Wiimmfi’s private servers. You’ll need to enable these in a few different places:

For disc-based games, you’ll need the Priiloader patch. Launch Priiloader by holding RESET and powering on the Wii. Select “System Menu Hacks” and enable “Wiimmfi Patch v4”. Save settings and exit.

For games loaded from hard drive, USB Loader GX has support for Wiimmfi built in. The global loader options will have a selection for “Private Server” that can be set to Wiimmfi. Save those settings and USB Loader GX will patch each game when it runs!

For WiiWare titles, you can use the RiiConnect24 WAD patcher as described above, then reinstall the patched WAD with Wii Mod Lite.

A Serial Terminal For Windows Terminal

Since switching to Windows 11, I have fallen in love with Windows Terminal–the built-from-the-ground-up terminal emulator for Windows that combines everything that I loved about Linux and MacOS with the functionality of tabbed windows and a serious dose of customization. However, because much of my command line work falls into communicating with an external device over serial, I wanted to be able to keep that workflow within Windows Terminal like I’m used to doing already. In other words, I didn’t want to have to resort to using a separate GUI like PuTTY when a command-line tool like Screen or Minicom would do just fine. The problem is that, since the removal of HyperTerminal in Windows Vista, Windows has not included a CLI solution for serial communication (which is kinda weird because Telnet is still buried in Windows 11; if the reasoning was because obsolescence, you’d think that Telnet would also get the axe).

Now, since I have Ubuntu installed, I could just install Screen or Minicom and call it a day, but WSL 2 does not support serial communication. If I wanted to use those tools, I would either need to change the WSL version every time I wanted to use the serial port or install another instance of Linux under WSL 1. I mean, it works, but I really just felt it inefficient to have to fire up Debian (the install is smaller than Ubuntu) just so I could use Minicom.

After a little more digging, I found Makerdiary’s Terminal-S. It’s a simple serial terminal written in Python that can be compiled as a self-contained exe. This little gem was exactly what I was looking for in terms of functionality! It automatically connects to the COM port (or drops a list of available ports) and connects using some default settings for baud rate, stopbit, and parity. I can fire up Windows Terminal, invoke the command in PowerShell, and I’m good to go!

Windows Serial Terminal

But this is Windows Terminal, and I have this lovely menu of drop-down presets that will automatically spawn the environment of my choice with some lovely aesthetic theming. So, I want to be able to just click on a new tab and get that full retro terminal feel without needing to pretend I’m even in Windows! What I need to do is alter the program just a smidge so that instead of looking for flags in the command-line structure (ie -b for setting baud rate), the program will just ask me what settings I want to use (including some defaults for simplicity). To do this, I simply altered the @click.command section to only look for serial ports and moved the connection settings to a series of prompts in the main function, like so:

"""
Terminal for serial port

Requirement:

    + pyserial
    + colorama
    + py-getch
    + click
"""

import os
if os.name == 'nt':
    os.system('title Serial Console')

from collections import deque
import sys
import threading

import colorama
import click
import serial
from serial.tools import list_ports


def run(port, baudrate = 115200, parity='N', stopbits=1):
    try:
        device = serial.Serial(port=port,
                                baudrate=baudrate,
                                bytesize=8,
                                parity=parity,
                                stopbits=stopbits,
                                timeout=0.1)
    except:
        print('--- Failed to open {} ---'.format(port))
        return 0

    print('--- {} is connected. Press Ctrl+] to quit ---'.format(port))
    queue = deque()
    def read_input():
        if os.name == 'nt':
            from msvcrt import getch
        else:
            import tty
            import termios
            stdin_fd = sys.stdin.fileno()
            tty_attr = termios.tcgetattr(stdin_fd)
            tty.setraw(stdin_fd)
            getch = lambda: sys.stdin.read(1).encode()

        while device.is_open:
            ch = getch()
            # print(ch)
            if ch == b'\x1d':                   # 'ctrl + ]' to quit
                break
            if ch == b'\x00' or ch == b'\xe0':  # arrow keys' escape sequences
                ch2 = getch()
                esc_dict = { b'H': b'A', b'P': b'B', b'M': b'C', b'K': b'D', b'G': b'H', b'O': b'F' }
                if ch2 in esc_dict:
                    queue.append(b'\x1b[' + esc_dict[ch2])
                else:
                    queue.append(ch + ch2)
            else:  
                queue.append(ch)

        if os.name != 'nt':
            termios.tcsetattr(stdin_fd, termios.TCSADRAIN, tty_attr)

    colorama.init()

    thread = threading.Thread(target=read_input)
    thread.start()
    while thread.is_alive():
        try:
            length = len(queue)
            if length > 0:
                device.write(b''.join(queue.popleft() for _ in range(length)))

            line = device.readline()
            if line:
                print(line.decode(errors='replace'), end='', flush=True)
        except IOError:
            print('--- {} is disconnected ---'.format(port))
            break

    device.close()
    if thread.is_alive():
        print('--- Press R to reconnect the device, or press Enter to exit ---')
        thread.join()
        if queue and queue[0] in (b'r', b'R'):
            return 1
    return 0

@click.command()
@click.option('-p', '--port', default=None, help='serial port name')
@click.option('-l', is_flag=True, help='list serial ports')

def main(port, l):
    port is None
    if port is None:
        ports = list_ports.comports()
        if not ports:
            print('--- No serial port available ---')
            return
        if len(ports) == 1:
            port = ports[0][0]
        else:
            print('--- Available Ports ----')
            for i, v in enumerate(ports):
                print('---  {}: {} {}'.format(i, v[0], v[2]))
            if l:
                return
            raw = input('--- Select port index: ')
            try:
                n = int(raw)
                port = ports[n][0]
            except:
                return
    baudrate = input("Enter baud rate (Default 115200): ")
    if (len(baudrate) == 0):
        baudrate = 115200
    parity = input("Enter parity [N,E,O,S,M] (Default N): ")
    if (len(parity) == 0):
        parity = "N"
    stopbits = input("Enter stop bit (Default 1): ")
    if (len(stopbits) == 0):
        stopbits = 1    
    while run(port, baudrate, parity, stopbits):
        pass

if __name__ == "__main__":
    main()

Of course, it took me a little bit to deconstruct the program (as well as re-learn Python, which I hadn’t really used in any significant capacity for half a decade at least), but now I have it working exactly how I want it to work, and it feels right! Of course, I had never used Python on Windows before, either, so wrapping my head around PowerShell has been enlightening as well (Yes, I’m late to the PowerShell party, so I’m making up for it). Once I figured out how to use Pyinstaller (after remembering how to set a PATH variable in Windows), then I just have to drop the portable EXE file into a nice, out of the way place in Windows (might as well put it in a folder in C:) and make sure that folder is added to the PATH variable.

Add a folder to PATH variable

Adding a folder or application to the global PATH variable is a pretty simple proposition in Windows. From Windows Explorer, right-click on “This PC” and select “Properties”. This will bring up the settings dialog for System > About. Just under the “Device Specifications” section, click “Advanced System Settings” to bring up the traditional System Properties window. Click on the “Advanced” tab, then the “Environment Variables” button at the bottom of the window.

The “Environment Variables” window is divided into to groups: one for the current user and one for the system. In the system group dialog, find and double-click the line for “Path” to edit it. Click the “New” button to add a new line and type in the path for the folder or application you wish to add to the system PATH. When you’re done, click “OK” to close the window and save, then click “OK” to close the Environment Variables window, and finally click “OK” to close the System Properties window.

Customize Windows Terminal

In Windows Terminal, open the settings dialog and click “Add A New Profile”. Fill in the settings as appropriate. I’ve posted mine as a model:


Retrotacular

Of course, the real draw here is giving the terminal tab a lovely old-school green phosphor look which we can do either using the settings GUI to turn on the “Retro terminal effects” (this setting simulates CRT scan lines and gives a nice anti-alias that simulates the phosphorescent glow of the characters on the monitor). I’m using the Cascadia Mono font at 16pt weight to get the look I’m going for and the “Vintage” cursor style will round everything out nicely. For the color scheme, add the following block of code to the settings JSON file, then enable the new “Green Phosphor” color scheme.

{
            "background": "#000000",
            "black": "#000000",
            "blue": "#00FF00",
            "brightBlack": "#00FF00",
            "brightBlue": "#00FF00",
            "brightCyan": "#00FF00",
            "brightGreen": "#00FF00",
            "brightPurple": "#00FF00",
            "brightRed": "#00FF00",
            "brightWhite": "#00FF00",
            "brightYellow": "#00FF00",
            "cursorColor": "#00FF00",
            "cyan": "#00FF00",
            "foreground": "#00FF00",
            "green": "#00FF00",
            "name": "Green Phosphor",
            "purple": "#00FF00",
            "red": "#00FF00",
            "selectionBackground": "#FFFFFF",
            "white": "#00FF00",
            "yellow": "#00FF00"
        }

From here, everything is ready to go! Connect a serial device, fire up the terminal, and you’re off to the races!