Nvidia driver reload

I keep hitting an issue where nvidia’s drivers get messed up on Linux and it causes my plex media server to crash on startup, requiring me to restart. nvidia-smi would return this error: Failed to initialize NVML: Driver/library version mismatch.

I finally found some time to investigate and came up with a script to cleanly unload/reload nvidia drivers and allow plex to start up without a restart of my machine. Script below:

#!/usr/bin/env bash

# Ensure the script is executed with root privileges
if [ "$EUID" -ne 0 ]; then
  echo "Error: This script must be run as root. Please run with sudo." >&2
  exit 1
fi

echo "===================================================="
echo "Starting Live NVIDIA Driver Version Mismatch Fix"
echo "===================================================="

# 1. Detect and stop the active display manager
DM=""
if systemctl is-active --quiet gdm3; then
  DM="gdm3"
elif systemctl is-active --quiet gdm; then
  DM="gdm"
elif systemctl is-active --quiet sddm; then
  DM="sddm"
elif systemctl is-active --quiet lightdm; then
  DM="lightdm"
fi

if [ -n "$DM" ]; then
  echo "[+] Detected active display manager: $DM"
  echo "[+] Stopping $DM to free up GPU handles..."
  systemctl stop "$DM"
  # Provide a short pause for the system to settle the graphical stack
  sleep 2
else
  echo "[!] No standard active display manager detected (headless server mode). Proceeding..."
fi

# 2. Force-terminate lingering processes accessing NVIDIA devices
echo "[+] Checking for lingering processes accessing NVIDIA device files..."
if lsof /dev/nvidia* >/dev/null 2>&1; then
  echo "[!] Found processes clinging to the GPU. Forcing termination via fuser..."
  fuser -k -9 /dev/nvidia* 2>/dev/null
  sleep 2
else
  echo "[+] No user-space processes currently locking the GPU."
fi

# 3. Unload existing kernel modules sequentially from most to least dependent
echo "[+] Unloading active NVIDIA kernel modules..."
modules=("nvidia_drm" "nvidia_modeset" "nvidia_uvm" "nvidia")

for mod in "${modules[@]}"; do
  if lsmod | grep -q "^${mod}"; then
    echo "  -> Removing module: $mod"
    if ! rmmod "$mod"; then
      echo "  [!] Error: Failed to remove $mod. Checking for persistent locks..." >&2
      lsof /dev/nvidia* 2>/dev/null
      echo "  [!] Please manually stop any background tasks listed above and rerun this script." >&2
      exit 1
    fi
  else
    echo "  -> Module $mod is not currently loaded or already removed."
  fi
done

# 4. Reload updated kernel modules sequentially from least to most dependent
echo "[+] Reloading updated NVIDIA kernel modules..."
reload_modules=("nvidia" "nvidia_uvm" "nvidia_modeset" "nvidia_drm")

for mod in "${reload_modules[@]}"; do
  echo "  -> Loading module: $mod"
  if ! modprobe "$mod"; then
    echo "  [!] Critical Error: Failed to load module $mod." >&2
    exit 1
  fi
done

# 5. Restart the display manager if one was originally running
if [ -n "$DM" ]; then
  echo "[+] Restarting display manager: $DM..."
  systemctl start "$DM"
fi

# 6. Verify NVML initialization status
echo "===================================================="
echo "Verification Check"
echo "===================================================="
if command -v nvidia-smi &> /dev/null; then
  echo "[+] Running nvidia-smi to confirm fix..."
  nvidia-smi
else
  echo "[+] Modules reloaded successfully, but nvidia-smi utility is not in the system PATH."
fi

Gitlab pages for static sites

I recently discovered gitlab pages when looking to host a static website. Rather than mucking about with hosting, nginx, let’s encrypt, etc. for static content why not try something new? I wanted to create a static page with a background video so I used some footage I captured at sunset with my Mavic Mini drone a couple of years ago. I’ve been sitting on this domain (secondangle.com) for ages, so why not? Some really quick (and dirty) angular, git, and some domain TXT entries and it works without issue. The video is hosted on Backblaze B2 rather cheaply too. Although I probably need to revisit encoding so it loads quicker.

Project Source: https://gitlab.com/mreaston/secondangle-placeholder

Video:

Kenmore fridge defrost

