Containerized Development Environment

Good Morning from my Robotics Lab! This is Shadow_8472, and today I am building my own dice bot for Discord using containers. Let’s get started!

Overview

In last week’s post, I learned how difficult a Discord dice roller is to find that is either already in a container or suitable to install into one. However, I did develop my skills along the way, and I believe I’m ready to make a bot of my own from scratch.

Development Environment

None of my machines had Python on them (except perhaps excluding the odd Raspberry Pi I have laying around), so the first order of business was to set up my own environment inside a container. There are a number of base images for running Python, but for development, I chose the latest official Python.

Podman pull python:latest

I went back and forth several times with the geometry of my bot project. I ended up stashing my work last week into a directory and making another to hold this round. When I was done, I had three files of consequence: Dockerfile, requirements.txt file, and a directory called home.

When I tell Buildah to make an image, it first goes to the Dockerfile:

FROM python:latest
COPY requirements.txt .
RUN python -m pip install -r requirements.txt

This takes the Python image, copies in requirements.txt, and references it to install any dependencies that don’t come with Python by default, namely as discord.py. As such, requirements.txt had a single line:

discord

Container base images leave out a lot of quality of life programs one might expect on a normal Linux install, like a text editor. That’s where the home directory comes in.

podman run -t -v /home/shadow8472/<bot project>/home:/root:Z -i dice_development:latest /bin/bash

This command has Podman use that image to make a container, mount that home directory into the container as /root (:Z is to tell SELinux it’s all good), and start a bash shell. From here, I can

podman attach <container name>
cd /root

and run the bot’s .py file. With the shared directory, I can edit it from the relative comfort of the host computer, ButtonMash, and go straight to running it inside the container. Best of all, the container will keep running with the bot if my connection to the host is broken, like if the network drops out or if I willingly close the terminal window. When I want to keep working, I can reattach the container.

Login token as environment variable: will my mental innovation of using the dockerfile to assemble it into a format Python understands work?

Development

I don’t have many comments about the actual development of the bot. It’s been a while since I actually programmed, and it’s been longer still since Python. I learned the basics of async programming a few years ago, and discord.py is building on that introduction, but I’m not setting out to master it just yet.

On my way to first stable “release,” I was coding up a loop meant to fill an array with die rolls. A bit of C++ grammar slipped in, and only after asking around did I identify it on my own and fix it. Another time, I coded an echo! function to practice passing command extensions into my code.

Most of my time went into constantly overhauling the internal logic. My early prototype was hardcoded to build its output string one die at a time, but I had to rework the back end to store the dice as they came in so I could sum them up and display that separately. All this was done while trying to keep it in a near-functional state.

But there are times a feature needs invasive re-working. I have some code in my comments that eliminates string manipulation from a function that should only be dealing with numbers. I’ve tried learning a popular version control system called Git in the past, but I can feel that I might actually stick with it this time. I’ve started reviewing commands, but I have yet to start using it as of writing.

Side Project

My week started off rough. I found my Derpy Chips workstation with a blank screen when I went to pull up last week’s post for some last minute proofreading. Initial diagnostics showed the screen blanks 0-30 seconds after making a picture from waking up. I got some help pouring over journalctrl and Xorg logs, but everything looked normal. The problem persisted through rebooting, pulling the GPU (graphics card), booting to an external drive, driving the monitor with my laptop, and even using a DVI cable instead of an HDMI. Final diagnostics turned up a dying backlight. I re-enlisted a personal museum piece –a vintage cathode ray tube model– to fill in until a suitable replacement can be procured.

3D Printing

Turns out that while I can play Minecraft just fine on integrated graphics, Slic3r pushes a few too many polygons for a smooth experience. I can’t run the old monitor off the graphics card because the card doesn’t have a VGA connector. Until I get a replacement monitor –or at the very least an adapter– I’ll be stuck with printing pre-made .stl objects or else installing Slic3r on another workstation.

What I did instead this week was make my own profile picture for the dice bot. I found a few dice I used to role play with and set them up in my photo booth. I even used a bead from printing the Z-braces to support a die in the back. I tweaked the picture a bit in GIMP to make it look more like the actual dice before uploading it for my friends’ enjoyment. It was not fun to fight the .jpg compression the entire way.

Takeaway

Programming is a completely different side of technology than systems management. It’s been a rewarding experience assembling my own environment to work in. It will need even more tweaking if/when I need to adapt it for use with an IDE, but those are for people who either already know everything that’s going or or those who don’t care to learn what’s going on at a basic level.

Final Question

Async functions are weird. I am after a small function to both log and send a response message. How do I pass an async call to another function? Am I even asking the right question?

I Buildah Discord Bot

Good Morning from my Robotics Lab! This is Shadow_8472, and today I am working on a dice bot for a role play on Discord for a few friends. Let’s get started!

Seeking a Container

Many projects are like a tree in terms of having a general sense of progression up from the root and the fine details take most of the work to perfect. This week, my project was a rose bush. I have an end-goal in mind, but I want to run it from a container, a technology I still haven’t fully introduced myself to.

My plan started out simple: find a Discord dice bot already in a container and get it on the server. DockerHub, a sizable repository of OCI (Open Container Initiative) container images. (Most places call them Docker Containers due to its popularity over the past ten+ years. Searches for help should be worded accordingly.) I located about the only one that met all my simple criteria and made myself a bot account for it.

Discord bot accounts are more similar to human accounts than I gave them credit for. The only big differences are that bot accounts log in with a token instead of a username/password and the interface is different to accommodate a program instead of a human. Just as you only interface with your account to make posts, so too does a bot interface with its account to make posts. Give the login to someone or something else, and Discord shouldn’t care.

Long story short, the bot was set up to use an environment variable when using the image to make a container. Once I got it logged in, it ran into other problems I wasn’t prepared to diagnose.

Learning to Build Containers

With my only obvious option a bust, I set my sights on a Discord dice roller I’ve used in the past made by SkyJedi for the Star Wars tabletop RPG’s and a generic spinoff called Genesys. The game I’ll be running is GURPS, which focuses on using 6-sided dice. Plus it has an interesting turn counter system for combat I’d like to try using. The rest is fluff to me this time around, so long as I get it working.

