Skip to content

Instantly share code, notes, and snippets.

View plembo's full-sized avatar

Phil Lembo plembo

View GitHub Profile
@plembo
plembo / chgkvmnetcfg.md
Last active February 24, 2025 00:45
Changing a KVM network configuration

Changing a KVM (libvirtd) network configuration

The documentation recommends you do this using virsh net update, but you'll need to read it very carefully to figure out exactly how -- because they provide you with only a single example to work with.

Only the following virtual network components can be changed using net-update:

ip-dhcp-host
ip-dhcp-range (add/delete only, no modify)
forward-interface (add/delete only)
@plembo
plembo / addremstatichostmappinger4.md
Last active December 4, 2024 19:17
Adding and removing static host mappings on EdgeRouter

Adding and removing static host mappings on EdgeRouter

Tested on a Ubiquiti EdgeRouter 4 with dnsmasq enabled for DHCP (and DNS) serving.

These operations can also be carried out in the EdgeRouter web gui with the "DNS host names" Wizard (click the "Wizards" tab and then select "DNS host names" to access).

To see all currently statically mapped hosts:

$ cat /etc/hosts
@plembo
plembo / pwrlinebashpwsh.md
Last active September 19, 2021 19:35
Powerline on bash and PowerShell for Linux and Windows

Powerline on bash and PowerShell for Linux and Windows

NOTE: If you find yourself getting thinking you may have gotten way too far down into the weeds with this, you might want to consider a much less involved alternative: bash-git-prompt (that's what I'm now using on all my Linux machines).

To be clear, this gist will focus on Powerline for the Gnome terminal on Linux and for PowerShell Core on Windows 10, because those are the combinations I use in my daily work.

powerline image

There are two different open source products that make it easier to implement Powerline for bash and PowerShell:

Oh My Bash for bash on

@plembo
plembo / remflatpak.md
Last active December 16, 2020 23:30
Remove flatpak

Removing flatpak

As an equal-opportunity employer, my notes on completely removing flatpak (may God have mercy on my soul):

Before starting, be sure to inventory what's installed:

$ flatpak list

Then run the following commands to remove all flatpaks and the flatpak service:

@plembo
plembo / getlatestgitforubuntu.md
Last active May 26, 2022 20:11
Latest git for Ubuntu

Get the latest git for Ubuntu

The PPA referenced below is what you want, at least for Ubuntu 18.04 and 20.04 LTS:

$ sudo add-apt-repository ppa:git-core/ppa
...
    [ENTER]
...
$ sudo apt update
$ sudo apt upgrade
@plembo
plembo / usesshx.md
Last active July 26, 2024 16:29
Use ssh -X

Use ssh -X to launch gui apps remotely

Launching gui apps on Linux remotely can be easy as

$ ssh -X test1.example.com

Back in the bad old days of Unix when X Windows was first being developed, it was decided that having the ability to remote into a machine and launch graphical apps was a good idea. All versions of X11 have retained this capability to one degree or another, but it's one of the features dropped by the Wayland project.

@plembo
plembo / instubuvmvirtinst.md
Last active March 21, 2025 09:17
Install Ubuntu VM using virt-install

Install a Ubuntu VM using virt-install for KVM (libvirtd)

Ubuntu is a particularly difficult distro to work with virt-install for a lot of reasons, not the least of which is that it departs from its Debian base in many key respects: starting with disk images. What's more, those departures are mostly undocumented. Debian and CentOS are a lot easier. Given IBM's recent actions with regard to CentOS, I think Debian is the best choice going forward.

Main source for how to do this was:

How to install KVM on Ubuntu 20.04 LTS Headless Server

For an interactive "graphical" console install

Two files, ubuntu.env for the environment variables, and inst-ubuntu.sh to run the commands.

@plembo
plembo / debianvmvirtinst.md
Last active March 5, 2025 08:21
Install a Debian VM using virt-install

Installing a Debian VM with virt-install on KVM (libvirtd)

This turned out to be easier than I thought it would, especially after struggling with Ubuntu.

Both procedures use a common debian.env file to hold environment variables applied in the script.

When installing Debian always be sure to select an apt mirror when prompted, if you don't you'll regret it.

Environment variables

In a file, debian.env:

@plembo
plembo / netbugindeb10.md
Last active March 29, 2024 17:56
Networking setup bug in Debian 10

Networking setup bug in Debian 10

Checking systemctl status networking on a fresh Debian 10 install, I saw the error:

Dec 23 15:36:50 testsrv01 ifup[628]: ifup: failed to bring up eth0

when /etc/network/interfaces had

allow-hotplug ens3
@plembo
plembo / ubuntu-server-setup-ifupdown.md
Last active January 8, 2025 19:13
Ubuntu Server Setup - with ifupdown

Ubuntu Server Setup - with ifupdown

The assumption here is that you're starting with a Ubuntu 20.04 LTS Server or newer, rather than Desktop, base (Ubuntu Desktop deploys NetworkManager rather than systemd-networkd by default). This box has an AMD Ryzen CPU.

The goal is networking configured for static addressing using using ifupdown, rather than the newer systemd-networkd and netplan, or (for Ubuntu Desktop) NetworkManager. It basically returns networking on Ubuntu to its Debian roots.

The physical network device name for the test machine was "ens3", it will be something else on different hardware.

NOTE: I am currently using netplan rather than ifupdown on my own Ubuntu servers. I'll keep these notes updated because the configuration is close enough to Debian that it may come in handy when I finally switch to Debian.