Notes: Linux Containers

October 28th, 2017

Linux Containers are “the new hotness”. If there’s a feature Ubuntu has over other distros, its containers built-in. LXD is the modern tool used for containers. It can be installed elsewhere, but that’s not how we roll here.

LXD containers are not VM’s, but are designed to work exactly like them. The key difference is they are fully native, and they access to hardware directly (well networking aside). You can even grant access to a GPU. Containers are a very flexible tool for your everyday Linux use.

Ubuntu 16.04 ships with LXD 2.0, but for some of the advanced features, you’re going to want the latest.

Working with containers is A LOT like working with vagrant boxes.


It’s also worth noting that while LXD only runs on Linux, the client (lxc) can be run on other OS’s including Windows and Mac. What this lets you do is set up remote connections to LXD containers. I’m not going to cover remotes here, but infrastructurally speaking it can be used from other platforms (even just other Linux machines).

Disabling IPv6


You can optionally disable IPv6 support in LXD.

Where lxdbr0 is the ldx-br0 bridge created during setup.

Frankly though, this doesn’t change much. I thought it did more, but the containers themselves are still assuming an IPv6 IPs, just you can’t see them via lxc list anymore.


Modern Kernels on LTS Ubuntu

Starting with Ubuntu 16.04 LTS, you are able to make your Ubuntu install subscribe to the latest changes to the Linux kernel. There are 3 channels you can subscribe to:

  • GA-16.04 (General Availability)
  • HWE-16.04 (Hardware Enablement)
  • HWE-16.04-Edge (Cutting Edge Hardware Enablement)

By default Ubuntu puts you on the GA track, meaning in Ubuntu 16.04’s case, you’re getting Kernel 4.4.x. Switching to HWE, you get a current Kernel. At the time of this writing, that’s 4.10.x.

HWE channels are good up until the next major LTS release of Ubuntu. Then you effectively get put on the GA track of the now current LTS release (i.e. 18.04 starting April 2018). It is then expected you’ll upgrade to the new LTS release, where you can begin again, switching to the next HWE series.

More details:

How to install HWE:

Then reboot to apply the change.

I’m not 100% sure how necessary this is, but I was under the impression that I read something that called for newer that 4.4.x kernel. Who knows. I’ll make a note here if I find it again.

Canonical also offers a live Kernel patching service.

Notable because rebooting is not required, but beyond 3 machines you need to start paying for a support plan. Also (and this is key), the livepatching services is limited to GA releases. Yes, no HWE kernels via livepatch.

Linux Network Interfaces

This is a key file on Ubuntu. It’s not even specific to LXD, but Linux in general. To create advanced Linux Networking configurations, from bridges to VLANs, you do it here.

A default Ubuntu Server install will give you a relatively simple configuration. The ever important loopback interface (lo), and a list of ethernet adapters.

WiFi and some specialty services (VMs) are handled by other applications. Interestingly, my Ubuntu Desktop machine’s interfaces file is far more bare.

It looks like in Desktop Ubuntu, another service is being run to support plug-and-play networking.

Read the rest of this entry »

Notes: Advanced Networking (overview)

October 18th, 2017

So thanks to … reasons, I recently had to rework my internal network. To do it, I had to order some new hardware, and learn a bunch new things about networking.

Read the rest of this entry »

Chaotic Git Merging Notes

September 26th, 2017

I recently had a situation where a pair of devs were working on some code, and shared that code between them. I unfortunately wasn’t around to act as an intermediary and merge in to mainline for them. This resulted in 3 separate Push Requests with a number of conflicting changes. Add to that I started merging one set of changes, making my own changes, only to later realize there was all this overlap, so I’d effectively turned this in to a 4-way merge conflict. Oops!

To make this more manageable, I removed my conflict from the picture. To make my changes properly, I need to see the final result of the 3 Push Requests merged in to one. So I created a new Uber Push Request that combined (and fixed) the conflicts between the 3.

To get there, I had to learn more about GIT. 🙂

Read the rest of this entry »

Notes: Linux video-to-giffing

June 30th, 2017

– conversion:
– monitor:
– remove every-other:

Create a folder, and move the video file in to the folder.

At this point you have files. Viewing the folder should let you see the thumbnails. You can pre and post delete any files you grabbed by accident.

If the images come from an animation, you might want to delete every-other-file.

Next use ImageMagick to build the GIF.

I added -monitor myself to see what was happening. In my case it was freezing, hence the need to remove excess frames.

The original article then recommends using ImageMagick again for optimizing, but my file was too big.

Alternatively, gifsicle.

Notes: Advanced OBS Stream Config