A quick tell of an intense week is when I spend a whole day watching tutorials on the same subject over and over again until I find one at my level. This was one of those weeks. I remember there being one breakthrough video right at my beginner level that let me go back and follow the logic of more advanced tutorials that previously dazed me. During this intense study session, I puzzled together how to use Buildah at a beginner level, what a Dockerfile does, and went from muck to murk in my understanding of Javascript.

Buildah is a for making OCI containers Podman can later run and another tool I haven’t yet explored can edit. Like Podman, Buildah’s corner of their ecosystem aims to replace Docker commands one for one. It’s a win for people switching from Docker, and a win for newcomers like me who can look back at pertinent Docker documentation.

Docker –at least– takes a layered approach to making containers. Using a Dockerfile (one word, also its file name with no extension) lets you build start with a base image and build it up layer by layer, one command at a time. Parts can then be swapped out and the image rebuilt as needed.

The Star Wars dice bot is written in Javascript. If there’s one thing I learned about Javascript this week, it’s that there are several “frameworks” for both front-end development (used to make things look nice for users) and back-end development (used for internal logic). More specifically: I needed to look into NodeJS, a back-end framework. Node has a few different base images on DockerHub, so I worked with the full one with the intent to swap it out for smaller ones for a much smaller image.

Assembling My Own Containers

It took a very special set of circumstances during my self-study for containers to really click. First, I’ve been working through the Podman plugin for Cockpit. Individual images and containers are presented in an intuitive way. Each container has tabs for info, logs, and console access. The life cycle of a container is tied to executing a single command, but if that command is to start a shell, I can interact directly with the container like I would at any other command line. I could test commands from there, and if I got something right, I could add it to the Dockerfile for my next iteration.

I was actually able to find SkyJedi’s Discord server and contact him directly. He wasn’t familiar with containers enough to help me, but he did direct me to a much simpler bot of his I was rapidly able to package into a Node container – and later a Node:Alpine container.

The difference was login token. No matter what I tried, the full dice bot would not accept its login token. I was not able to figure this out, though I came quite close.

Side Project

I’m considering a new weekly segment where I work with my 3D printer a little bit each week. This week, I printed up a calibration cube using everything I’ve learned so far. It’s still far from perfect. I still need to tune in my Z-braces, as I can tell from some faint ringing I can more easily feel by running my thumbnail across it. I still need to calibrate my E-steps, a process I may need to repeat a few times as I come up with interesting, new ways to improve my printer.

Takeaway

After all that, I looked ahead at a the database I’d need to deal with once I get the bot logging in, and I’m almost certain now that my time will be better served making my own bot in Python. Of minor interest, I was able to learn the curl command better. Rocky Linux apparently doesn’t come with wget, the terminal program I usually use to download files. Curl –on the other hand– copies the contents of links to the stream. When directed to a file, it does the same job as Wget. A cool trick I pulled off involved manually following a redirect link.

Final Question

I feel like a rose bush gardener with nothing to show for his work but the tools he’s learned to use along the way. What projects have you farmed up a bunch of dead ends on?

3D Printer Modding

Good Morning from my Robotics Lab! This is Shadow_8472 and today I am upgrading my 3D printer. Let’s get started!

In Pursuit of a Perfect Print

I really upped my 3D printing quality last week, but I still have a ways to go for so-called perfect prints. The Maker Select Plus was a good choice for its day for learning the basics of printing, but official maintenance options are lacking outside the design’s communist country of origin.

But who says my 3D printer has to remain 100% stock? It’s a time-honored tradition to use what tools you have to improve upon said tool set, and with 3D printing technology, precision parts are easier than ever to manufacture. I don’t need some company to sell me an upgrade I can make myself.

Ringing

I was advised last week that I have a ringing problem with my prints. The head and build plate on my printer each have mass. As these masses whiz around each other with high accelerations, they shift the steel frame ever so slightly in the opposite direction per Newton’s Third Law. This sends waves of energy back and forth through the whole unit and right back into the print area. Unless the slicer has some way of anticipating these waves (good luck), they’ll manifest in the print as filament is laid as ripples.

I’ve found three ways to reduce this effect: print slower, reinforce connections, and tune belts. Slowing the printer as it prints perimeters is a simple setting in PrusaSlic3r. Belts are a bit harder to access, so I won’t be covering those this week.

I located a whole series of Z-braces on Thingiverse[1]. I picked one remixed specifically for my printer (and its many, many clones) after hours of research. In addition to holding the vertical truss in place, the brackets are designed with adjustable feet so I can remove the paper soup I have been shimming my printer level with, allowing the bad vibrations to more efficiently dissipate into the table.

Printing and Error

By some amount of pure, dumb luck, I managed to print around half the pieces by volume in one go overnight: a bracket for each of the two back corners and four nut covers for up top. I’m at a loss for words for how I felt when I first handled the brackets and the flat parts came out smooth. Closer looks over the following days turned up additional flaws.

The other four pieces weren’t nearly so cooperative. The upper brackets have four holes through the first layer. Between them and the outer perimeter, each loop contributed what felt like a 50% chance of failure. I finally got a successful first layer after what felt like forever and the printer messed up one of the bits for the second bracket and I got myself a wafer to photograph. It was recommended I calibrate my flow rate – a worthy project for another time. I’d just as soon keep the quality consistent within a project. Each remaining bracket was printed individually.

The project calls for metal rods, nuts and feet, but since Monoprice shortened the screws to just barely be long enough for the stock printer, those too must be replaced. My father stopped by the hardware store to pick those up. The trip must have gone well, because they carried everything described on Thingiverse down to the exact package in some cases, such as the feet.

Installation

Read your instructions, if you’re following along. I found that each generation added a little something to the files, but cut material from the directions. I got a little mixed up.

We started by installing the feet. The instructions suggested using a press to shove them into their brackets, but my father cut them to size so they fit hand-snug. The brackets fit nicely on their respective corners, and the back ones even had a notch cut out to accommodate stuff sticking out around the power interface. The other side is mirrored.

We tried a number of things with getting the rods situated, but what I found worked best was a pattern of bottom-top-middle. Apply the first Nylok nut to the bottom of the rod and adjust it so the rod is just barely still within the bottom bracket when the nut is as deep as it can go. Add the middle nut, another Nylok, adjust it below its final position, and add a cap. Slip the rod through the upper bracket – be sure to have another cap and then a regular nut. The caps should be pointing into the upper bracket. Tighten the upper capped nut into its final position, then carefully adjust the middle nut into place. To spare your hands and the parts, you may want to grip the rod with pliers through a paper towel while twisting with another tool.

