A function similar to Perl’s die() in bash

This is maybe a bit silly, but Perl has a die() function that is really handy for quitting a script with an error message. And I kind of miss it in Bash. So it can be defined with this simple one-liner: function die { echo $1 ; exit 1 ; } And then it can [...]

Linux kernel workqueues: Is it OK for the worker function to kfree its own work item?

Freeing yourself Working with Linux kernel’s workqueues, I incremented a kref reference count before queuing a work item, in order to make sure that the data structure that it operated on will still be in memory while it runs. Just before returning, the work item’s function decremented this reference count, and as a result, the [...]

Installing GRUB 2 manually with rescue-like techniques

Introduction It’s rarely necessary to make an issue of installing and maintaining the GRUB bootloader. However, for reasons explained in a separate post, I wanted to install GRUB 2.12 on an old distribution (Debian 8). So it required some acrobatics. That said, it doesn’t limit the possibility to install new kernels in the future etc. [...]

Migrating an OpenVZ container to KVM

Introduction My Debian 8-based web server had been running for several years as an OpenVZ container, when the web host told me that containers are phased out, and it’s time to move on to a KVM. This is an opportunity to upgrade to a newer distribution, most of you would say, but if a machine [...]

Running KVM on Linux Mint 19 random jots

General Exactly like my previous post from 14 years ago, these are random jots that I took as I set up a QEMU/KVM-based virtual machine on my Linux Mint 19 computer. This time, the purpose was to prepare myself for moving a server from an OpenVZ container to KVM. Other version details, for the record: [...]

Bracketed paste: Those ~0 and ~1 added around pasted text

Intro This is a super-short post, but I have a feeling it will evolve with time. Using ssh, pasting text with CTRL-V or the mouse’s middle button sometimes resulted in ~0 and ~1 around the pasted text. Super annoying. As it turns out, this is called “bracketed paste” and its a way for the terminal [...]

systemd dependencies and processing /etc/fstab

The problem I wanted to solve On an embedded arm system running LUbuntu 16.04 LTS (systemd 229), I wanted to add a mount point to the /etc/fstab file, which originally was like this: # UNCONFIGURED FSTAB FOR BASE SYSTEM Empty, except for this message. Is that a bad omen or what? This is the time [...]

Remapping keyboard keys to allow å, ä and ö

Motivation I have an English / Hebrew keyboard, but occasionally I also want to use the Swedish letters å, ä and ö. The idea is to sacrifice three keys on the keyboard for this purpose. But which ones? I went for the keypad’s /, * and – keys. But hey, I use these normally every [...]

PPPoE on fiber with the Linux machine as the router

Introduction Having switched from ADSL to FTTH (fiber to the home), I was delighted to discover that the same script that set up the pppoe connection for ADSL also works with the new fiber connection. And as the title of this post implies, I opted out the external router that the ISP provided, and instead [...]

Notes on Bluetooth on Linux internals

Introduction These are notes I made while trying to make my Sony WH-CH510 bluetooth headphones work properly with my Linux Mint 19 machine. It’s evident that an upgrade of the whole OS would have fixed the problem, but I have my opinion on upgrades. The problem: It takes a long time for the headphones to [...]