Linux Deep Dive Part 1: Day 1

Good morning from my Robotics Lab! This is Shadow_8472, and today, I am covering a giant step I’m taking into Linux. Let’s get started!

I’ve known for a while that I would be switching to using Linux on my laptop as part of my program to keep it shambling into the future. The final straw for my laptop was a painfully slow Minecraft experience in Windows. It was giving me between 8 and 15 frames per second on average, but the drops to 0 fps were unacceptable. I started shopping.

Some months ago, I installed Kali on an external drive and ran it live. I had some reservations about how you are logged in as root by default, and even watched a video by Cyber Weapons Lab about things you’d want to do when you install Kali. A more recent major update changed some things to be more friendly towards people looking for a new main OS, but a developer blog explicitly said installation on a production computer is “not recommended.”

I spent a few days considering what distro to go with. There are a number of distro pickers out there that ask you different questions like, “How old is the hardware you want to use?” or, “Do you care if you use closed source drivers?” I am after stability and access to community support. Besides, many knowledgeable Linux experts say that distribution is ultimately irrelevant. YouTuber Chris Titus Tech considers each distribution “a starting point.” While there are fundamental differences between major distributions, you can customize pretty much everything with relative ease once you know what you’re doing.

I only have an idea of what I’m doing. I don’t need bleeding edge for anything I’m doing, nor do I want to have an otherwise stable machine develop problems on me. Debian has a reputation for rock solid stability and enough of a community out there for when issues do develop.

Chris Titus Tech may have had some influence on my decision. He has a series of challenge videos where he covers a year of using Debian on his production machine. One of his warnings is that it takes a week to set everything up before it’s fully stable. I would add the caveat that that only applies after you know what you’re doing. Again, I only have an idea of what I’m doing. As such, I am going into this expecting a month or more. Chris Titus Tech provided a much needed boost here with a video about installing Debian, including how to navigate the list of Debian downloads for an easier ISO to work with. I highly recommend you look it up if you intend to install Debian. LINK.

Considering my aging computer and desire for an easier transition, I chose the MATE desktop environment for being relatively lightweight, yet customizable and went with an ISO that includes “non-free” software, like freely available drivers owned by different companies, for greater compatibility.

I had a few false starts when creating my install media. In my travels, I came across a tool called YUMI (Your Universal Multiboot Installer) LINK. It looks like a good tool to build a replacement for your army of install USB’s or CD’s, but I didn’t get far trying to install Debian on there normally. It’s worth looking into later, though.

If you ever decide to judge a distro by its live session, don’t. Running Debian live from USB is about as sluggish as the Windows OS I’m moving out of. It got so bad that I spent a while asking if an internal HDD or an external SSD on a USB 3 is faster. I couldn’t bring myself to install over Windows when I might be missing some paid license file or something, and the notion of internal partitioning made me nervous. I benchmarked my candidate drives and found the SSD was between two and three times faster than my internal HDD. I installed for performance.

Installation was nerve-wracking. If only I had studied the video I had already had found where someone installed that exact same operating system, I would have known I when the settings were locked in and ready to destroy whatever partition they landed on. I would have known the hard drive selection was almost at the end, and I would have known not to say no when it offered to install GRUB to my master boot record.

I adjusted the BIOS to prefer external USB drives over internal hard disks. Boot continued to a simplistic screen and stayed there indefinitely. I looked into making a Super GRUB disk, but I stopped after two attempts and went with the nuke option and reinstalled, this time following the instructions.

For the record, by the time I hit the ugly mug of the ISO’s login screen, I had a thumb drive for install media and an external SSD with Debian on it.

The following days were a different kind of challenge. The MATE desktop offers enough customizability to almost put Windows to shame. The details would fill up their own post, and there already enough tutorials out there. The only word you need for massively improved searches is panels. You start with one at the top and one at the bottom, but I moved mine around to make like a Start bar across two screens. I’m still working on it, though.

Minecraft was a little tricky to install. I grabbed the .deb file and it wanted a couple dependencies before installing, programs most distros normally come with. Minecraft wanted me to log in again, even after mounting my HDD and copying over my .minecraft folder/directory. Whatever comes next, the improvement in performance is worth it. At the end of my first day on Debian, I was managing between 25 and 40 fps during normal play.

Overall, I think Debian will work out for me in the end. I still have to finish patching it together, but my previous work with Ubuntu and especially Micro Core has prepared me for this overall challenge.

Final Question: What projects have you embarked on that naturally feel like direct sequels to earlier projects?