Side Project

I installed the ProjectKorra plugin for Minecraft 1.18, as it was something I’ve done before and every other project I looked into kept looking more involved than I had time for. I needed FTP access to upload it, and Filezilla was already on my laptop when I thought I’d need to either install it special or move to another workstation with it. I did, however, use Derpy to download to cold storage so I wouldn’t be streaming over the Wi-Fi and back.

Takeaway

I printed a white Benchy with an existing .stl file keyed to the other filament spool’s temperature. I had to adjust it mid-print. As for surface quality, maybe there’s a little less ringing, maybe it’s just noise. I will want to tune my printer farther in the future.

Final Question

I’m getting bored of Benchy. What are some other tests I can try?

Work Cited

[1] morjagel, “Z-Brace for Monoprice Maker Select Plus,” Thingverse.com, April 27, 2017. [Online]. https://www.thingiverse.com/thing:2349318. [Accessed Jan. 31, 2022].

Filament Switch: Hard Mode

Good Morning from my Robotics Lab! This is Shadow_8472 and today I am learning a lot about the medium-grain details of printer calibration. Let’s get started!

Low Filament

My red filament is almost gone. I was considering using the rest on printer calibration tests, but when I found it broken, I went ahead and readied my white filament – the spool I have historically had a harder time with. I used my loop of cleaning filament to reach into the print head and push/pull out most of the remaining bits of red gunked up in there. I found a little red afterword, but there was surprisingly little leftover overall.

My printer’s print head works by grabbing the filament directly above the hot end, and there’s just enough room for filament to get lost during loading. I didn’t think much of it when a section of filament broke off in there. I made note, then set the printer up for several hours of operation. As of drafting this paragraph, it hasn’t caused any problems, but I’ve already researched the solution.

Temperature Tower and Mini Test

The first thing I printed was the temperature tower using the same .gcode I downloaded in a previous post. I should have the skills to slice up one for myself now thanks to playing around with the PrusaSlic3r interface, but I’ve used it before and it didn’t destroy my printer. I was expecting this filament to want it a bit warmer than 185 degrees C, but I was surprised when the only slightly warmer floor for 190 turned out the best.

I sliced up a 190 degree version of the mini all-in-one printer test. When I printed it over the central bed’s scratch, I saw a black spot in its middle of the first layer. As the build plate deformed, that must have been where the material went. Other results appeared to be on par with when I successfully printed one in red: I could read more of the test labels, but it felt brittle. The stringing test actually broke in an accident in the completed photo booth.

Benchy, the Benchmark Tugboat

I took part in a 3D maker tradition and printed Benchy, a tugboat designed with a number of challenging geometries. I’d say it came out pretty well – hardly perfect, but my untrained eye only noticed a couple major issues I took to the photo booth about. I found that I could actually use my begging-brother-special camera by letting it do whatever it wanted with auto-focus, then correcting it with a handheld magnifying glass.

I was able to post a series of pictures of Benchy in a few places on Discord and ask for help. Through feedback, I learned my most interesting issue is probably ringing. Ringing (as in like a bell) is when sudden movements cause vibrations the stupid 3D printing machine doesn’t account for. I need to print more slowly and work on a way to level my printer frame without resorting to paper soup like I am now.

My second Benchy went better overall. Per other advice, I used thinner layers and left my case open. I tried slowing the print job, but with Slic3r’s many settings and a delay in communication, I wrongly guessed that limiting long-distance speed would improve quality the most when I should have gone after perimeters instead.

The print itself has more, smaller flaws than my first. For starters, the lettering on the bottom totally failed. I got these odd bubbles over the ship deck and cabin roof. Other than that, the layers were all a whole lot smoother, there was no stringing, and a plaque on the back was clearly something –it wasn’t legible– but it didn’t look like a random mess. I also had some bubbling along the tops of the deck and the cab roof: probably steam from hydrated filament.

With my white filament sent off to the dehydrator, I printed a couple more Benchys in red. They both turned out about the same. The one where I added the front panel back in fixed one of two of the water lines, but seemingly made the other one worse.

Over on the dehydrator, my old, white filament is in for the thermal stress gauntlet. I ran it closer to the glass transition temperature than before to the point where a loop of filament sticking up collapsed under its own weight. Weighing it before and after showed no change in weight. It at least looks like I didn’t accidentally melt the whole spool. If I did, it’s tricky filament anyway. It still feels brittle, but I’ll try using it with a few larger prints as-is and see how they turn out.

Side Project

As soon as the calibration part was off the printbed, I started on a gift for my sister, Taz. She showed interest in helping with cleaning Twilight, so I made her a figure of Tails, Sonic’s two-tailed sidekick/best friend. I found an offering on Thingiverse with Sonic, Tails, and Knuckles. I didn’t like Knuckles’ pose, and I personally prefer Tails anyway. Later, I thought of about eight good reasons pointing out the back of Sonic’s head as to why he might be the more challenging cleanup (his quills).

I wanted Tails to have an inch of height for every foot the character is tall. Tails’ base plate was about 1/8 the height of his figure overall. I grabbed his height from the Sonic Wiki and scaled accordingly. There was no way I would be getting away without at least partially printing on the scratch, so I just left it centered.

While trying to remove unnecessary supports, it became apparent that these models can’t have been intended for anything but resin printing. Internal voids kept begging Slic3r for support material. I removed them in Blender so I could use my favorite infill setting (15% 3D honeycomb). I found another cavity for his mouth and tongue, but I felt lazy and fed him an appropriately squashed and rotated solid “sphere” object to fill his mouth instead. Thinking of infill, I knew the bottom of the baseplate would be due for some sort of modification, so I just printed it solid.

The figure came out… well, let’s just say it was a learning experience for both of us. I may have rushed the slicing a little to keep the secret. The supports were a mess. The print was plagued by this ringing phenomenon I had yet to learn about, and his arms, legs, bangs, and face/chest fluff were tiny – as well worded by Taz when she said something about literally knocking his socks off. He came out recognizable, but a larger follow up attempt is in order after I finish mastering the not-quite basics presented above. For what it’s worth, the base does have some decent heft to it.

Takeaway