June 23rd, 2017

OBS Studio ships with a bunch of audio plugins (Gate, Compressor). On Windows you can use VST Plugins too.

Like most DAW’s, the VSTs used must match the Architecture (i.e. 32bit vs 64bit).

A good set of plugins for this are these VSTs from the developer of Reaper. They are available in both 32bit and 64bit.

Configuring decent Audio

I’m using a 3-stage setup.

  • ReaFir (FFT)
  • ReaEQ (EQ)
  • ReaComp (Compressor)

ReaFir can be used to capture the noise profile of the room.

Simply select the SUBTRACT mode, and click the checkbox beside it to toggle capture mode. Also, you may want to up the FFT size for better fidelity (at the cost of more CPU).

You should do this any time your noise conditions change. i.e. you turn on a fan or such.

ReaEQ can be used to tweak the dynamics, remove muddyness from audio.

My current setup is a 5 part EQ.

  • High Pass: 50 Hz, 0 dB gain, 2 oct – Reducing the sound of thumps from tapping mic
  • Band: 80 Hz, 5 dB gain, 2 oct – Giving my voice more of a bassy boom (~100 Hz)
  • Band: 230 Hz, -3 dB gain, 1 oct – (theoretically) removing the mud (~300 Hz)
  • Band: 4000 Hz, 2 dB gain, 1 oct – (theoretically) raising my S, TH, F accents for more clarity
  • Low Pass: 21000 Hz, 0 dB gain, 2 oct – Something in my room is resonating at ~20k Hz, so it’s to hide that

ReaComp is the compressor.

The realtime graphs are extremely useful here (since they *cough* actually have numbers).

  • Drop the Threshold slider to where you want the compressor to kick-in. Depending on your goals, this may only be once the audio goes loud. Alternatively you can watch the level for when any talking (even quite talking) kicks in, and adjust accordingly. I’m currently at -44.0 dB.
  • Pre-comp: 5 ms – Seems to stop some of the spikes I was causing.
  • Attack/Release: 3 ms/100 ms (default)
  • Ratio: 4:1 – I tried much higher values (32), but if you can have a lower ratio compressor,
    the sound quality is nicer.
  • Knee: 8 dB – Typically when the volume hits the threshold, it is immediately divided by the Ratio. With a Knee, the ratio divisor is smoothly interpolated until it reaches the knee
  • Output Wet: +22 dB – My mic is set rather quiet. Yes I could tweak it.

The microphone is on an arm stand now, placed 6+ inches from my face, with the sock-top roughly at the same level as the bottom of my nose.

Audio Volumes

The above configuration puts my mic volume around -12 dB to -6 dB at 100%. Game audio needs to be adjusted accordingly.

Games with Chiptune music should be about 20% volume (-14 dB). i.e. Shovel Knight, Creepy Castle.

Games with more normal music should be between 30% (-10.5 dB) and 40% (-8 dB). Freedom Planet was a touch too loud at 40%, so I’d suggest 35% (-9.1 dB).

Games with pre-balanced Music and Sound FX might need more volume. Monster Hunter internally defaults to 80% Music Volume, and 100% SFX volume. I found playing with an OBS volume of 45% (-6.9 dB) worked fine.

Routing Windows Audio

Unless specifically supported, applications route their audio to the current Default audio interface. The default can be changed to any attached audio device, or with the help of 3rd party software: to a virtual device.

This can be done with software like Virtual Audio Cable. The software is shareware.

A free alternative that gives you 1 virtual device is VB-Audio.

You can then use Audio Router to route the audio from an application to specific audio interfaces.

As an example, on my setup my “LG TV” is my main audio output (Optical). Devices can be routed to either the default, or 1 or more specific devices. For example, to both capture and listen to game audio, I have to make a route to the “LG TV” (not the Default), and to the virtual device.

Last Minute VPN Notes

June 2nd, 2017

Just a short one. This is an excellent article on how to get OpenVPN running on Ubuntu 16, and how to utilize it on a variety of OS’s.

This article is simpler, conversely doesn’t explain what’s going on as well. Notably though, as it tells you how to get the VPN working on an OpenVZ VPS.

Though as of this writing I haven’t been able to get this to route traffic correctly.

EDIT: Okay, I figured it out.

It seems the iptables aren’t persistent across reboots. This line:

Is very important.

You can check the status of the iptables as follows.

Here is a recommended way to persist iptables:

Unfortunately BuyVM OpenVZ Ubuntu installs are misconfigured, so neither package will install.

EDIT2: looks like it was a DNS failure.

After doing that, I was able to successfully install the iptables-persistent package.