A tour of FreeBSD in 2022

Why Handy resources Talks Factoids Things that feel different Software management and ports Ports patching init system coreutils Scheduling Block devices My setup NFS xorg dwm st powerd++ ntp fonts Why Mostly curiosity. I’ve been a GNU/Linux and free software enthuiatist since the late 90’s and that’s not about to change. More concrete reasons: GNU/Linux won the war. However… The Berkeley Software Distributions are family of open UNIX-like operating systems with lineage back to AT&T UNIX They come as complete and cohesive systems, not a distribution of disparate pieces The BSD license is wonderfully permissive Bill Joy (the father of Sun, BSD, vi, RISC) Marshall Kirk McKusick ZFS, DTrace and Clang It feels so damn neat, tidy and robust It wont be my daily driver, however it’s nice to be aware of what {Free,Open,Net}BSD each bring to the table Handy resources FreeBSD Handbook FreeBSD Porters Handbook FreeBSD Wiki Freshports the place for ports and most recent commits bsd-hardware.info papers.freebsd.org the collected works of the FreeBSD community as presented at various conferences and summits Talks Using boot environments at scale - by Allan Jude The ZFS Filesystem workshop - by Philip Paeps Factoids The term daemon comes from Greek mythology and represents an entity that is neither good nor evil, and which invisibly performs useful tasks. This is why the BSD mascot is the cheerful-looking daemon with sneakers and a pitchfork. Things that feel different My Linux biases are deep rooted. It’s so fascinating to learn how the BSD’s have gone about things differently. ...

April 17, 2022 · 5 min

Default programs based on MIME type with XDG

From an ancient post I previously did…I need to refresh my mind on this topic often enough thought it worthy of breaking it out. How Linux systems figure out what program should open a file Programs that handle arbitrary files (e.g. web browsers, irc clients, file managers) delegate to a general purpose resource handler. XDG MIME Applications is the ubiquitous option here, and is not only an implementation, but a full blown specification. ...

February 1, 2022 · 2 min

DVD backups on GNU/Linux

This is how I like to create digital copies (i.e., backups) of my physical DVD collection, which I own legitimately. I don’t condone piracy or theft. Backup instructions Rip physical DVD media makemkv Transcode mkv to m4v container using Fast 1080p30 preset in handbrake. Passthrough UTF-8 subtitles if you like those. Copy to media backup server rsync --protect-args -av --progress Season8 "shnerg@172.16.1.32:/data/TV/Penn & Teller Bullshit/" Software MakeMKV transcoder that deals with proprietary (and usually encrypted) disc into a set of MKV files Handbrake general video transcoder The C source is available as tarballs makemkv-bin-1.16.5.tar.gz and makemkv-oss-1.16.5.tar.gz. The Linux release includes full source code for MakeMKV GUI, libmakemkv multiplexer library and libdriveio MMC drive interrogation library. ...

January 21, 2022 · 2 min

Installing Arch Linux on the Pinebook Pro

Updated 2022-04-11: Installed a minimal version of Manjaro, a SLICK flavour of Arch The pinebook pro is a beautiful 64-bit ARM based laptop, that reminds me of the form factor of a modern macbook air, shipping with a premium magnesium alloy shell, 64GB eMMC and a 10,000 mAH battery. All this for $200. As a NIX machine, I’ve found Manjaro to be delightful. I have dreams of one day installing OpenBSD. ...

July 27, 2020 · 3 min

My LaTeX, Pandoc and Makefile workflow for writing papers in 2022

Contents Install base Tex system Pandoc Author paper Create bibliography (BibTeX) Render the paper as PDF Use Git Resources LaTeX is a high-quality typesetting system; features are designed for the production of technical and scientific documentation. It’s the de-facto standard for the communication and publication of scientific documents, and available as free software. LaTeX is actually built on the TeX typesetting system created by the legendary Donald Knuth. LaTeX is nothing more than a series of TeX macros, providing ready made commands for common formatting and layout needs, such as section headings, footnotes, bibliographies and cross references. ...

May 26, 2019 · 5 min

Linux Storage and File Systems

Partitioning Two popular partition schemes are used in the wild, MBR and GPT. MBR MBR, or Master Boot Record, often associated with BIOS, was introduced in 1983 with IBM PC DOS 2.0, is a special boot sector located at the beginning of a drive. This sector contains a boot loader (e.g GRUB), and details about the logical partitions. MBR supports drives upto 2TiB, and up to 4 primary partitions. # fdisk /dev/vda Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Device does not contain a recognized partition table Building a new DOS disklabel with disk identifier 0x9228f9b7. Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition g create a new empty GPT partition table G create an IRIX (SGI) partition table l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): n Partition type: p primary (0 primary, 0 extended, 4 free) e extended Select (default p): Using default response p Partition number (1-4, default 1): First sector (2048-2097151, default 2048): Using default value 2048 Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +500M Partition 1 of type Linux and of size 500 MiB is set Command (m for help): l 0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris 1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT- 2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT- 3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT- 4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx 5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data 6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / . 7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility 8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt 9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/ 10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b 11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor 12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor 14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary 16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS 17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE 18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto 1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep 1c Hidden W95 FAT3 75 PC/IX be Solaris boot ff BBT 1e Hidden W95 FAT1 80 Old Minix Command (m for help): t Selected partition 1 Hex code (type L to list all codes): 83 Changed type of partition 'Linux' to 'Linux' Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks. The partition is now available as a block device, below we now see /dev/vda1: ...