I’ve already said this, but there is a lot more to 3D printing than sending it a file and hitting go. Then again, where was consumer 2D computer printing when the technology was ten years old? There’s a story in my family about someone rewriting a pen plotter driver to cross hatch using long lines instead of filling each x individually. Likewise, people are still innovating like crazy before the technology is locked down to the point where it’s baby-proofed so much a first grader can work it without prior 1st hand experience, supervision, or even so much as an explanation.

There is fun to be had while it lasts, but there is a learning curve to climb beforehand. Proper diagnostics are key, otherwise I’m blaming everything on old filament.

Final Question

What is the most challenging tool you ever taught yourself to calibrate?

3D Printing: Incremental Improvement

Good Morning from my Robotics Lab! This is Shadow_8472 and today, I am on my 3D printer again for round 2 of printing a model of Twilight Sparkle. Let’s get started!

Preparation

I began with a fresh download into a clean project directory I designated. The “fixed” version from last time simply fused all the little details I wanted to delete/paint on later into one single model. I instead continued work with the unfixed version [1].

Like before, I used Blender to digitally clear out Twilight’s eyelashes and stitch her mouth shut. I really wanted to try printing her mane pieces separately so I could glue them on later, but I can’t Blender well enough to make that happen.

Over in Slic3r, I scaled the model up by half an inch from front to back. This made her feel a lot bigger, but not so big I was in too much danger of running out.

I played with paint on support blockers a bunch, but I found they weren’t as versatile as I would have liked. I found myself working more with the more geometrically themed blocks. Of note, I added one to the tight space between her mane and neck and a cylindrical one between her mane and forehead. As I finalized each block, I made sure to inspect the individual overhang layers to make sure they would bridge properly.

With the bigger model, I had to override the program into using solid infill for those fragile legs. The selection box was the same as the support blocker. I also told it to make Twilight’s unicorn horn solid at the base, even though it would have been fine with her mane intersecting it (another reason not to print head pieces separately).

As one final touch, I moved Twilight off to the side and removed her raft so the scratch in the build plate would only affect the support material.

Printing and Cleanup

Printing went smoothly. I checked in once an hour until she was done. The PVC pipe I’m using to extend the filament rack fell out again, but fortunately it didn’t cause any issues as I observed during a calibration print. This print used most of the rest of my spool of red PLA filament; it’s just starting on the second to last layer. I have a smaller print or two left, but that’s it.

Removal of the support material took about as long as last time – a full day plus a bit. This time, I tried to be more careful about her mane, and it paid off. Twilight did not suffer any ill effects for missing a few supports here and there. I even caught myself laying fingers on fragile bits while trying to get leverage on stuck bits elsewhere before I broke anything.

Despite the model being scaled up a little, cleanup wasn’t much easier overall. The cutters/needle nose pliers couldn’t reach as far between her legs, but I can get both those parts with sandpaper. The mane was as obtuse with me as before, but after a while, I managed to use a repurposed sewing needle and a bit of tie wire to leverage a corner to where I could get in there with the pliers. It felt so good getting that bit out, but I cracked the lock of her mane hanging off to the right. I want to print up some test pieces and practice repair techniques before continuing work on the real one.

Notes for Future Prints

If I make another attempt after this one, I may follow the fixed version’s cue and fuse all disjoint model pieces before exporting from Blender to Slic3r (over a .stl file). My hope is that Slic3r won’t get as confused with intersecting geometries as found in her mane.

In all reality, I should be thankful these prints are cleaning up as well as they are. The proper tool for the job is either a resin 3D printer –which can manage finer details– or an FDM (Fused Deposition Modeling) printer with an extra head dedicated to a dissolvable support material so I can be done with cleanup in minutes instead of hours. For now, the tool I have has a single printhead for a single filament, and that means tricky supports.

But tricky supports can stick. Both Twilight prints had issues with stuck bits under their manes, bellies, and to a lesser extent: their tails. The bottom layer of those respective regions appears to be peeling away with the interface material, so it takes a bit extra force – exactly the thing you don’t want around delicate parts like legs. While I was discussing this on the Sweetie Bot Project Discord server, user Equestria_dynamics suggested “increasing the contact layers between the print and the actual support material [2].”

Side Project

What fun is it to make all sorts of fun stuff if you can’t share it? You’d be surprised how hard that can be without access to a smartphone you’re willing to use (more on that in a future post when I install AOSP). Special thanks to my sister for loaning me her Nikon S3000 digital camera from around the time she got a smartphone. It’s mostly unused, but the charger was missing. I tracked one down and we ordered it up.

This camera is good for beginners and begging brothers. My impression is that it was aimed at people who understand the concept of point and shoot, but prioritize pictures fitting on a card over lossless compression methods. Read: I want .png and spent hours confirming it only does .jpg.

To get the best quality pictures I can of my prints, I’ve decided to get myself a photo booth. For an early prototype, my father laid some large sheets over his workbench and topped that with some parchment paper so the content on the other side wouldn’t show through. Presently, we’re making a second, more permanent version out of a cardboard box with some creative cutting.

Takeaway

As with any piece of software, Slic3r is taking time to learn. Having to learn a whole segment of the workflow all at once makes it take a bit longer, but I look forward to being able to show my stuff off in a more controlled manor than snapshots with random bits of house in the background.

Final Question

Have you ever glued delicate parts back together on a 3D print? What glue worked out for you?

Works Cited

[1] dragonator, “Mane 6 models MLP:FIM,” Thingverse.com, April 09, 2012. [Online]. https://www.thingiverse.com/thing:21076. [Accessed Jan. 17, 2022].

[2] E. dynamics, Sweetie Bot Project. [Discord] #3d-printing, (Jan. 14, 2022).

Installing NUT UPS Driver on Rocky Linux 8

Good Morning from my Robotics Lab! This is Shadow_8472 and today I am installing the Network UPS Tool on my Rocky Linux 8 Button Mash server. Let’s get started!

A Package Exists

In a previous push on my Button Mash server, I talked about getting an Uninterruptible Power Supply (UPS) so ButtonMash could shut itself down in case of a power failure. If memory serves, I also talked about an open source driver called Network UPS Tools (NUT). At the time, I was under the impression it was exclusively available via source code and I would have to compile it to make it work.

I’ve recently suffered no fewer than four power outages since installing the UPS. A couple long ones while everyone in bed would have outlasted the UPS’s endurance had someone not noticed been aware each time to gracefully shut things down manually. I want the process automated.

