Category: linux

CasaOS – Upgrading Containers

Update: As of the latest iteration CasaOS has an option to “Check and then update.” However, when I ran it against PiHole, which needed an update, it came back claiming current. So… these instructions still stand for the moment.


As of the current iteration of CasaOS, there’s no way to one-click yourself an upgrade on a container. Or, rather, there is, but only sort of. It’s all about how the container installed initially.

To check, pull a config file from the container in question:

  1. Settings > choose Export ComposeFile
  2. Open the file in your text editor of choice and search for the image: line. If it says something like “latest” or “develop” you’re good to go:
  3. In this instance, all you need to do is click Save in CasaOS and the latest image will be pulled down and installed. But wait! Keep reading before you do so! If nothing else, jump down to step 7.
  4. If the image has a hard coded version number, you’re going to need to change it to “latest” and save the YAML (as a different name, or take note of the version number, just in case you find you need to revert):
  5. In the event you’ve had to  update your compose file, now comes the sweaty bit. You need to uninstall the app from CasaOS. If you’ve mapped all your data volumes correctly, this should be fine. Just remember to uncheck Delete userdata when prompted:
  6. Once uninstalled, reinstall the app:
    1. Select App Store, then Custom Install
    2. Select the Import icon on the top right and select your YAML file.
    3. All the settings will be loaded in – confirm them and let ‘er rip.
  7. Now, if you’re making a big upgrade, or an upgrade to a big app, things can get pinchy here for a bit. For instance, I upgraded Navidrome, my music server, and CasaOS barfed a message at me saying something akin to the container being unwell. I run PiHole in the same CasaOS instance, and I noticed that my browsing/DNS resolving had become profoundly slow. CasaOS’s nifty little stats didn’t show anything exciting insofar as resource utilization, but the CasaOS page was also profoundly slow and sluggish. I pulled up the terminal for Navidrome and discovered this:
  8. Now, I have a lot of music. A LOT. So I SSH’ed into my device running CasaOS and navigated to the data directory for Navidrome to discover this:
  9. Navidrome was indeed hard at work upgrading its ridiculously large database – as I refreshed I the timestamp on the db-wal file would continue to iterate.
  10. Eventually the database upgrade finished, Navidrome loaded, and the container was healthy and upgraded.

The moral of the story is, be patient! Don’t freak out if CasaOS delivers some kind of ominous warning – dig deeper before doing  something drastic, like killing a running container in the midst of upgrading a critical database. I suppose you could be double safe by making a backup of your apps data directories before attempting an upgrade. I live on the edge. I recommend going through all your containers and updating all of the ones using hard-coded versions with something like ‘latest.’

Jellyfin – Migrating Users

I’m moving from a Windows based instance of Jellyfin to a containerized instance within CasaOS, and I wanted to preserve user data (including view history). Here’s how I did it:

  • Confirm both your source and destination Jellyfin are the same version
  • Export the UserDatas table from library.db for your source instance. You can use DB Browser for SQLite to achieve this – remember to check “Column names in first line”
  • On your destination server, make a backup of library.db and jellyfin.db
  • Again using DB Browser, open the library.db of your destination server. Drop the UserDatas table and import csv created in the prior step to recreate the table (remember to check that the first line contains the column names)
  • Copy jellyfin.db from your source server and overwrite the db from the destination with it. This is important, as this file contains user history data
  • Fire your new Jellyfin instance up and attempt to log in with an existing user

 

CasaOS and LinkDing

Giving LinkDing a whirl. It isn’t featured in any of the stores I’ve found, so I rolled my own. Here’s a sample YAML:

Once it’s up, hit the terminal and create a user with:

From there it will prompt for a password.

Persistent Windows SMB mount in Raspbian via CIFS

I’m using Navidrome in CasaOS on a Pi for music right now and I like it quite a bit. The one thing irking me was that the network storage mounts you can define within CasaOS (Files > Location > Connect network storage) don’t persist. At least they don’t for me – every reboot or update and they’re gone.

I’ve gotten around this by creating a persistent mount within Raspbian utilizing CIFS.

SSH into your Pi, and go ahead and

to avoid having to sudo every line you input. First, make sure cifs-utils are installed (they should be, but still):

Now create a credentials file for your mount to access using nano:

Populate the credfile with the credentials necessary to access your Windows share:

Save it, then set the appropriate permissions to keep it safe from prying eyes:

Create a mount directory on your Pi to link the share to:

Now open fstab:

Add your mount to the bottom of the file, changing the first path to the Windows share and the second to the mount path you created previously:

Finally, reload the daemon:

And mount the share using the details you defined in fstab:

To confirm, cd to the share and confirm you can see the contents.

Calibre Web in a Container, and Credentials

My Calibre Web installed via container in CasaOS decided to lose its admin account creds. To reset, access the container terminal from within CasaOS, navigate to:

and enter:

Where password is your updated passy. If you try to use ‘password’ you’ll probably be kicked back for it not meeting complexity requirements.

Cron for Dynamic DNS Updating

