Skip to content

Instantly share code, notes, and snippets.

View plembo's full-sized avatar

Phil Lembo plembo

View GitHub Profile
@plembo
plembo / muttmaildoesnotexist.md
Last active August 2, 2023 16:44
Suppress "~/Mail does not exist" message in mutt

Suppress "~/Mail does not exist" in mutt

An annoying message, asking for permission to create a folder that mutt then never uses (unless your MTA is configured for Maildir, but that's another story).

To fix it I just added unset folder to the end of /etc/Muttrc.

You probably will want to remove that if you ever decide to switch to Maildir.

MetaEd. "Suppresss "~/Mail does not exist" in mutt". Unix & Linux StackExchange, 4 May 2023, https://unix.stackexchange.com/questions/108097/suppresss-mail-does-not-exist-in-mutt.

@plembo
plembo / lxcufwallow.md
Last active September 29, 2023 19:46
lxc, lxd, ufw. dhcp, apt, containers

lxc and ufw

Problem

Basic lxc allows you to spin up lightweight system containers for testing. But if you're running a host firewall you may find it prevents your containers from acquiring an IP address over DHCP for networking, and from connecting to external hosts (like distro package servers).

NOTE: I don't use lxc in production, and have purged it from all my machines after some experimentation. Diving deeper into Docker seemed a better use of my time.

Solution

If running ufw on Ubuntu you should be able to fix that with the following command:

@plembo
plembo / steamubu2204nvidia.md
Last active July 7, 2024 22:02
Steam on Ubuntu 22.04 LTS Desktop with an NVIDIA RX3050

Steam on Ubuntu 22.04 LTS Desktop with an NVIDIA RX3050

Note the detailed heading. The subtitle should be "It's a miracle I got it to work at all". What follows are notes that I hope will help the next time I have to set this up, although I know they probably won't. They probably won't work for you either. Sorry.

Prerequisites

Make sure you're in an xorg, not wayland, session.

  1. Remove any existing nvidia packages:
  • sudo apt autoremove nvidia* --purge and/or
  • sudo /usr/bin/nvidia-uninstall
@plembo
plembo / fscrypthomeubu.md
Last active December 27, 2024 10:47
fscrypt encrypted existing home directory on ubuntu 22.04

fscrypt to encrypt existing user home

NOTE: I no longer rely on this procedure, as I've become more concerned about data corruption than privacy risks. But I also now only travel with a machine that has been privacy hardened and scrubbed of most private data, relying on secure cloud storage (Proton Drive) to retrieve any sensitive materials I may need.

Open source fscrypt provides native encryption for ext4 filesystems on Linux. With it you can encrpyt folders within a disk partition, including user folders. It cannot encrypt files in place, so data must be backed up before proceeding.

The process described below has only been tested on Ubuntu 22.04 LTS Desktop after install and user home creation. All device filesysystems are ext4. The /home directory is mounted on its own dedicated partition (e.g., "/dev/sda3"). I'm doing this to secure the personal data on a laptop from common theives, not state actors or anyone who can get access to the machine while it's running. Your Mileage May Vary. Because.

@plembo
plembo / restorevirtconnvidia.md
Last active April 21, 2024 15:56
Vrtual Linux console vs NVIDIA

Restore Linux virtual console knocked out by NVIDIA

NOTE: This problem appears to have been cleared up with my latest NVIDIA driver update (535.171.04), and so I no longer need to make the changes noted below.

There's apparently a longstanding bug in NVIDIA's driver that can prevent the use of Linux virtual consoles ("text consoles") when plugged into the card. This doesn't affect virtual consoles when plugged into integrated graphics.

While I don't have a bug report reference for this particular issue, there is this response to an Ask Ubuntu post from 5 years ago:

Zanna. "nVidia driver kills text consoles - how to get them back?". Ask Ubuntu, 30 July 2018, https://askubuntu.com/a/662782.

@plembo
plembo / nmclistaticnet.md
Last active October 22, 2024 13:31
nmcli commands for static networking

nmcli commands for static networking

This is for a common use case: setting up static networking from the command line on a Linux system that uses NetworkManager.

For all its faults, I like NetworkManager because of its versatility. Here are the commands to use on a new Linux machine to take it from DHCP to static networking. On some systems you may need to execute these sudo root.

Do all this at the host console if possible, not over the network. Connectivity will be lost during these changes.

I like to start with renaming the connection after the device it controls. Connection names are case-sensitive.

The hardware device in these examples has been assigned "ens3" as its device name. This will almost certainly be different on different machines. Use ip addr to retrieve the name for yours.

@plembo
plembo / docker-systemd.md
Last active June 27, 2023 05:52
docker for system containers

Docker for System Containers

Docker is a popular solution for packaging applicatiom containers, but it can work equally as well for building system containers.

I've tried using lxc, and then lxd, for this, but the former requires too much tweaking (e.g. to get networking going, with sparse and outdated documentation), and the latter chases docker in a not-very-serious way. It's also only available as a snap.

The problem with creating system containers with docker is that by default they shut down immediately after creation, because there's no app or service to keep it running.

Solution

To create a docker container from an O/S image that will keep running after creation, use this command:

@plembo
plembo / hwconsolestmhidpi.md
Last active October 22, 2024 13:32
Hardware consoles on tiny monitors

Hardware consoles on tiny monitors and high DPI displays

Introduction

If you have a tiny monitor like the 7-inch that sits on top of my home server, or a high(er) DPI display like the one I just installed in my used Thinkpad X250 (going from 1366x768 to 1920x1080 in 12 inches of screen real estate), you may have wondered how to increase the font size for your hardware console (the physical display attached to the computer) in the absence of a graphical environment like gnome.

Procedure

There's a two part recipe for this:

  1. Install fonts-terminus (the name of the package in Ubuntu).
  2. Reconfigure the console to use a larger Terminus font.
@plembo
plembo / managingpython.md
Last active October 18, 2024 16:39
Managing python

Managing python (for most of us)

I was recently inspired by an article entitled "Relieving your Python packaging pain" to rethink how I manage python on my personal machines. Keep in mind that I'm a systems architect by trade, not a software developer, and so your mileage may vary.

Rules of the game

In the above mentioned article, six basic rules were set out that I can wholeheartedly agree with:

  1. Don't install the latest major version of Python
  2. Use only the python.org installer on Windows and Mac, or official repositories on Linux
  3. Never install or run anything outside of a virtual environment
@plembo
plembo / kvmuefifiles.md
Last active February 27, 2023 22:23
KVM and UEFI firmware

KVM and UEFI Firmware

A couple of notes on KVM guests using UEFI rather than BIOS (currently the default):

  1. On Ubuntu, the ovmf package is a prerequisite for creating KVM guests that use UEFI (sudo apt install ovmf).
  2. Linux and Windows machines use different firmware files from the OVMF collection:
  • Linux guests use /usr/share/OVMF/OVMF_CODE_4M.fd
  • Windows guests use /usr/share/OVMF/OVMF_CODE_4M.ms.fd