And so I started the grind. The first thing the installation instructions tell me is to check for a package. Sign me up!

dnf search nut

I got several results, but with such a simple package name, the letters n-u-t turned up many false positives. NUT’s companion packages come with names of the form: ‘nut-*’, so I often filtered with ‘nut-’. My refined searches remained empty.

Installing EPEL and NUT

If the backbone of a distribution is its package manager, repositories would be its ribs. Not every piece of software gets compiled and packaged for every architecture/package manager. I get that. It was a lesson I had to learn last time I played with optimizing MicroCore Linux and why I’m going with Arch if there ever is a next time.

When I learned NUT was widely available in package form, I went looking again on Rocky Linus dnf: still nothing. Debian has a nice package viewer[1], so I looked for something similar for Red Hat distos. I wanted to be sure I wasn’t missing something before concluding the nonexistence of a package for me. One exists, but I’d need to make an account. However, I found something even better for my purposes.

pkgs.org[2] is a website that lists packages organized by several different major distributions. I was quickly able to find NUT in the CentOS 8 section for the Intel CPU architecture, but not anywhere under Rocky Linux.

A closer look after hours of confusion introduced me to the EPEL repository (Extra Packages for Enterprise Linux). Apparently, it’s held in high regard among the Red Hat branch. Many enterprise Linux users consider it almost mandatory to offset the smaller offering by default repositories. I was uneasy about it at first because it showed up for the now depreciated CentOS RHEL downstream, but EPEL is maintained by the Fedora community, which isn’t going anywhere for the foreseeable future: I’m calling it safe to use.

sudo dnf install epel-release
dnf search nut

NUT was then as simple to install as any other program from a repository.

Side Project

Podman pranks again! While testing my Bitwarden login from my laptop, I got myself permanently logged out. I traced the problem back to my Podman container on ButtonMash corrupting during one of those power outages from earlier. I sent a discouraging error off to the search engine and I found my exact issue on the Podman GitHub (see Works Cited) [3]. I wasn’t happy with the explanation, but it was the best one I found: systemd didn’t like an under-privileged user doing things without at least a recent login, so it messed with Vaultwarden’s Podman container. The messed up container had to be forcefully deleted and remade. I also needed to remember to specify https:// when looking for the server via browser. To make sure it doesn’t happen again, I followed a piece of advice found later in the discussion and permitted the login to linger.

Takeaway

I honestly expected this week’s progress to take at least a month. When I first looked into NUT, all I saw was source code ready to download and compile and honestly, I’m having trouble getting excited about mastering the art of compiling other peoples’ code. If there’s a way to install via a compatible repository, I’m all for it.

I am especially thankful for pkgs.org [2]. They helped me reduce my problem to one I’ve at least blindly followed a tutorial for. You typically won’t find the full, non-free version of Chrome on Linux, so when I was setting up Mint for my father, I had to explicitly add a repository.

While NUT may be installed, configuration is not happening this week if I expect to understand my system when I’m done. I blitzed the first expected month of work and only stopped because the next bit is so intimidating. Here’s to a quick understanding within the next month.

Final Question

NUT has proved difficult to locate assistance for, as I haven’t figured out how use their internal system. Do you have any idea where I can find support for when I need it?

Works Cited

[1] Debian, “Packages”Debian, July, 2019,Available: https://packages.debian.org [Accessed: Jan. 10, 2022].

[2] M. Ulianytskyi, “Packages for Linux and Unix”pkgs.org, 2009-2022, Available:https://pkgs.org/ [Accessed: Jan. 10, 2022].

[3] balamuruganravi “rootless podman ERRO[0000] error joining network namespace for container #6800” github.com, Jun 2020. Available:https://github.com/containers/podman/issues/6800 [Accessed: Jan. 10, 2022].

Calibrating my 3D Printer: Overhangs and Supports

Good Morning from my Robotics Lab! This is Shadow_8472 and today I am continuing to work with my 3D printer. I’m covering a lot of ground this week, so let’s get started!

.Gcode Flavor

I left off last week wondering what was with my printer cooling its head when I had already preheated it through firmware. I reached out to various help channels until I randomly speculated that my printer was speaking a slightly different dialect than what PrusaSlic3r was feeding it. A helpful user suggested I switch my .gcode flavor to Marlin (listed as Marlin (legacy) in Slic3r).

I compared outputs from the two flavors after slicing the same object. The two files were similar, but legacy machines like mine –it would seem– do best with some additional information before any custom .gcode a user might want.

In retrospect, I probably should have learned to make my own temperature tower. Running .gcode meant for a larger printer can cause any one from a number of problems. At the same time, I’m glad I printed the tower with raw .gcode or else I might have easily given up.

Calibration Park

Armed with an optimal or near-optimal printing temperature, I set about printing a calibration multi-test [1]. I came back part way through the print and found that a PVC pipe I use to extend the filament holder had fallen off and both the X and Y had been gotten way off (I’m just glad it wasn’t on a more serious print). Additionally, the base was warped something awful. The test was still stuck to the printbed, but it was almost trivial to remove. I figured my bed was too low, which it was, but it took me until I noticed my heated bed turning off after the first layer that I had a setting wrong in Slic3r.

I was able to save my second serious attempt at the test by manually adjusting the temperature from my printer’s touchscreen. It turned out pretty well after that. The scratch in the middle of the bed was obvious, and a lot of the fine details in the lettering describing each test were lost. Otherwise, everything appeared to do OK at the very least. The overhang test was technically still together at the 80 degree inclination, but artifacts were beginning to show up by around 45 degrees. Most importantly: the large artifacts I had when unknowingly printing with wet filament were fixed.

Planning a Complex Print

To date, the most complex print I’ve successfully probably pulled off would have to be my Blinkie Pie case, where I modified a PacMan ghost case so a camera could see out one eye. Aside from a little impossible bridging that quickly evened itself out, that wasn’t a difficult print. But the world of 3D printing is much more diverse than variations on simple shapes.

I decided to try printing a model of unicorn Twilight Sparkle — both for her (percieved) relative simple geometry compared to her friends and so I wouldn’t have to risk her potentially breakable wings as seen across most of the show. I found a model on Thingverse after looking at several different places that wouldn’t let me download without creating an account — free or otherwise [2].