June 12, 2017 · 23 min

Red Hat Certified System Administrator 8 (RHCSA)

I’m a software engineer not a sysadmin. In fact I know I’m a bad one. The RHCSA is a rote, mechanical process. It did force me to discover discover several gaps in my GNU/Linux knowledge so overall happy about that. Essential Tools Documentation man /usr/share/doc RPM bundled documentation General Searching Techniques Shell history Globbing I/O Redirection and Pipes Essential File Management Linux file system layout Finding Files locate find Archiving and compression with tar Hard and Soft Links Working with text Regular expressions grep sed and awk Connecting a Linux host Consoles Terminals and TTYs Switch Users (su) sudo SSH Managing users and groups Creating users User properties User configuration files Creating and managing groups Managing password properties Managing Permissions Changing file ownership Managing basic permissions Understanding umask (user mask) Special permissions suid sgid Sticky bit Understanding ACLs Configuring Networking Network device naming Managing runtime network configuration with ip Storing network configuration persistently nmcli Routing and DNS Managing Processes Shell jobs ps Memory usage CPU load System activity with top Sending signals to processes Priority and niceness tuned profiles Managing Software RPM and yum rpm queries yum Groups Repositories Modules and Application Streams Red Hat Subscription Manager Systemd Scheduling Tasks cron at systemd Timers tmpfiles.d Logging Rsyslog Systemd Journal Logrotate Managing Storage Disk layout Creating partitions GPT partitions with parted MBR partitions with fdisk File System Choices XFS Ext4 Mounting Persistent block device naming systemd mounts Swap Advanced Storage LVM Stratis VDO LUKS Advanced tasks Kernel management Boot procedure GRUB Systemd targets Essential troubleshooting Changing root password Managing network services SSH httpd (apache) SELinux Context Labels Booleans File context labels SELinux logs SELinux troubleshooting Firewalling with firewalld Automating installs Time services Remote file systems NFS CIFS with Samba Automount Containers Autostarting non-root containers with systemd user units Dont forget list Exam shakedown Linux Gems Essential Tools Documentation The ability to understand a program using local documentation resources; man, info, /usr/share/doc, within the RPM package. ...

May 3, 2017 · 47 min

C

Update: 2022-04-26: Overhauling to be simplier and bsd/clang friendly. Rules of engagement Style The language Basic Types Integer Types Real and Complex Floating Types void Memory Access Operators Strings The Pre Processor Macros Patterns vtables person_s.h print_vtable.h print_vtable.c main.c Libraries C standard library C POSIX library Unit Testing Sample C code Rules of engagement How I program C by Eskil Steenberg Notes on Programming in C by Rob Pike The Ten Commandments for C Programmers by Henry Spencer Style suckless FreeBSD man 9 style The language Basic Types Integer Types C99 with stdbool.h introduced boolean type _Bool (1 byte), and macros true (1) and false (0). ...

November 26, 2016 · 9 min

make

A small make orientation guide. make is a versatile task runner, its core competency is in creating files from other files Make essentials Equal signs Built-in variables Phony targets C specifics Custom variables Implicit variables Example Makefiles Make essentials make generates files from other files, using recipes, the syntax is as follows. Please note, thanks to POSIX standardisation the recipe MUST be indented with a tab (not spaces): target_file: prerequisite_file1 prerequisite_file2 shell command to build target_file (MUST be indented with tabs, not spaces) another shell command (these commands are called the "recipe") Unless you specify otherwise, Make assumes that the target (target_file above) and prerequisites (prerequisite_file1 and prerequisite_file2) are actual files or directories. You can ask Make to build a target from the command line like this: ...

October 9, 2016 · 7 min

Linux Ops Guide

Here I aim to cover a set of common administration tasks. Things like, the hostname, system logs, what users are currently logged in, physical devices that are connected, logical volumes, file system and inode allocation, attached network interfaces and their addressing, processes and daemons currently running, kernel verison, local users and groups, installed packages, remote mounts, network shares, system uptime, bread and butter OS stats (CPU, IO, network, memory). Booting shutdown -r +5 System going down for a reboot #wall broadcast msg shutdown -c #cancel reboot shutdown -r 00:00 #schedule for midnight shutdown -h +5 #halt system in 5 mins shutdown -h now Alternatively, just use systemd: ...

August 1, 2016 · 12 min