Monday, 20. May 2024 Week 21

Migrations

Migrations are not something you can do rarely, or put off, or avoid; not if you are a growing company. Migrations are an ordinary fact of life.

Doing them swiftly, efficiently, and -- most of all -- *completely* is one of the most critical skills you can develop as a team.

Charity Majors (via)

Sunday, 19. May 2024 Week 20

Building a Geocities website in 1998

Brings back some faint memories of young me playing around with FrontPage (wondering why the preview rendering of an animated fullscreen background of a burning fire is making the computer go slow…)

(via)

Monday, 13. May 2024 Week 20

On this day

In his 20 year anniversary post, Terence Eden explains how he uses the "On This Day" feature of his blog every morning to look back on what he was writing on this day in previous years.

Finding this very inspiring, I decided to add a similar feature to my blog.
As my blog is built with Jekyll as static pages, some plain old JavaScript was needed to surface the posts of this day without having to rebuild the page daily.

And here we have now the On this day page :-)

Saturday, 11. May 2024 Week 19

The KonCodie Method

What if Marie Kondo would become a software engineer?

Ben Buchanan did run a parody account on this topic and has archived the posts on his site.

There are some gems :-)

To choose what to keep and what to throw away, take each dependency in one's manifest and ask: "Does this spark joy?" If it does, keep it. If not, remove it from your codebase.

We should be choosing what to .gitkeep, not what we want to .gitignore

Cruft has only two possible causes: too much effort is required to refactor or it is unclear where things belong.

Sunday, 5. May 2024 Week 18

Migrate from legacy CSM boot to UEFI boot

Due to a hardware failure I had to replace one of my computers (switching from a 2015 Intel NUC to a Dell OptiPlex Micro 7010).
After moving the disk to the new system, it refused to boot (claimed that no bootable drive was available).

Turns out that the new system only supports UEFI booting and the existing disk was setup for 'legacy'/CSM boot.

I used the following steps to convert the existing disk to UEFI boot (while keeping all data on it available).
They are inspired by the excellent Switch Debian from legacy to UEFI boot mode guide from Jens Getreu.

  1. Disable secure boot in the BIOS to allow booting from an USB stick.
  2. Create a bootable USB stick with a Debian live system (see my previous post)
  3. Boot into the Debian live system
  4. Identify the disk to work on (/dev/nvme0n1 in my case)
  5. Convert the partition table from MBR to GPT:
    # gdisk /dev/nvme0n1
    
    r       recovery and transformation options (experts only)
    f       load MBR and build fresh GPT from it
    w	write table to disk and exit
  6. Install gparted into the Debian live system:
    # apt-get install gparted
  7. Create an UEFI partition and a partition for Grub2:
    # gparted /dev/nvme0n1
    Resize an existing partition to create space (does not need to be at the beginning of the disk, I used the swap partition).
    Create a new 100MB partition for efi (named "Efi partition"), format it as fat32 and flag it bootable.
    Create a new 50MB partition for Grub2 (named "BIOS boot partition"), keep it unformatted.
  8. Use gdisk to set proper partition codes (EF00 for the efi partition and EF02 for the Grub2 partition):
    # gdisk /dev/nvme0n1
    
    p	print the partition table
    t	change a partition's type code
    t	change a partition's type code
    w	write table to disk and exit
  9. Chroot into the on-disk root system:
    # mount -t ext4 /dev/nvme0n1p1 /mnt
    # mkdir /mnt/boot/efi
    # mount /dev/nvme0n1p2 /mnt/boot/efi
    # mount --bind /sys /mnt/sys
    # mount --bind /proc /mnt/proc
    # mount --bind /dev /mnt/dev
    # mount --bind /dev/pts /mnt/dev/pts
    # cp /etc/resolv.conf /mnt/etc/resolv.conf
    # chroot /mnt
  10. Update /etc/fstab:
    # ls -lisa /dev/disk/by-uuid
    Identify the UUID of the EFI partition (usually in the format XXXX-XXXX) and add a corresponding line to /etc/fstab:
    # echo "UUID=XXXX-XXXX /boot/efi vfat defaults 0 2" >> /etc/fstab
  11. Install grub-efi and install Grub2 to the EFI partition:
    # apt-get remove grub-pc
    # apt-get install grub-efi
    # grub-install /dev/nvme0n1
  12. Exit the chroot and reboot the system:
    # exit
    # reboot
  13. Select the Debian bootloader (/EFI/debian/grubx64.efi) in the UEFI BIOS and make it the default :-)

Create a bootable Debian USB stick on macOS

Needed to create a bootable Debian USB stick for some maintenance on one of my computers.
Here are the steps so I won't have to search for them the next time :-)

  1. Download the Debian live CD image
  2. Connect your USB stick and find its device location (/dev/diskX) with:
    sudo diskutil list
  3. If needed unmount your USB stick:
    sudo diskutil unmountdisk /dev/diskX
  4. Write the downloaded image onto the USB stick:
    sudo dd if=./debian-live-12.5.0-amd64-standard.iso of=/dev/diskX bs=1m
Wednesday, 24. April 2024 Week 17