I went back and forth with it between Slic3r and Blender a time or two to refine Twilight’s model. While skimming through the planned layers, I noticed she had a sizable oral cavity. Her tongue and teeth were simple enough to delete, but it took a bit more patience to remove the rest of her mouth and stitch it back together. Somewhere in there I got rid of her eye lashes, which were also separate meshes from her main model as I was sure they would be hardly there to begin with and likely would be damaged while removing support material.

Speaking of support material, I knew from the beginning that I wasn’t getting away without a bunch of it. Twilight’s mane has a number of spots that hang down from layers printed later – let alone her tail as it arches up, backwards, and not quite to the ground. I messed with the automatic settings until I had what looked like a minimal amount of support, but after seeing the results of the overhang test, I put the settings back up. I also ordered up a raft three layers thick to cover up the scratch in the middle of my build plate.

Another concern I had was what Twilight’s center of mass was going to look like. At one point, Slic3r had her tail slotted for mostly solid infill with her head at 15% honeycomb infill. While I was able to find a solution involving analyzing the sliced figure with a Blender plugin, I ended up scaling Twilight up to about four inches as opposed to about three/three and a half – big enough so her tail was also rendered as a shell with infill, but small enough that her legs were solid.

A closer inspection of some supports gave me the distinct impression that Slic3r was being silly. The most complicated part of Twilight’s geometry is her mane, and there were more than a few tiny “overhangs” I figured would be fine being bridged instead of supported. I found some support blocker cubes I could move and scale, but it was clunky and there’s a better system for painting on supports I’ll be looking into next week. I wasn’t the happiest with the results I had, but I printed it anyway.

Cleanup and Repair

Between six and seven hours later, I had a pony standing on my build plate rendered in my recovered red filament. Cleanup started quickly as I cut away large sections where I knew there wasn’t anything, but as I got closer in, needle nose pliers and cutters were getting to be a little too awkward. My father arranged for a poker fashioned from some construction grade tie wire often used for holding re-bar in place while pouring concrete structures. Even then, it was a bit thick to fit in all the needed places. My mother offered a sewing straight pin which was versatile, but bowed more easily.

I quickly became jealous of dual+ head printers that can possibly use a soluble filament for easy support removal. It was a major morale boost when I was finally able to free Twilight’s face. Other tough spots included the arch of her tail, The tight spots between her legs and up across her belly, several tight spots in her mane, and the raft stuck to her hooves. I am very glad I scaled her up as much as I did.

There were a few moments when I wasn’t as careful as I should have been. I broke Twilight’s right back leg below her hock (the ankle-like joint most of the way up her leg) about half way through, and snapped her mane a few times in a couple places. Sections across her belly had to be cut away.

Despite the missing leg, there remains a piece just behind Twilight’s front legs. I had a feeling from the beginning that the supports between her forehead and bangs wouldn’t be coming out and they haven’t. At this point, I’d need to melt a handle to the remaining support material and carefully yank. The toughest holdout is physically trapped between her neck and the bit of her mane hanging to the side. I’ve already chipped the tip of her mane there trying to get it out.

I had already decided that I’d be reslicing and reprinting – I just haven’t yet. However, it doesn’t feel right to leave this Twilight without at least reattaching her leg and doing what we can with her mane. My father and I worked on the remaining bits of raft with a razor stuck to her hooves and used some superglue. The first repair on her mane didn’t go the best, so we’re using some painter’s tape to hold it in place. The leg was more promising, so at least she can stand while she waits. Maybe I’ll come back to her when I have more skill, but for now, this model has served as a learning experience so my next print should go better.

Side Project

I accidentally closed my main FireFox window. Normally that’s annoying, but since there was an update cued, I managed to destroy it completely in my attempts to recover it. I checked around online and learned a little about how Firefox stores saved sessions and I found a backup from not quite two weeks ago. It’s not perfect, but I’ll take 96% restoration over nothing!

Takeaway

3D printing is an art form, even if you’re printing other people’s .stl files. There are many factors to adjust to keep your printer in top condition. Slicing programs require knowledge about your printer’s tolerances to use effectively. Even if it prints correctly, you may want to sand, prime, and paint it.

Final Question

Have you ever set aside a work-in-progress for when you’re better equipped to finish it?

Works Cited

[1] majda 107, “*MINI* All In One 3D printer test,” Thingverse.com, Feb. 25, 2018. [Online]. Available: https://www.thingiverse.com/thing:2806295. [Accessed Jan. 3, 2022].

[2] dragonator, “Mane 6 models MLP:FIM,” Thingverse.com, April 09, 2012. [Online]. https://www.thingiverse.com/thing:21076. [Accessed Jan. 3, 2022].

[2*] David, “Mane 6 models MLP:FIM – Fixed,” Thingverse.com, June 19, 2012. [Online]. Available: https://www.thingiverse.com/thing:25282. [Accessed Jan. 3, 2022].

* The second [2] hosts the same models but “fixed” variants. I don’t know for sure which version I used, but I’m slightly more sure than not that I used the 21076 models.

Calibrating My 3D Printer: Temperature Tower

Good Morning from my Robotics Lab! This is Shadow_8472, and today I am recalibrating my 3D printer after leaving things to rot for a year or so. Let’s get started!

Printer Alignment

The first step in getting my printer operational again was to start from the beginning: alignment. My father got out the bubble level and I folded some large papers to get the plethora of degrees of freedom all lined up.

Tuning continued with the built-in, poorly communicated bed leveling tool. The printhead traveled to each corner and I slipped a calibration sheet under it and adjusted the corners such that it could slide, but not freely. When the right Z-axis was found to be misaligned, my father reached in and turned it a bit. I was sure it would have been frozen, but we were able to level the horizontal bar.

Temperature Tower

One well-used calibration test is the temperature tower. Regular printers use ink/toner (which original manufacturers go to great lengths to regulate) and paper (which is so standardized, it’s rare to see messed up). 3D printer filament is at least as varied and presents itself as universally interchangeable as long as it fits and the printer can melt it. As a result of differences between specific models –and even specific printers/printing environments– filament and printer manufacturers can only make broad guesses as to what the best setting will be for your specific printer.

That is where the temperature tower comes in. Instead of printing the same test shape over and over again on different jobs, they can be stacked one on top of the next and an instruction to change printhead temperature for each “floor” can be inserted.