Minecraft Server Optimization Part 1: G1GC

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am working on my Minecraft server. Let’s get started!

A few months back, my sister put together a server idea she called Creepers ‘n’ Cream. It runs on Vanilla Minecraft, but has a few datapacks that offer us little gameplay changes, like mob and player heads, Elytra drop on a rematch with the dragon, and a tool for rotating some blocks in place. All I know is that she got the idea from Hermitcraft, a well known Minecraft server for YouTubers and streamers. We don’t run all of their packs.

I covered my process to get the server machine ready to host Creepers. it provided me with about six weeks of content, and in the end, I accepted MineOS as a much easier alternative to a practically custom-built Linux distro.

Once I got MineOS behaving with 16 GB of RAM open to it, I set it aside for a while. At one point, it had been running more or less stably for about two weeks without a reset when a couple players showed up unannounced. We had them contained in a house in adventure mode, so they were more or less contained. The server crashed unceremonially by a game tick (normally 1/20 of a second) lasting for a full minute. After a peek into the accounts’ history, it looked like they were hackers.

I don’t remember the second big crash all that well, but a couple weeks ago, it crashed the same way for a third time. I started doing some research, and found several places talking about garbage collection.

For the non-programmer, there’s a part of a program’s memory called the heap. If the heap ever overflows, the program crashes. As the program runs, objects are put into the heap when needed, and when they aren’t useful anymore, the program marks them as garbage. Every so often, a garbage collector comes by and tidies the heap up so it has more room for new objects. This takes time away from the program you want to be running. By default, Java collects all the garbage when the heap is full. Unfortunately for Minecraft, this causes a noticeable lag spike when garbage collection (GC) happens, and the bigger the heap, the longer it has to wait.

A number of posts I found in my research sung the praises of G1GC (Generation 1 Garbage Collection) for use with Minecraft. From what I gathered, G1GC focuses on making sure unused objects don’t clutter your heap for any longer than necessary. By having the collector come by frequently, it can collect in several short bursts too fast to notice at the trade off of taking a little longer overall.

Somewhere, I read a G1GC guide or two that suggested allocating all your RAM to Java when you start the program. Bad advice for default GC. The server was running a lot worse for a week before I reigned the minimum from 15 GB back to 4 GB.

Farther research into this theory led me to a programming Discord. Someone there informed me I almost certainly had a memory leak. On a trip to Third Workshop, I learned that even though two or more programs may be free from memory leaks their collaboration may introduce them.

I eventually switched over to basic G1GC. Where default GC would require daily restarts to remain in peak performance, G1GC kept the server stable for three days until planned maintenance took it offline.

In conclusion, I recommend all Minecraft server operators consider trying G1GC.

Final Question: Have you ever broke something by following poorly understood advice?

Minecraft Server Optimization Part 0: A brief history

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am turning my attention back to the Minecraft server I’m trying to hold together. Let’s get started!

Quick Recap: I delved deep into MicroCore Linux, learned a ton about Linux’s underbelly, then moved on to MineOS to host my server on a computer I’ve named ButtonMash.

I have run Minecraft server software for years — almost as long as I’ve been playing Minecraft. Ever since I saw the Last Airbender plugin for Bukkit back in 1.6. All you had to do back then was download the Bukkit server jar, put your plugins in the right folder, and copy some text in a batch file you run. If you want to invite friends over for a visit, you need to open a port on the router, or ask your admin to do so.

Depending on the plugin or plugins, configuration could be a challenge. I already knew a thing or two about in-game command lines from playing a Sonic fan game I played previously, so it wasn’t that new of a concept at the time.

My entry-level skill set for Minecraft servers was rounded out when I learned to update. Modded servers need time to update after the official release, so I learned how to fix my launcher settings to the correct version early on. I learned how to edit the startup file so it actually works, and that was enough to get me going for a while.

Even back then, knowing what went into making a simple wold made me appreciate how more elaborate servers were set up. I spent a while on someone else’s server, where things didn’t go completely smoothly. There was a childish griefer who possibly had his real name for his account, and an overagressive profanity filter was blocking perfectly innocent words that come up on a daily basis both in-game and on a university campus.

A world or two and a couple family members with accounts later, I furthered my craft some more. I remember running a family server on quad witch hut seed in a then-new amplified terrain world. We dropped the Airbender plugin for this one over an infestation of cactus blocks spawning at the same spot in every chunk just above sea level. We kept the seed, but when an update expanded witch huts’ bounding box, I got in there and manually updated the NBT data on our old huts.

