Notes
Atom FeedMac Menubar Applications
Applications in my menubar (from left to right):
- Syncthing - Open source self-hosted file synchronization client
- Steelseries Driver - Configuration for my Arctis 7 headphones
- Mac Fan Control - Monitors temperature, optionally control fan speed
- Rectangle - Window tiling manager
- Amphetamine - Keeps computer from sleeping
- MenuMeters - System resource usage monitoring
Fixing "EFI stub: Exiting boot services and installing virtual address map..."
Update 2022-03-12 - If you’re seeing this after updating to the most recent linux kernel (>5.4.0-104) and you haven’t updated UTM, you should update UTM to at least version 3.1.5 which fixes boot issues.
UTM is a virtualization framework for Apple M1 ARM processors. However, compared to more establish virtualization frameworks like VMWare and Virtualbox, UTM still has bugs to iron out and features to implement.
One of the issues with UTM currently is that it has no support for ACPI shutdown, meaning you have to shut down from within the guest OS. This can also be problematic if the guest OS has crashed, locked up, or disconnected from network. When this happens, the only thing you can do is to forcibly turn off or restart the VM which can cause disk corruption.
When disk corruption happens, you might get a
EFI stub: Exiting boot services and installing virtual address map...
message
on the next startup and the bootloader will hang. If your guest VM is based on
Ubuntu, this can be solved by:
- Turning off the VM
- In the VM settings in the UTM management UI, under Display, switch the VM over to console-mode instead of full graphics.
- Restart the VM and wait for it to boot into load into a BareBox bootloader.
- Run
fsck
on the ubuntu disk partition (probablyfsck /dev/mapper/ubuntu--vg-root
if installed under default settings) exit
Barebox. This should try to restart the VM and load into the Ubuntu VM. If the Ubuntu VM loads, then your disk issues are fixed.- Turn off your VM again and switch back to full graphics in UTM.
ARM Support
I recently got a new 2021 Apple Macbook Pro 14” with the M1 Pro processor (quite a nice upgrade from my previous 2014 Macbook Pro). While the fact that the new ports on the 2021 Macbook Pro are great, the biggest hangup was switching from an AMD64 to an ARM64 CPU. For my development workflow, this meant switching to ARM64 versions of developer tools or switching to entirely different tools altogether. Following is an abridged list of dev tools that I use and what I switched to on ARM64.
AMD64 tool | New tool |
---|---|
Python | Works great |
Node | Works great |
Go | Works great |
Desktop apps (Chrome, iTerm, Slack, etc) | No issues found |
Factorio | Works great |
Virtualbox | UTM |
Docker | Works great |
Phantomjs | Chromium |
Official MySQL Docker Image | Semi-Official MySQL Docker Image |
Hadolint | No alternative so far |
Syncthing | Works great |
MenuMeters | Works great |
Amphetamine | Works great |
So far with few minor hickups, transitioning from AMD64 to ARM64 is working pretty well. Even transitioning off Virtualbox to a different Virtual Machine (UTM/QEMU) platform seemed pretty flawless.
PermalinkMap Caps Lock to Escape for Vim
As an avid vim user (better than emacs!), I’m having to escape out of different modes pretty often. Hitting the escape button on most keyboards adds a lot of friction being pretty far away from home row on a keyboard (not to mention simply missing on some versions of Macbooks). I’ve therefore remapped caps lock to escape to make it much easier to work with Vim.
For a mac, this is pretty easy and is built directly into MacOS. Within System Preferences -> Keyboard, you can edit Modifier Keys and remap Caps Lock to Escape.
Update 2021-11-25 from the @hrs:
PermalinkDID YOU KNOW that it’s also possible to bind caps lock to both escape (when pressed individually) AND control (when chording)? I’ve been doing that forever and it’s quite nice. The free MacOS tool for that is Karabiner
Download and Convert Youtube Playlists to MP3 Files
These are two scripts to download a youtube playlist of videos, and convert the videos into MP3 files.
youtube-dl supports converting files automatically but requires ffmpeg to be installed on the machine
and visible in $PATH
. convert.sh
instead uses a ffmpeg docker container.
download.sh
#!/bin/bash
# Download a youtube playlist
set -euo pipefail
IFS=$'\n\t'
url="$1"
wget https://yt-dl.org/downloads/2021.06.06/youtube-dl-2021.06.06.tar.gz
tar xvf youtube-dl*
screen python3 youtube-dl/youtube-dl "$url"
convert.sh
#!/bin/bash
# This script converts an mp4 into an mp3
# It works by running ffmpeg in a docker container
set -euo pipefail
IFS=$'\n'
convert () {
input="$1"
output="$input.mp3"
docker run -v "$(pwd):$(pwd)" -w "$(pwd)" jrottenberg/ffmpeg:3.4-scratch \
-stats \
-i "./$input" -vn \
-acodec libmp3lame -ac 2 -qscale:a 4 -ar 48000 \
"./$output"
}
if [ -z "${1-}" ]; then
for f in $(find . -type f -name "*.mp4"); do
convert "$f"
done
else
convert "$1"
fi