From what I’ve gathered, temperature towers are normally assembled manually in a slicer for the exact printer, but I decided to try one straight from gcode (that went hot to cold; I didn’t want the filament freezing on the bottom and making a mess trying to print atop thin air). I didn’t first make sure the printer would be able to understand it; I didn’t make sure it would fit within my printer’s volume. I just loaded it up and hit print. Surprisingly, it worked. I had adjusted my bed a bit high and the first layer was smooshed (making it very difficult to remove), but I’m officially printing again.

I used my red filament and the tower that came out demonstrated its ability to bridge, overhang, and produce fine points. Each floor is numbered after the temperature it was printed at. The whole range was fairly good, but there was less stringing higher up, where the printhead was cooler. All other tests performed well at most temperatures.

Side Project

This month’s effort to reward award goes to getting my father printing on Debian. I sat down with him to get it working and we installed the CUPS universal printer driver and it worked with no additional fiddling.

Takeaway

Printer calibration is an important step to understand and use when needed – 2D or 3D. 3D printing is a much younger technology with a literal extra dimension for things to go wrong; it requires a greater degree of technical mindedness to keep in working order to the point where you at least need to be or know a hobbyist to have continued access to this amazing consumer level technology.

Final Question

I had more planned in terms of printer calibration, but it looks like that will need to wait for next week as I figure out the thought process for PrusaSlicer. It looks like they have some sort of preheat function in the .gcode header, but in practice, I already preheat my bed and hot end before selecting a file to print. In my workflow, this programming blurb ends up telling things to cool. Any ideas where the setting is to control it?

Baking Old Filament May Reduce Water Content

Good Morning from my Robotics Lab! This is Shadow_8472 and today, I am getting back into 3D printing, but I doubt it’s going to be pretty. Let’s get started!

Inspection of Equipment and Materials

My 3D printer is in used condition. The print bed is scratched and one of the two Z-axis rods got bent at around the same time. My filaments are old and brittle. I can’t even use the slicer it came with anymore because it’s both outdated and made exclusively for Windows. I’d rather just start over with a standard one designed to be user-serviceable. But that’s not an option at the moment.

I should learn about what I already have and work from there. There’s not much I can do about the scratch unless the original replacement pad shows up or unless I’m willing to fill it in/cover it up somehow. As much as I’d like to replace the Z-axis rod, a suitable replacement proved elusive for reasons discussed above; besides, the tweak doesn’t look that bad – the top of the rod only moves back and forth a little when the print print head is moving vertically and is down low. Alternate slicers exist. Long story short, I may as well give this printer one last chance before giving up on it completely.

Filament Reclamation

I have two PLA filaments I’m considering today: my original, red one and an opaque white one I got later and hardly ever used. Red used to just work. White felt different from its day 1 and never printed nicely. After a couple years of absorbing moisture from the air, they’re both as stiff as spaghetti. I even bent one piece of White until its middle piece snapped out from between the ends.

Besides causing stiffening, absorbed water evaporates when exposed to heat, causing problems such as the ones I experienced last time I tried printing. Water from within the filament forms steam, and it’s the steam that causes mysterious jams that seemingly go away come time for diagnostics.

A number of places have listed methods for drying out filament: bake it. Just be aware of the material’s glass transition phase where it goes from resembling a wire to resembling a more squishy rubber. The whole spool will fuse and you’re reclamation efforts will be for none. For PLA, that transition is somewhere around 140 degrees Fahrenheit.

To be safe, I elected to aim for 100-120 degrees F. My stove at home doesn’t hold its temperature that low. We put a bowel of water in overnight with a rising loaf of bread and it tested way cooler than needed. We tried our old toaster oven and tested at 125 F – close, but as I only had one shot to fix what I have, I didn’t want to risk it.

Specialized devices exist to dry out filaments. I was able to approximate one by modifying a food dehydrator operating at 125 F. My final design involved a rheostat from my father’s soldering iron to adjust the otherwise fixed temperature, some Duplos (a Lego-like block aimed at younger ages we’ve had laying around since I was little) to hold up the lid, and a tall, plastic film from my mother’s cake supplies to extend the tray. Without a thermostat, I monitored the temperature myself with a digital cooking thermometer we got for my sister’s bread making.

Both Red and White were dried overnight. White still felt stiff, so I left it in for several hours more. The temperature was difficult to keep constant. I left the contraption in a small room, and the room warms up and I have to turn the power down. If I had known how to easily, I would have built a thermostat capable of operating in those ranges. In retrospect, it would have been better to just leave it in the toaster oven on warm and not worry about it.

Side Project

I was able to get Vaultwarden running by forwarding the incoming traffic to the container’s port 80 instead of 443. However, this is still sub-optimal. I have my ability to manage passwords between devices back, and that feels sooo good after months of downtime, but I’ve been strongly encouraged to use a reverse proxy. This week, I looked into NGINX, and I believe that will be a focus some time in the coming weeks.

Takeaway

The path to my improvised filament dehydrator was a little longer than going right there. My early approach was At first, I figured I’d want to build something with a couple appliance bulbs like what the oven uses. The food dehydrator I eventually used as a base only has an on-off switch, so to lower its steady state temperature, I used some short Duplo stilts to raise a lower level to let ambient air in. I kept them for my production run, though if I have to run it again in the future, I’ll leave the sides closed and turn the power down lower on the rheostat.

Final Question

What would you tell someone who is ready to know more about 3D printing than: use slicer, level bed, load filament, press start?

Self-Signed Vaultwarden Breakdown

Good Morning from my Robotics Lab! This is Shadow_8472 and today, I am going over creating a self-signed certificate for my Vaultwarden. Let’s get started!

I’ve spent a long time trying to figure out proper HTTPS, but slapping on a solution and going without understanding the underlying workings doesn’t feel right. I don’t even have that. As long as I learn something each attempt, that should be good enough. I’ll be following the tutorial from Vaultwarden [1] with commentary from censiClick’s video [2]. My commentary here will be largely guesswork based off those and associated manual pages [that I have no idea how to properly cite but are available by typing man <command> in most Linux terminals].
https://github.com/dani-garcia/vaultwarden/wiki/Private-CA-and-self-signed-certs-that-work-with-Chrome
https://www.youtube.com/watch?v=eCJA1F72izc

Step 1: Generate Key

openssl genpkey -algorithm RSA -aes128 -out private-ca.key -outform PEM -pkeyopt rsa_keygen_bits:2048
openssl genpkey