At some point, I got my father playing as well. One family server I think he was on, I learned a painful lesson about backing up. We had a nice, little cove we were all building in. I made a note to backup the whole server in the morning. Someone found our IP in the night. He followed our nether tunnel from spawn to our cove, then raided our stash of gunpowder and sand. The damage from his TNT spree was too much to bounce back from, even with creative mode to speed repairs. The next server, we started using spectator mode to contain new players until an OP can let them out.

Another tool I learned as a more journeyman server sysadmin was Spigot. After Bukkit was shut down, Spigot became the go-to unofficial server provider. The only catch: You needed to follow some more dark, spooky instructions to get your .jar file by compiling it. The hard part is setting it up the first time. There are a lot of steps, and a brand new server operator won’t know if anything is working until they get their working .jar file out the other end. Updating? Good luck remembering where to start in that textbook of an instruction list, because most of them only need to happen once!

This server is getting me to push my Minecraft server sysadmin skills to the next level. Somewhere in my history, I learned how to allocate more RAM to improve server performance, but with more friends frequenting than just immediate family members, I want to make this experience the best I can offer. One of the biggest possible improvements a sysadmin can do is to leave the host machine alone. At that point, you need to start thinking about hardware and operating system, and up to this point, it should be fairly easy for an aspiring sysadmin to grow their trade without crossing their skills over with related fields. Tutorials abound for focused subjects, and one can look up a subject and gain knowledge. Not so, for me anymore.

It feels like I’m crossing some kind of invisible line — or a spread out boundary — where I have been following the footsteps of well-known trails so far, but I have come to a path less followed. People can only write tutorials about their experiences, and as you advance in a field of study, you pass up many of the people you’ve learned from.

While I am not blazing entirely new trails here, I am feeling a little starved for variety of people to choose instruction from. My only guess is that most people who make it this far have either moved on to other pursuits, or are tending their own servers, some of which are monetized through dues or donations. All I want right now is to run my server as smoothly as possible, and I’m going to need to learn a lot more to succeed.

Final Question: What are some stories you’ve gotten over the years while honing your trade?

Family Photo Chest Part 3: Tools of the Trade

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am taking all my progress so far and discarding it. A lot has happened, yet not much at all. Let’s get started!

The past several weeks have been covered by me getting so far ahead on my Minecraft server, now called Button Mash. I managed to maintain a backlog of completed posts, but for reasons I will get into, I’ve run out, so here I am, “live” again.

This project has undergone a major overhaul in concept. Instead of a ready built solution, I will be facing material in a class I was unable to complete due to incompatibilities with the physical classroom environment; I will be building my site from scratch.

So far, it doesn’t look like it will be as bad as I thought it would be at first. I am going through the Flask Megatutorial by Miguel Grinburg [Link to first lesson]. As of this writing, I am on part 4 of 23. Yeah, I’m going to be at this for a while as I build up my skill set. Unfortunately, I doubt anyone would have fun reading half a dozen blog posts about following tutorials week after week, and I would get bored trying to keep them interesting. So, without much else I can do to keep things interesting, I think this project will be more of a monthly feature until I finish the tutorial. Don’t worry, there will be plenty of other aspects of the project to cover.

My main focus this week is covering the tutorial. I really do need to take it slowly, one lesson at a time until I finish the little “Microblog” project being built and I probably won’t ever deploy anywhere. The process of copying everything reminds me of when I learned Lua. One of the best ways to learn a language is to transcribe a complex, known working program.

The tutorial assumes you are using the command line, but I am using the Pro version of Pycharm. Incidentally, whenever the tutorial gives me step by step instructions for working with the command line, I need to stop and evaluate it for the IDE (Integrated Development Environment).

One of my earliest problems involved trying to get Microblog to work with Flask. That task was trivial, as there’s an option for it in the new project window.

Another, more difficult task was getting Microblog to run when I went to test it for one of the first times. It had two hard-coded URL’s to use, but only one was in seemingly in use. I ended up deleting a default “Hello World” file that was giving the false success. With the decoy out of the way, everything stopped working. The proper files under development were moved to where they actually belonged.

One of the things I did to make it work was a mistake. I don’t know why it worked or why it broke, but whatever I did, I addressed it properly later on, and only just recently cleaned up the mess I made when trying to revert a very early change.

All of my stubborn problems so far have been with the terminal/API differences. At one point, I misunderstood how things were supposed to be arranged. At another, I was unable to read the filesystem correctly, so I actually moved a few files where they should have been. Naturally, Microblog lost track of where they were.

Final Question: What is your favorite or most effective way to learn a programming language?