I came back from vacation to a fridge that wouldn’t get cold and a freezer that was iced over in the back. I have a bottom-freeze model so I knew the issue – ice was clogging the duct that allows cold air up to the fridge. I’m guessing the defrost cycle didn’t kick in enough to defrost the back so I used some hot air to try and clear the path. That worked but there’s no easy way to trigger a manual defrost from the manual. Until I found this video which worked!

After a couple of cycles everything seems to be working better. I still have a Raspberry Pi monitoring the temperatures so I can keep an eye on it before I do some actual fixing. But so far, so good. See this post for that project: https://chriseaston.com/2023/01/30/fridge-and-freezer-temperature-monitoring/

A little warm after the defrost cycle but more in line…

Another host bites the dust

This site used to be hosted on chunkhost.com for the longest time – it was a decent service for the longest time, and cheap, which made it ideal for a random blog. After a couple of years I had one issue trying to reboot a server that was stuck rebooting since November 2022 and I decided to reach out to support — which was non-existent. I tried to reach out to some folks on twitter and the same issue — then I get an e-mail that they’re finally shutting down after all this time. Well that sucks.

Around a couple of months ago I had moved a couple blogs and an old forum (forums.psx-dude.net) off that host and onto another, cheap, dedicated server at dedihost.com. That was going well until August 31st I get an e-mail they’re shutting down immediately and to move stuff off. Welp, there goes another couple of hours trying to move websites and find a new host. I haven’t done it yet — I did grab backups — that’ll be done shortly as I get one set up.

So here we are, another host bites the dust. This post might go to the ether if I forget to grab the backups or transition to a new host in time. Time will tell, stick around if you randomly stumble here. It’ll be not that interesting 🙂

Ideally I could host from home like I did in the late 90s, but I haven’t looked into doing that with port forwarding, dynamic ips and the like. But worth exploring.

Fixing upload limit w/HTTPS-Portal and WordPress docker images

I was trying to upload this photo of my dog to test out some things and hit an issue with https-portal and the wordpress docker images. I thought I’d share my fixes since it wouldn’t let me upload anything over 1MB.

The https-portal has a limit of 1M, so you need to add the CLIENT_MAX_BODY_SIZE environment variable to whatever size you want, I went with 500M so I added that to my docker-compose file.

The wordpress container has a php.ini limit of about 2M as well, so you need to modify the uploads.ini file to be:

file_uploads = On
memory_limit = 500M
upload_max_filesize = 500M
post_max_size = 500M
max_execution_time = 600

That should do it. Finally to tie it all together if you’re using docker-compose you’ll need to add a volume section to copy that file into docker:

volumes:
 - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini

Hope this helps someone!

Fridge and Freezer Temperature Monitoring

A couple of weeks ago I had the unfortunate problem of my freezer’s auto-defrost not kicking on an the coils freezing completely. This led to my fridge not cooling down past 60. I had to take apart my freezer for the first time to de-ice the coils to get it working again. Then I got the bright idea of using some of the spare temperature probes I have and a spare Pi to monitor temperature. So I wired up a Pi and created a dashboard for monitoring temperatures in Grafana out of a postgres database.

Wiring was really simple, I just followed this guide to wire multiple probes up: https://www.hackster.io/vinayyn/multiple-ds18b20-temp-sensors-interfacing-with-raspberry-pi-d8a6b0

Code looks like this: https://gitlab.com/-/snippets/2491465

A couple of minutes in grafana and I get some cool graphs like this:

Continue reading “Fridge and Freezer Temperature Monitoring”

The Avenue Burger at Barrelhouse 101

Location: Ventura, CA.

I found this burger (https://imgur.com/gallery/m97eumu) on Imgur and wanted to try it out since I’m nearby. It was really tasty with a lot of flavors going on. The spiciness was great at first too. Lots of chorizo flavor but not a lot of burger flavor after a while. The ingredients were all fresh and tasty. It made quite a mess but was delicious! I’d probably try a different burger there next time.

Gitlab Pages + Namecheap

I came across a small issue when trying to use some namecheap domains with Gitlab pages, namely two stupid joke pages: burgerlover.us and fsdbutton.xyz. I couldn’t get the verification to happen after adding the TXT entries. One simple support issue led me to find the reason, which is namecheap appends the domain automatically to the field.

So instead of entering _gitlab-pages-verification-code.www.burgerlover.us like gitlab suggests for the host, just enter _gitlab-pages-verification-code.www for example, which will fill in the rest. That did the trick.

Hope it helps some other folks.