Dark's Code Dump

Possibly useful

Debian Buster upgrade boot failure (LVM + BTRFS)

Upgraded one of my servers to Buster and was faced with an unbootable box, unable to find the rootfs. On the server in question I am running a filesystem of BTRFS RAID 1 across two independent LVM disks.

Faffed around for ages trying to diagnose, in the end had success with the nuclear option:

Create /etc/initramfs-tools/scripts/local-top/forcelvm:

#!/bin/sh
PREREQ=""
prereqs()
{
   echo "$PREREQ"
}
case $1 in
prereqs)
   prereqs
   exit 0
   ;;
esac
. /scripts/functions

lvm vgchange -ay

btrfs device scan

Chmod it +x

Then update-initramfs -u -k all

Fix for League of Legends patch error code 004

Patching failed and we’re not sure why. Please restart the client to try patching again. (Error code 004)

If you have moved your League installation to another disk and used a symlink from the previous location to the new one, as of roughly patch 9.10, this no longer works.

Simply update your shortcuts to point directly to the new location, including the working directory, and all will be well.

GitHub does not respect GDPR in a reasonable way

Comment edit history is public (not a fan, but Facebook does this so whatever).

Deleted comments and their edit history are visible to the repository owner (yikes).

And the clincher: their support refuses to directly delete/anonymise comments under GDPR. (Mega yikes.) They claim to be a ‘processor’ and that any GDPR request has to be forwarded to the repository owner.

I’ve never heard of such a ridiculous policy and I can’t believe this is legally possible within the spirit of the GDPR. You don’t have to ask permission from a Facebook page owner to delete a comment left on their page! Somehow GitHub has managed to get themselves classed as a hosting service, not a social network. Fair enough for the git repos themselves, but god only knows how they legally wrangled that one for things like Issues.

In conclusion, think very carefully before posting anything whatsoever on GitHub. The only way to remove it is the nuclear option (delete account).

Bitlocker EDrive / IEEE 1667 Hardware SSD encryption on Dell XPS 15 9550

There is a lot of conflicting information about whether hardware encryption for Bitlocker works on the older XPS 15 laptops (9550 and probably 9560).

The answer is no, it does not work. The BIOS does not implement the required UEFI features. It fails when rebooting to apply, and when skipping the hardware test, soft-bricks the SSD.

Note I am referring specifically to Bitlocker EDrive mode (hardware encryption). Class 0 encryption also does not work on these laptops as there is no facility to set a BIOS password for NVMe disks.

Collectd disk plugin produces no output

I spent a while scratching my head over the collectd ‘disk’ plugin producing no output whatsoever on a Debian 9 server. No log output (other than successful load), no rrd files, nothing.

Frustratingly, debug logging in collectd is compiled out by default, and compiling collectd from debian source packages requires an insane number of dependencies, so I avoided that route.

Instead through analysing the source and history of the disk plugin I came across this commit. The issue turned out to be simple – in the backported kernel I was using, /proc/diskstats has a tonne more fields than the default 4.9 kernel, and this was causing the disk plugin to fall over silently.

It’s a ballache to do anything about this situation on Debian 9, assuming the backported kernel is essential. If you hit it then best just wait for Buster.

Tvheadend smooth output for 60hz display

Tvheadend 4.3 adds support for custom ffmpeg parameters via the ‘spawn’ stream profile. The following command line facilitates smooth output from interlaced 25/50hz Freeview to 60hz, without introducing the soap opera effect (only simple linear blending is used).

/usr/bin/ffmpeg -i pipe:0 -vf "yadif=1, minterpolate='mi_mode=blend:fps=60'" -bitrate 3000k -bufsize 3000k -c:v libx264 -preset veryfast -c:a aac -c:s copy -f mpegts pipe:1

This uses a disgusting amount of CPU time, but given there are no alternative ways of producing a watchable output on many devices, it’s well worth it. For example there is no alternative on Android, Kodi, etc. You can either have linear blending or questionable deinterlacing, but not both, and certainly not as nice deinterlacing as yadif=1.

Update: I stand corrected on the Kodi front, at least on Windows if you disable DXVA2, set output to Pixel Shaders and set deinterlacing to Deinterlace (not half), you can get high quality deinterlacing and linear blending, but it comes at a substantial CPU/GPU cost.

Brief review of Dell PowerEdge T110 II

  • Well designed + built
  • Quiet even at high load, more so than most desktop PCs
  • BIOS is absolute garbage:
    • No PCI-express 1.0(a) support, which prevents the use of many old low-speed PCIe cards such as NICs and TV tuners
      • Dell couldn’t give a toss about this, because hurr durr it’s a server who cares about standards if we can line our pockets from makers of PCIe NICs and raid cards via a little something we call Planned Obsolescence(tm)
    • Power saving features such as PCI ASPM are missing
    • Can’t disable onboard GPU in spite of a perfectly functional serial port and SoL implementation, unless a discrete GPU is present, but surprise surprise 99% of GPUs don’t work due to PCIe and power limitations.
    • Cannot boot from USB (or at all?) without at least one SATA device present
    • It’s made by Insyde, need I say more?

Garbage text from Serial-over-LAN on Dell server

Hit an issue on a PowerEdge T110 II where SOL was completely unusable with corrupted/garbage text.

Changing the terminal mode from VT100 to ANSI in the BIOS settings fixed it. (Even though I was using fully VT100 compatible terminals ¯\_(ツ)_/¯ )

Can’t boot from USB on Dell PowerEdge T110 II

Found myself stuck and couldn’t find any options to boot from USB (no BIOS settings and boot manager was completely blank. Here’s what fixed it:

Plug in at least one SATA disk (yes this is a ridiculous limitation) then go to Boot Manager (F11) and press enter on your SATA disk.

A menu then appears giving the option to select the USB drive.

How to remove all Javascript from WordPress

Why do modern web developers insist on hundreds of kb of Javascript when it achieves literally nothing at all? Here’s how you can make WordPress load several times faster, and without breaking any functionality, assuming your use case is a simple blog + comments.

Add the following to somewhere in your theme’s shared functions file, or similar:

function remove_all_scripts()
{
    if (!is_user_logged_in())
    {
        foreach (wp_scripts()->registered as &$script)
        {
            wp_dequeue_script($script->handle);
            wp_deregister_script($script->handle);
        }
    }
}

add_action('wp_enqueue_scripts', 'remove_all_scripts', PHP_INT_MAX);

The ‘is logged in’ check facilitates the wp-admin panel among other things.