This base command generates a private key for OpenSSL.

-algorithm RSA -aes128

RSA and aes128 are encryption algorithms for generating the key. RSA is a public/private key system and aes is a powerful single-key algorithm. Here, they can be seen working together to create a powerful encryption without having to find a relatively private back alley to exchange keys.

-out private-ca.key -outform PEM

These flags specify where to save the key after it’s generated and what format to save it as.

-pkeyopt rsa_keygen_bits:2048

(Private KEY OPTion) This flag lets you manage options for key generator algorithms, in this case: using the 2048 version of RSA.

Step 2: Generate Certificate

openssl req -x509 -new -nodes -sha256 -days 3650 -key private-ca.key -out self-signed-ca-cert.crt
openssl req

(REQuest) This command obtains certificates. In this case, it’s generating one itself, but as the name implies, it’s aimed more at requesting them from an authority.

-x509 -new -nodes -sha256 -days 3650

-x509 specifies that this root certificate will be self-signed. The -days flag will set it to expire in ten years minus leap days. The -new flag has the user fill in some additional information for the certificate, -nodes leaves private keys unencrypted, and -sha256 is a hash function.

-key private-ca.key -out self-signed-ca-cert.crt

These final flags are I/O. key loads the key from the previous command, out names the certificate.

Step Three: Preparing to Sign

openssl genpkey -algorithm RSA -out bitwarden.key -outform PEM -pkeyopt rsa_keygen_bits:2048
openssl req -new -key bitwarden.key -out bitwarden.csr

These commands are similar to before but for Bitwarden. They lack components needed to make the root certificate authority. There’s also some sort of special configuration file I’m not looking to break down, but is around under Vaultwarden’s GitHub [1].

Step Four: Signing the Certificate

openssl x509 -req -in bitwarden.csr -CA self-signed-ca-cert.crt -CAkey private-ca.key -CAcreateserial -out bitwarden.crt -days 365 -sha256 -extfile bitwarden.ext

Finally, it’s time to bring everything together to sign the certificate. Many of these flags are familiar from previous commands. Reading through it, it feels like the last stop to make sure all your papers are in order. Some operating systems are rightfully cautious about certificates signed for an overly lengthy time.

From here, it’s a matter of starting the Vaultwarden container with its new certificate and assuring whichever browsers you’re using that you trust the new certificate authority [2].

Practice to Practical

I’m glad I took the time to study this a little more closely than blindly following instructions this time. When making using openssl req, I was able to confidently regress by deleting a few files so I could give a different common name to the root CA and Vaultwarden’s certificates respectively.

The next challenge was successfully launching the Podman container. Following along with the censiCLICK tutorial, I had three new flags relative to last time I was working with Podman. One was to restart the container unless stopped (no elaboration provided).

The second flag tripped me up. I confused a pair of default ssl certificates for the of self-signed ones required later on, bitwarden.crt and bitwarden.key, created in earlier steps. I copied those two files into their own Podman-mountable directory. Once again, I added the :Z flag to tell SELinux it’s OK.

-e ROCKET_TLS='{certs="/ssl/bitwarden.crt",key="/ssl/bitwarden.key"}'

The final flag sets an environment variable as the container finishes starting. This particular one is configured to tell Vaultwarden where the files are to encrypt HTTPS. If they aren’t there –as I found out while I was still sorting the system certificates– something inside the container shuts it down; it was not a fun combo with the restart unless manually stopped flag as I had trouble removing the container so I could create a new for my next attempt. I knew I was done when podman ps returned a container running for longer than a second or two…

…or so I thought. I went to import my root certificate authority to Firefox, and I still can’t connect even when specifying https://<ButtonMashIP>:44300.

Long Story Short:

podman run -d --name vaultwarden --restart unless-stopped -v /home/vaultwardenUsr/<path/to/vw-data>/:/data/:Z -v /home/vaultwardenUsr/<path/to/private/certs>/:/ssl/:Z -e ROCKET_TLS='{certs="/ssl/bitwarden.crt",key="/ssl/bitwarden.key"}' -p 44300:443 vaultwarden/server:latest
Edit Jan. 6 2022: Vaultwarden listens on port 80, so I'm using -p 44300:80 now. And when you go to verify in a browser, be sure to use https:// or you get "The connection was reset".

This is my current command to generate a Vaultwarden container with Podman and no root privileges. In the end, the only major differences with Docker containers are the paths to mount the volumes Vaultwarden needs from the host machine and the :Z flags for SELinux. Currently, I’m not able to establish a secure connection. I have a help request out, and will edit if I get an update later today, otherwise, I already know what next week’s side project will be.

Side Project

Thursday held a startling surprise as a new zero-day exploit appeared affecting Minecraft, among other things. I must have found out within a few hours of it going public. After doing my research and checking sources, I concluded it was real and with the help of tech support, I was on a patched version of Paper within an hour or so of finding out.

Log4Shell (as this one has come to be called) is scary both because an attacker can take full control of a vulnerable computer and how common vulnerabilities are. On the other hand, once such exploits go public, things get updated pretty fast.

Here is the best article I’ve seen as of about ten hours of the exploit going public: https://www.lunasec.io/docs/blog/log4j-zero-day/

The moral of this story is to keep your software up to date, especially if you see any big stories about computer security.

Takeaway

All the HTTPS literature I found appears to be aimed at the curious pedestrian or the seasoned system administrator. This made it very difficult to be someone in an in-between level of understanding. On a personal note, I learned that pressing the / key while in a man page lets me search the document, a feature I really wished I knew about two years ago.

One important critique I’d offer the censiCLICK video is that the tutorial was dumped straight into the home directory and no effort was given to change default usernames/passwords, which I would consider very important for a monolithic tutorial.

Final Question

Have you ever had a project fight you to the bitter end?

Works Cited

[1] “Private CA and self signed certs that work with Chrome”github.com, [Online]. Available:https://github.com/dani-garcia/vaultwarden/wiki/Private-CA-and-self-signed-certs-that-work-with-Chrome. [accessed Dec. 13, 2021].

[2] censiCLICK, “Full Guide to Self-hosting Password Manager Bitwarden on Raspberry Pi,” on YouTube, Nov 15, 2020. [Online video]. Available: https://www.youtube.com/watch?v=eCJA1F72izc. [Accessed Dec. 13, 2021].