I use my commercial host, Ionos, for websites, including creating subdomains for ones I’m hosting at home. However, I don’t pay for a static ip. I was using a Windows Scheduled Task to curl the necessary URLs to keep the IP updated, but I’m switching everything I can over to Linux, and a Pi.

Start by creating your .sh file and making it executable. I created dnsupdate.sh in my home dir on my Pi, and populated it with my curl calls. I did this via Nano. Then make it executable:

Then I fired up cron by entering:

It’s going to ask you for an editor on first use. I say, stick with Nano.

After this it will present you with a crontab file. Scroll to the bottom and enter:

This will run your sh file every hour at the top of the hour.

Save the file.

If you want to see what’s up with Cron, enter:

If it’s running, it’ll show you the files – your sh file – in use by cron.

CasaOS and Caddy

Briefly – Caddy wouldn’t work out of the box for me on CasaOS. In this build, the default container path for the caddyfile is incorrect. Change the container path from

to

Also, don’t forget to adjust ports, our you’ll inevitably be running into CasaOS itself. I changed my HTTP ports to 85:

Then you can SSH into your CasaOS Pi, head to /DATA/AppData/caddy/caddyfile, create your Caddyfile, er, file, and populate it appropriately. If you’ve been running Caddy elsewhere, I recommend running the below to confirm your file’s format:

CasaOS and bash in Docker

I installed ArchiveBox on CasaOS and came upon a problem – I couldn’t figure out what the default credentials are, or even if there were any, and I didn’t know how to generate them from the command line. ArchiveBox told me to create a new superuser by running

From the command line, but doing so within the container terminal resulted in this:

But I found my way into the container bash thusly:

  • SSH into your pi running CasaOS
  • search for your ArchiveBox container ID:
  • You’ll see a path in your return with a long, long directory name, something like
  • This is your container ID. CD to /var/lib/docker/containers/and run the following, where containerID is the above ID:
  • This will invoke a bash within that container. From within it, run:
  • And follow the prompts to create a superuser for ArchiveBox. To drop out of bash, just input exit.

 

CasaOS – Tinkering

Somewhere in my intertoobs wanderings I came across CasaOS and, given I had an idle Pi 4 laying around, I decided to poke at it. After all, if it works worth a damn it could help consolidate all the disparate systems I have running locally.

CasaOS is basically a slick Docker manager that rides atop another OS. Getting it up and running on the Pi with a fresh Raspbian install was painless. Simple configs, like mounting network shares, is a breeze. So far I have the following running in it:

  • PiHole – Installed without a hitch. If this runs well it’ll replace the standalone PiHole Pi 3 I have running.
  • Calibre Web – Also installed without a hitch. Love this, because I hate running the Calibre thick client full time on my server simply for its web interface. Not a lot of instructions on this one – just make sure you have your library mounted and defined as a volume in the container settings.
  • Jellyfin – Another painless install (make sure to mount your files volume as described in the above Calibre Web settings). I installed this as a replacement for my current Jellyfin music server, which runs standalone in a fully fledged VM, gobbling unnecessary resources. But I stopped it midway through indexing my gajillion files because I discovered:
  • Navidrome – Will it be better than Jellyfin for audio? I don’t know, but I’m giving it a shot.  Currently still indexing – on directory number 12406. Heh. Now, Navidrome wouldn’t run initially, and CasaOS kept screaming that it was unhealthy. Its log filled with “exec /app/navidrome: exec format.” I discovered that the image I was pulling isn’t the most recent. I exported the ComposeFile from within the settings of the failed install, uninstalled it, and updated the image source in the ComposeFile to point to “ghcr.io/navidrome/navidrome:develop.” I then imported the file (Custom Install > Import from within the App Store) and it installed fine
  • Memos – Completely painless install. Came across this randomly and figured maybe it’d replace my TiddlyWiki instance running on my server. We’ll see.
  • Mealie – I ran across this neat app via some Youtubers Apps of The Year vid and was intrigued. An app that’ll scrape a online recipe page, pull the pertinent details of the recipe and ditch all the ads and fluff? Yes please! However, Mealie wasn’t in the default app store for CasaOS. I found CoolStore for Casa and added it as a source. From there Mealie installed no problem, and now I have a slew of other apps to sift through as well. Perhaps Casa can even replace my standalone VPN Pi. We shall see.

No-IP DUC (Dynamic Update Client) for Raspberry Pi as a Service

I originally followed No-IP’s instructions for installing their DUC on a Raspberry Pi, and thought things were fine until I discovered upon IP change that updates weren’t. Updating, that is. With a little research I came across this extremely helpful site which outlines how to install the No-IP DUC as a service on Raspbian. Be aware, the instructions start from scratch, assuming that you don’t have the DUC installed yet.

For the bit highlighted above, you’re going to instead want to navigate to whatever the directory is that your DUC installation dir is within. In other words, if the NoIP DUC lives in /home/pi/noip/noip/noip-2.1.9-1 you’re going to want to navigate to /home/pi/noip before pulling down and unpacking that .tar as instructed in line 2/3 there. Other than that, this worked like a champ. Thanks site person!