Valuable News – 2021/10/25

The Valuable News weekly series is dedicated to provide summary about news, articles and other interesting stuff mostly but not always related to the UNIX or BSD systems. Whenever I stumble upon something worth mentioning on the Internet I just put it here.

Today the amount information that we get using various information streams is at massive overload. Thus one needs to focus only on what is important without the need to grep(1) the Internet everyday. Hence the idea of providing such information ‘bulk’ as I already do that grep(1).

UNIX

Modern Retro WM – eMWM on FreeBSD.
https://www.youtube.com/watch?v=RiGDdARNtBg

OpenBSD 7.0 Released with RISC-V 64-bit Port and Better Apple Silicon Support.
https://www.phoronix.com/scan.php?page=news_item&px=OpenBSD-7.0-Released

How BSD Authentication Works on OpenBSD.
https://blog.lambda.cx/posts/how-bsd-authentication-works/

Klara Systems – Explaining top(1) on FreeBSD.
https://klarasystems.com/articles/explaining-top1-on-freebsd/

FreeBSD Finally Ditches csh(1) as Default root Shell in Favor of Improved sh(1).
https://cgit.freebsd.org/src/commit/?id=d410b585b6f00a26c2de7724d6576a3ea7d548b7

Enhanced Capabilities with IBM AIX 7.3 Standard Edition.
https://www.ibm.com/common/ssi/cgi-bin/ssialias?infotype=AN&subtype=CA&htmlfid=897/ENUS221-328&appname=USN

IBM AIX 7.3 Released.
https://www.osnews.com/story/134107/ibm-released-aix-7-3/

Setup GoAccess for Nice Stats with OpenBSD httpd.
https://si3t.ch/log/2021-10-18-goaccess-setup.html

HardenedBSD 2021/10 Home Infrastructure Status.
https://git.hardenedbsd.org/shawn.webb/articles/-/blob/master/personal/2021-10-20_home_infra/article.md

DroidCam Adds Initial FreeBSD Support.
https://github.com/dev47apps/droidcam/pull/189

Install FreeBSD on Raspberry Pi.
https://raspberrytips.com/install-freebsd-raspberry-pi/

BSD Weekly – Issue 89.
https://bsdweekly.com/issues/89

OpenBSD Compile Time Comparison.
https://kernelpanic.life/hardware/openbsd-compile-time-comparison.html

Put Single Process Web Server on FreeBSD 12.1 Jail.
https://gist.github.com/hiway/2b526fc64748e8d6e9f36f289003f843

BSD Now 425 – Releases Galore.
https://www.bsdnow.tv/425

My Path to FreeBSD.
https://www.youtube.com/watch?v=2CoSbDfBe2k

Tuning Power Consumption on FreeBSD Laptops and Intel Speed Shift.
https://www.neelc.org/posts/freebsd-speed-shift-laptop/

FreeBSD 12.3-BETA1 Now Available.
https://lists.freebsd.org/archives/freebsd-stable/2021-October/000269.html

In Other BSDs for 2021/10/23.
https://www.dragonflydigest.com/2021/10/23/26278.html

AMD uProf Performance Analysis Tool is Available for FreeBSD.
https://developer.amd.com/amd-uprof/

FreeBSD 12.3 Prepares for New Release Ahead of Christmas – Beta Starts.
https://www.phoronix.com/scan.php?page=news_item&px=FreeBSD-12.3-BETA1

Use notify-send as root with automount(8) on FreeBSD. [2015]
https://hauweele.net/~gawen/blog/?p=834

Linus Tech Tips Migrated to TrueNAS for Storage.
https://www.youtube.com/watch?v=coShLkCriXc

FreeBSD Foundation 2021/10 Fundraising Update.
https://freebsdfoundation.org/blog/freebsd-foundation-october-2021-fundraising-update/

OpenBSD on HiFive Unmatched.
https://kernelpanic.life/hardware/hifive-unmatched.html

Hardware

Apple Announces M1 Pro and M1 Max – Giant New ARM SoCs.
https://www.anandtech.com/show/17019/apple-announced-m1-pro-m1-max-giant-new-socs-with-allout-performance

Apple Ignites Industry with M1 Pro and M1 Max.
https://www.servethehome.com/apple-ignites-the-industry-with-the-m1-pro-and-m1-max/

Alibaba Open Sources XuanTie E902/E906/C906/C910 RISC-V Cores.
https://www.cnx-software.com/2021/10/20/alibaba-open-source-risc-v-cores-xuantie-e902-e906-c906-and-c910/

Beelink SER3 AMD Ryzen 7 Mini PC Review.
https://www.cnx-software.com/2021/10/21/beelink-ser3-review-a-good-amd-ryzen-7-mini-pc-after-tweaks/

Intel Celeron J6412 Thin Mini-ITX Motherboard with Four (4) RJ45 Ethernet Ports.
https://www.cnx-software.com/2021/10/22/intel-celeron-j6412-thin-mini-itx-motherboard-offers-four-ethernet-ports/

ASUS Pro WS WRX80E-SAGE SE WiFi Review AMD Ryzen Threadripper Pro.
https://www.servethehome.com/asus-pro-ws-wrx80e-sage-se-wifi-review-amd-threadripper-pro/

Life

1980s Metalhead Kids are Alright – Scientific Study Shows That They Became Well Adjusted Adults.
https://www.openculture.com/2019/05/1980s-metalhead-kids-are-alright.html

I Found Amazon Dir with 1000s of Audio Recordings from My Home Gadgets.
https://nypost.com/2021/10/19/i-found-an-amazon-folder-with-thousands-of-audio-recordings-from-my-home-gadgets/

Hiroshi Ono – Artist Behind Pac-Man and Other Namco Hits – Dies at 64.
https://www.thegamer.com/hiroshi-ono-namco-pixel-artist-dies/

Harvard University Study – Most Vaccinated Countries Have Highest Number of COVID-19 Cases.
https://theexpose.uk/2021/10/21/harvard-study-finds-most-vaccinated-countries-have-highest-rate-covid-19/

Novak Djokovic in Doubt for Australian Open over Refusal to Reveal Vaccination Status.
https://www.theguardian.com/sport/2021/oct/19/unvaccinated-athletes-unlikely-to-get-visas-to-enter-australia-says-victorian-premier

Myocarditis in VAERS in Association with COVID-19 Shots – 19 Times Expected Number of Cases.
https://pubmed.ncbi.nlm.nih.gov/34601006/

Other

We Analyzed 425k Favicons.
https://iconmap.io/blog

Forget Twitter Threads – Write Blog Post Instead.
https://kevq.uk/forget-twitter-threads-write-a-blog-post-instead/

RFC 3339 vs ISO 8601.
https://ijmacd.github.io/rfc3339-iso8601/

EOF

Other FreeBSD Version in ZFS Boot Environment

The first FreeBSD 12.3-PRERELEASE snapshots are finally available. This means we can try them in a new ZFS Boot Environment without touching out currently running 13.0-RELEASE system. We can not take the usual path with creating new BE from our current one and upgrade it to newer version because 12.3 has older major version then the 13.0 one.

This is kinda a paradox in the FreeBSD release process that when released the 12.3-RELEASE will have some newer commits and features then older 13.0-RELEASE which was released earlier this year. Of course not all things that have been committed to HEAD goes into 12-STABLE or 13-STABLE automatically – but most of them do. Only the biggest changes will be limited only to 14.0-RELEASE – of course probably somewhere in the middle of 2022 when it will be having its release process.

One note about ZFS filesystem on FreeBSD. People often confuse ‘real’ ZFS Boot Environments with its trying-to-be substitutes like BTRFS snapshots or snapshots used by Ubuntu with zsysctl(8) command. Unfortunately they are only snapshots and are not full writable clones (or entire separate ZFS datasets). They can freeze your system in time so you will be able to get back to working configuration after updating packages for example – but You will not be able to install other separate version of a system as other ZFS dataset making it another independent ZFS Boot Environment.

Create New ZFS Dataset

host # beadm list
BE             Active Mountpoint  Space Created
13.0.w520      NR     /           12.8G 2021-09-14 17:27
13.0.w520.safe -      -            1.2G 2021-10-18 10:01

host # zfs list -r zroot/ROOT
NAME                        USED  AVAIL     REFER  MOUNTPOINT
zroot/ROOT                 12.8G  96.8G       88K  none
zroot/ROOT/13.0.w520       12.8G  96.8G     11.6G  /
zroot/ROOT/13.0.w520.safe     8K  96.8G     11.1G  /

host # zfs create -o mountpoint=/ -o canmount=off zroot/ROOT/12.3

host # beadm list
BE             Active Mountpoint  Space Created
13.0.w520      NR     /           12.8G 2021-09-14 17:27
13.0.w520.safe -      -            1.2G 2021-10-18 10:01
12.3           -      -           96.0K 2021-10-18 13:14

Install FreeBSD 12.3-PRERELEASE

host # beadm mount 12.3 /var/tmp/12.3
Mounted successfully on '/var/tmp/12.3'

host # beadm list
BE             Active Mountpoint     Space Created
13.0.w520      NR     /              12.8G 2021-09-14 17:27
13.0.w520.safe -      -               1.2G 2021-10-18 10:01
12.3           -      /var/tmp/12.3  96.0K 2021-10-18 13:14

host # curl -o - https://download.freebsd.org/ftp/snapshots/amd64/12.3-PRERELEASE/base.txz \
         | tar --unlink -xpf - -C /var/tmp/12.3
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  173M  100  173M    0     0  1889k      0  0:01:33  0:01:33 --:--:-- 2228k

host # exa -1 /var/tmp/12.3
bin
boot
dev
etc
lib
libexec
media
mnt
net
proc
rescue
root
sbin
tmp
usr
var
COPYRIGHT
sys

host # curl -o - https://download.freebsd.org/ftp/snapshots/amd64/12.3-PRERELEASE/kernel.txz \
         | tar --unlink -xpf - -C /var/tmp/12.3
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 43.3M  100 43.3M    0     0  1733k      0  0:00:25  0:00:25 --:--:-- 1663k

host # exa -lh /var/tmp/12.3/boot/kernel/kernel
Permissions Size User Date Modified    Name
.r-xr-xr-x   37M root 2021-10-14 06:31 /var/tmp/12.3/boot/kernel/kernel

host # curl -o - https://download.freebsd.org/ftp/snapshots/amd64/12.3-PRERELEASE/lib32.txz \
         | tar --unlink -xpf - -C /var/tmp/12.3

host # exa -ld /var/tmp/12.3/usr/lib32
drwxr-xr-x - root 2021-10-18 13:45 /var/tmp/12.3/usr/lib32

Install Same Packages as on Host

With the pkg prime-list we will get all installed by hand pkg(8)packages from our currently running system. You may omit this section or just install packages that you need instead all of them.

host # pkg prime-list > /var/tmp/12.3/pkg.prime-list

host # chroot /var/tmp/12.3 /bin/sh

(BE) # export PS1="BE # "

BE # mount -t devfs devfs /dev

BE # sed -i '' s/quarterly/latest/g /etc/pkg/FreeBSD.conf

BE # pkg install -y $( cat pkg.prime-list )
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
Installing pkg-1.17.2...
Extracting pkg-1.17.2: 100%
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01
Fetching packagesite.pkg: 100%    6 MiB   1.3MB/s    00:05
Processing entries: 100%
FreeBSD repository update completed. 31294 packages processed.
All repositories are up to date.
Updating database digests format: 100%
pkg: No packages available to install matching 'chromium' have been found in the repositories
pkg: No packages available to install matching 'drm-fbsd13-kmod' have been found in the repositories
pkg: No packages available to install matching 'geany-gtk2' have been found in the repositories
pkg: No packages available to install matching 'ramspeed' have been found in the repositories
pkg: No packages available to install matching 'vim-console' have been found in the repositories

As we can see some of the packages that we have installed in the FreeBSD 13.0-RELEASE system are not currently available in the ‘latestpkg(8) branch for the FreeBSD 12.3-PRERELEASE system. This sometimes happens when the build of such package will fail – but you may assume that such package will be available in a week or so as that is the period in which pkg(8) packages are (re)build in the ‘latest‘ branch.

We will now remove the missed packages and also rename some packages that may have different names for 12.x version of FreeBSD.

BE # sed -i '' \
         -e s/drm-fbsd13-kmod/drm-kmod/g \
         -e s/geany-gtk2/geany/g \
         -e s/vim-console/vim-tiny/g \
         pkg.prime-list

BE # pkg install -y $( cat pkg.prime-list | grep -v -e chromium -e ramspeed )
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1072 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        (...)

Number of packages to be installed: 1072

The process will require 11 GiB more space.
2 GiB to be downloaded.
(...)

BE # rm pkg.prime-list

After hour or so later our packages have been installed.

BE # pkg stats
Local package database:
        Installed packages: 1073
        Disk space occupied: 11 GiB

Remote package database(s):
        Number of repositories: 1
        Packages available: 31294
        Unique packages: 31294
        Total size of packages: 96 GiB

Copy Configuration Files

You can now reboot to plain and unconfigured FreeBSD system but you may as well copy your configuration files from your current working installation. These are the files I have copied.

First files from the Base System /etc and /boot places.

host # for I in /boot/loader.conf \
                /etc/hosts \
                /etc/fstab \
                /etc/rc.conf \
                /etc/sysctl.conf \
                /etc/wpa_supplicant.conf \
                /etc/jail.conf \
                /etc/devfs.rules \
                /etc/resolv.conf
       do
         cp "${I}" /var/tmp/12.3/"${I}"
         echo "${I}"
       done
/boot/loader.conf
/etc/hosts
/etc/fstab
/etc/rc.conf
/etc/sysctl.conf
/etc/wpa_supplicant.conf
/etc/jail.conf
/etc/devfs.rules
/etc/resolv.conf

Now the files for installed packages under /usr/local/etc dir.

host # for I in /usr/local/etc/X11/xorg.conf.d/* \
                /usr/local/etc/X11/xdm/{Xresources,Xsetup_0} \
                /usr/local/etc/automount.conf \
                /usr/local/etc/sudoers \
                /usr/local/etc/doas.conf \
                /usr/local/etc/zshrc
       do
         cp "${I}" /var/tmp/12.3/"${I}"
         echo "${I}"
       done
/usr/local/etc/X11/xorg.conf.d/card.conf
/usr/local/etc/X11/xorg.conf.d/flags.conf
/usr/local/etc/X11/xorg.conf.d/keyboard.conf
/usr/local/etc/X11/xorg.conf.d/touchpad.conf
/usr/local/etc/X11/xdm/Xresources
/usr/local/etc/X11/xdm/Xsetup_0
/usr/local/etc/automount.conf
/usr/local/etc/sudoers
/usr/local/etc/doas.conf
/usr/local/etc/zshrc

Add Users and Set Passwords

You should now add your regular user and set passwords for both your user and root account.

BE # pw useradd vermaden -u 1000 -d /home/vermaden -G wheel,operator,video,network,webcamd,vboxusers

BE # passwd root

BE # passwd vermaden

Reboot Into New ZFS Boot Environment

You may now exit the chroot(8) of that ZFS Boot Environment and reboot. In the FreeBSD loader(8) menu select the 12.3 boot environment.

BE # exit

host # umount /var/tmp/12.3/dev

host # beadm unmount 12.3
Unmounted successfully

host # beadm list -D
BE             Active Mountpoint  Space Created
13.0.w520      NR     /           11.3G 2021-09-14 17:27
13.0.w520.safe -      -           11.1G 2021-10-18 10:01
12.3        -      -            9.5G 2021-10-18 13:14

host # shutdown -r now

Testing New System

The 12.3-PRERELEASE system started fine for me. I was able to login and use system as usual. One important thing to note … the ZFS pools. I have another newer ZFS pool with zstd compression enabled … and I was not able to import that ZFS pool as FreeBSD 12.3-PREELEASE does not use OpenZFS 2.0 but an older FreeBSD in-house ZFS version.

# zpool import data
This pool uses the following feature(s) not supported by this system:
        org.freebsd:zstd_compress (zstd compression algorithm support.)
        com.delphix:log_spacemap (Log metaslab changes on a single spacemap and flush them periodically.)
        org.zfsonlinux:project_quota (space/object accounting based on project ID.)
        org.zfsonlinux:userobj_accounting (User/Group object accounting.)
cannot import 'data': unsupported version or feature

Keep that in mind … but you can also install newer OpenZFS from the FreeBSD Ports and this is what we will now do.

# pkg install -y openzfs openzfs-kmod
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        openzfs: 2021090800
        openzfs-kmod: 2021090800

Number of packages to be installed: 2

The process will require 22 MiB more space.
4 MiB to be downloaded.
[1/2] Fetching openzfs-2021090800.pkg: 100%    3 MiB 975.3kB/s    00:03
[2/2] Fetching openzfs-kmod-2021090800.pkg: 100%    1 MiB 591.2kB/s    00:02
Checking integrity... done (0 conflicting)
[1/2] Installing openzfs-kmod-2021090800...
[1/2] Extracting openzfs-kmod-2021090800: 100%
pkg: Cannot open /dev/null:No such file or directory
[2/2] Installing openzfs-2021090800...
[2/2] Extracting openzfs-2021090800: 100%
=====
Message from openzfs-kmod-2021090800:

--
Amend /boot/loader.conf as follows to use this module:

- change zfs_load="YES" to NO
- change opensolaris_load="YES" to NO
- add openzfs_load="YES"
- (for ARM64) add cryptodev_load="YES"
=====
Message from openzfs-2021090800:

--
Ensure that any zfs-related commands, such as zpool, zfs, as used in scripts
and in your terminal sessions, use the correct path of /usr/local/sbin/ and
not the /sbin/ commands provided by the FreeBSD base system.

Consider setting this in your shell profile defaults!

We will now have to modify our /boot/loader.conf file.

host # beadm mount 12.3 /var/tmp/12.3
Mounted successfully on '/var/tmp/12.3'

host # chroot /var/tmp/12.3

BE # cp /boot/loader.conf /boot/loader.conf.ZFS

BE # vi /boot/loader.conf

BE # diff -u /boot/loader.conf.ZFS /boot/loader.conf
--- /boot/loader.conf.ZFS       2021-10-19 10:57:04.180732000 +0000
+++ /boot/loader.conf   2021-10-19 10:57:23.992145000 +0000
@@ -12,7 +12,8 @@

 # MODULES - BOOT
   geom_eli_load=YES
-  zfs_load=YES
+  zfs_load=NO
+  openzfs_load=YES

 # DISABLE /dev/diskid/* ENTRIES FOR DISKS
   kern.geom.label.disk_ident.enable=0

BE # shutdown -r now

After reboot and trying again I was able to import that newer ZFS pool.

Hope that you will find that guide useful.

Feel free to add your suggestions.

EOF

Valuable News – 2021/10/19

The Valuable News weekly series is dedicated to provide summary about news, articles and other interesting stuff mostly but not always related to the UNIX or BSD systems. Whenever I stumble upon something worth mentioning on the Internet I just put it here.

Today the amount information that we get using various information streams is at massive overload. Thus one needs to focus only on what is important without the need to grep(1) the Internet everyday. Hence the idea of providing such information ‘bulk’ as I already do that grep(1).

UNIX

RIP Jorg Schilling.
https://minnie.tuhs.org/pipermail/tuhs/2021-October/024523.html

Fosscord is Free Open Source Discord Compatible Platform.
https://github.com/fosscord/fosscord

Haiku 2021/09 Activity Report.
https://www.haiku-os.org/blog/pulkomandy/2021-09-27-haiku_activity_report_september_2021/

Quick Test of 3 Game Controllers on FreeBSD.
https://www.youtube.com/watch?v=M9hXQW8k-Io

How to Play Audio from Youtube in Console at FreeBSD.
https://jacekkowalczyk82.github.io/update/manuals/linux/freebsd/2021/10/11/how-to-play-audio-from-youtube-in-console-at-freebsd.html

MidnightBSD – BSD Based Alternative to Linux Desktop.
https://www.makeuseof.com/midnightbsd-linux-desktop-alternative/

Mantra is CLI for Previewing Mandoc Manual Pages.
https://github.com/0mp/mantra

WireGuard Dynamic Routing on FreeBSD.
https://antranigv.am/weblog_en/posts/2021-10-10-wireguard-dynamic-routing-freebsd/

NomadBSD – Amazing OS for USB Drives.
https://www.youtube.com/watch?v=UxDscVR25-o

Klara Systems – Manipulating ZFS Pool from FreeBSD Rescue System.
https://klarasystems.com/articles/manipulating-a-pool-from-the-rescue-system%ef%bf%bc/

FreeBSD Audio.
https://meka.rs/blog/2021/10/12/freebsd-audio/
https://lobste.rs/s/moflv5/freebsd_audio_from_perspective_happy#c_mqvroo

Installing PostgreSQL on OpenBSD.
https://fluca1978.github.io/2021/10/09/PostgreSQLOnOpenBSD.html

DragonflyBSD 6.0.1 Released.
https://lists.dragonflybsd.org/pipermail/commits/2021-October/820665.html

GitHub Actions for BSD.
https://github.com/mario-campos/emulate

Packaging DMD D Compiler for OpenBSD.
https://briancallahan.net/blog/20211013.html

OPNsense Business Edition 21.10 Released.
https://forum.opnsense.org/index.php?topic=25145.0

Robert Clausecker Got radeonkms Working on RISC-V on FreeBSD.
https://twitter.com/FUZxxl/status/1448391456037777412

Upgrading PostgreSQL 13 to 14 Including Replicas on FreeBSD.
https://p-o.co.uk/tech-articles/upgrading-from-postgresql-13-to-14-including-replicas-on-freebsd/

The helloSystem BSD – Simplicity/Elegance/Usability.
https://www.youtube.com/watch?v=CIlApGchdks

OpenBSD 7.0 Released.
https://openbsd.org/70.html
https://marc.info/?l=openbsd-announce&m=163422237101753

BSD Now 424 – Unveiling OpenBSD Pledge.
https://www.bsdnow.tv/424

OpenBSD Webzine – Issue #2.
https://webzine.puffy.cafe/issue-2.html

OpenBSD 7.0 is Here.
https://www.youtube.com/watch?v=l60Kdua988c

GhostBSD with MATE 1.26.0 Upgrade Ready.
https://www.ghostbsd.org/MATE_1.26.0_upgrade_ready

FreeBSD 12.3-PRERELEASE Snapshots Available.
https://lists.freebsd.org/archives/freebsd-snapshots/2021-October/000005.html

KDE Plasma – 25th Anniversary Edition – 25 Years of Awesomness.
https://kde.org/announcements/plasma/5/5.23.0/

Kdenlive on TV for Main National Italian Broadcaster.
https://kdenlive.org/en/2021/10/kdenlive-on-tv-for-a-main-national-italian-broadcaster/

In Other BSDs for 2021/10/16.
https://www.dragonflydigest.com/2021/10/16/26259.html

FreeBSD GNOME Desktop on QEMU/KVM.
https://tips.graphica.com.au/freebsd-gnome-on-qemu/

Deploy Nginx Proxy Manager in DMZ with OPNsense.
https://homenetworkguy.com/how-to/deploy-nginx-proxy-manager-in-dmz-with-opnsense/

Puffy vs. Penguin – Getting Started with OpenBSD.
https://lowendbox.com/blog/puffy-vs-penguin-getting-started-with-openbsd/

GhostBSD 21.10.16 ISO Available.
https://www.ghostbsd.org/ghostbsd_21.10.16_iso_now_available

Use Your NAS as Steam Library – TrueNAS with iSCSI Basics.
https://www.youtube.com/watch?v=9JL-RVUHj6o

OpenBSD Gaming in 2022 be Like.
https://www.youtube.com/watch?v=05xVLyvc-sA

BastilleBSD Template for Tunning Odoo in FreeBSD.
https://github.com/yaazkal/bastille-odoo

The ‘ssh-rsa’ Signature Type is Now Disabled by Default on OpenBSD.
https://www.vincentdelft.be/post/post_20211018

FreeBSD Adds Userland Boot Profiling to TSLOG.
https://cgit.freebsd.org/src/commit/?id=46dd801acb2318c8464b185893bb111f09b71138

Space Cadet Pinball Added to FreeBSD Ports.
https://www.freshports.org/games/SpaceCadetPinball/

Installing and Setting up OpenBSD on Thinkpad T480 with Improving Slowness.
https://kevinthomas.dev/posts/openbsd-thinkpadt480.html

Simulation of VT100 Hardware.
https://github.com/larsbrinkhoff/terminal-simulator

Hardware

Lurking in the Shadows of UEFI.
https://securelist.com/mosaicregressor/98849/

Beelink U59 Celeron N5095 Mini PC with Up to 16GB RAM and 512GB SSD.
https://www.cnx-software.com/2021/10/13/beelink-u59-celeron-n5095-jasper-lake-mini-pc-to-ship-with-16gb-ram-512gb-ssd/

Enormous PC Stick with Celeron J4105 and 8GB RAM and 128GB eMMC.
https://www.fanlesstech.com/2021/10/this-pc-stick-is-enormous.html

Simply NUC Launches Cypress Long Life Mini PC with Latest AMD Ryzen Embedded Processors.
https://www.techpowerup.com/287854/simply-nuc-launches-cypress-long-life-mini-pc-powered-by-latest-amd-ryzen-embedded-processors

AMD Ryzen Processors – 5 Years Later.
https://www.youtube.com/watch?v=yE9PsKWYYXA

Introducing PinePhone Pro.
https://www.pine64.org/2021/10/15/october-update-introducing-the-pinephone-pro/

HP EliteDesk 800 G6 Mini 65W TMM More Power.
https://www.servethehome.com/hp-elitedesk-800-g6-mini-65w-review-tmm-more-power/

Life

Ivermectin in Healthcare Workers – Study – Risk Reduction of 74%.
https://pubmed.ncbi.nlm.nih.gov/34513523/

Amish Covid.
https://fullmeasure.news/news/shows/amish-covid

EOF

Valuable News – 2021/10/11

The Valuable News weekly series is dedicated to provide summary about news, articles and other interesting stuff mostly but not always related to the UNIX or BSD systems. Whenever I stumble upon something worth mentioning on the Internet I just put it here.

Today the amount information that we get using various information streams is at massive overload. Thus one needs to focus only on what is important without the need to grep(1) the Internet everyday. Hence the idea of providing such information ‘bulk’ as I already do that grep(1).

UNIX

Black and White Only Graphics with X11 on UNIX.
https://www.reddit.com/r/openbsd/comments/d7bkyh/how_to_get_black_and_whiteonly_graphics/f2785v9/

OpenBSD Imports Realtek Wireless Firmware asd Result of Licence Change.
https://undeadly.org/cgi?action=article;sid=20211004070841

Time Machine – Solaris 2.6 on QEMU – You Can Never Go Home.
https://smackeyacky.blogspot.com/2021/10/time-machine-solaris-26-on-qemu.html

Most Reliable Hosting Company Sites in 2021/09 – FreeBSD on Top.
https://news.netcraft.com/archives/2021/10/04/most-reliable-hosting-company-sites-in-september-2021.html

GoTTY – Terminally Cool.
https://www.youtube.com/watch?v=4z8vvwFMh6w

4-Way Comparison of Compilation Performance on OpenBSD.
http://portal.mozz.us/gemini/thfr.info/openbsd/Compile-Time-Comparison-Oct-2021/

OpenStack Xena is Out After Adding 10M Cores in 1 Year.
https://www.servethehome.com/openstack-xena-is-out-after-adding-10m-cores-in-1-year/

Aho – Git Implementation in AWK.
https://github.com/djanderson/aho

Klara Systems – Webinar OpenZFS Newest Features.
https://klarasystems.com/learning/webinars/on-demand-library/webinar-openzfs-newest-features/

New FreeBSD 12.3-PRERELEASE Snapshots Available.
https://lists.freebsd.org/archives/freebsd-snapshots/2021-October/000001.html

OpenBSD Adds Initial Support for 40Mhz Channels to iwm(4) WiFi Driver.
https://marc.info/?l=openbsd-tech&m=163361070107245&w=2

Windows 11 Runs Properly under FreeBSD Bhyve.
https://twitter.com/PCTuning_OW/status/1446026384871239680

PostgreSQL Pager pspg(1) with Special Support for Tabular Data.
https://github.com/okbob/pspg

Use vtfontcvt(8) on FreeBSD to Get Atari ST System Font.
https://twitter.com/vmisev/status/1014578693707100166

Tribblix 0m25.1 Available.
https://tribblix.blogspot.com/2021/10/changes-in-0m251-prerelease.html

Stanley Kubrick Liked UNIX. [1983]
https://www.youtube.com/watch?v=54hrLTpsO5g

SerenityOS: Year 3 in Review.
https://serenityos.org/happy/3rd/

NetBSD and CTWM and Spleen.
https://www.cambus.net/netbsd-ctwm-and-spleen/

Full WireGuard Setup with OpenBSD.
https://dataswamp.org/~solene/2021-10-09-openbsd-wireguard-exit.html

OBS Studio Virtual Camera on FreeBSD.
https://www.davidschlachter.com/misc/freebsd-obs-virtualcam

SSH Tunneling Explained.
https://goteleport.com/blog/ssh-tunneling-explained/

Hardware

ASRock Rack WRX80D8-2T Motherboard for Ryzen Threadripper Pro.
https://www.anandtech.com/show/16990/asrock-rack-lists-wrx80d82t-for-ryzen-threadripper-pro-3000wx-processors

Ampere Altra Max Review – Pushing to 128 Cores per Socket.
https://www.anandtech.com/show/16979/the-ampere-altra-max-review-pushing-it-to-128-cores-per-socket/

Lenovo ThinkCentre M75n Fanless Device with 6W AMD CPU.
https://www.servethehome.com/lenovo-thinkcentre-m75n-iot-fanless-edge-device-with-6w-amd-cpu/

Ampere Computing Steps Up with Monthly Open Source Firmware Releases.
https://www.phoronix.com/scan.php?page=news_item&px=Ampere-Monthly-OSS-Firmware

IBASE Launches 3.5 Inch SBC with AMD Ryzen Embedded V2000 Processor.
https://www.cnx-software.com/2021/10/11/3-5-inch-sbc-amd-ryzen-embedded-v2000-processor/

Life

Whistleblower – Facebook is Misleading Public on Progress Against Hate Speech/Violence/Misinformation.
https://www.cbsnews.com/news/facebook-whistleblower-frances-haugen-misinformation-public-60-minutes-2021-10-03/

Players Will Not Have to Be Vaccinated to Compete at Qatar World Cup 2022.
https://www.thetimes.co.uk/article/players-will-not-have-to-be-vaccinated-to-compete-at-qatar-world-cup-68f9qwpkw

15 Sci-Fi Movies Where Time Travel Actually Makes Sense.
https://abakcus.com/fifteen-sci-fi-movies-where-time-travel-actually-makes-sense/

Why Curiosity is Better than Being Smart?
https://durmonski.com/life-advice/curiosity-is-better-than-being-smart/

India Declares Most Populated State Officially COVID Free After Widespread Use of Ivermectin.
https://www.oann.com/india-govt-declares-most-populated-state-officially-covid-free-after-widespread-use-of-ivermectin/

Immune Mediated Hepatitis with Moderna Vaccine No Longer a Coincidence but Confirmed.
https://www.journal-of-hepatology.eu/article/S0168-8278(21)02093-6/fulltext

Report on Myocarditis Adverse Events in VAERS in Association with COVID-19.
https://www.sciencedirect.com/science/article/pii/S0146280621002267?via%3Dihub

Natural Immunity and COVID-19 – 29 Scientific Studies to Share with Employers/Officials/Politicians.
https://brownstone.org/articles/natural-immunity-and-covid-19-twenty-nine-scientific-studies-to-share-with-employers-health-officials-and-politicians/

Other

Tab Unloading in Firefox 93.
https://hacks.mozilla.org/2021/10/tab-unloading-in-firefox-93/

Firefox Will Display Ads in Address Bar Suggestions.
https://support.mozilla.org/en-US/kb/navigate-web-faster-firefox-suggest

Lots to See in Firefox 93.
https://hacks.mozilla.org/2021/10/lots-to-see-in-firefox-93/

Firefox is Brazenly Sending Your Search Bar Keystrokes Back to Mozilla But You Can Stop It.
https://hothardware.com/news/how-to-disable-firefox-suggest-keystroke-collection

EOF

Valuable News – 2021/10/04

The Valuable News weekly series is dedicated to provide summary about news, articles and other interesting stuff mostly but not always related to the UNIX or BSD systems. Whenever I stumble upon something worth mentioning on the Internet I just put it here.

Today the amount information that we get using various information streams is at massive overload. Thus one needs to focus only on what is important without the need to grep(1) the Internet everyday. Hence the idea of providing such information ‘bulk’ as I already do that grep(1).

UNIX

What the GNU?
https://ariadnavigo.xyz/posts/what-the-gnu/

DistroWatch Feature Story – Airyx 0.2.2
https://distrowatch.com/weekly.php?issue=20210927#airyx

Multi Site Active Active Replication with Minio.
https://blog.min.io/minio-multi-site-active-active-replication/

EuroBSDcon Presentation Videos.
https://www.youtube.com/playlist?list=PLskKNopggjc4dadqaCDmctW-swHPD49td

OmniOS Community Edition r151038v/r151036av/r151030dv Available.
https://omnios.org/article/release-r38v

Measuring Power Efficiency of CPU Frequency Scheduler on OpenBSD.
https://dataswamp.org/~solene/2021-09-26-openbsd-power-usage.html

Printing on FreeBSD – Quick Guide.
https://freebsdfoundation.org/freebsd-project/resources/printing-on-freebsd-quick-guide/

The pkgsrc 2021Q3 Branch Announcement.
https://bsdsec.net/articles/pkgsrc-2021q3-branch-announcement

Groovy Clear Acrylic AMIGA 1000 Case Top.
https://www.amigalove.com/viewtopic.php?f=6&t=1999

BSD Now 422 – Brian Callahan Interview.
https://www.bsdnow.tv/422

PostgreSQL 14 Released.
https://www.postgresql.org/about/news/postgresql-14-released-2318/

Understanding AWK.
https://earthly.dev/blog/awk-examples/

Viable Alternative – FreeBSD 13.0 not RPiOS on PI.
https://www.youtube.com/watch?v=Cx7_zvh-b6k

HardenedBSD 2021/09 Status Report.
https://hardenedbsd.org/article/shawn-webb/2021-09-30/hardenedbsd-september-2021-status-report

LLVM Clang 12 Benchmarks at Varying Optimization Levels LTO.
https://www.phoronix.com/scan.php?page=article&item=clang-12-opt

OpenBSD Webzine – Issue 1.
https://webzine.puffy.cafe/issue-1.html

GhostBSD 21.09.29 ISO Now Available.
https://www.ghostbsd.org/ghostbsd_21.09.29_iso_now_available

Klara Systems – FreeBSD Jails – Deep Dive into Beginning of FreeBSD Containers.
https://klarasystems.com/articles/freebsd-jails-the-beginning-of-freebsd-containers/

ASUS PN50 Mini PC Review – AMD ZEN 2 Business NUC.
https://www.anandtech.com/show/16975/asus-pn50-ucff-pc-review-a-zen-2-business-nuc

Thanks to Semihalf the FreeBSD Gained Ability to Parse ACPI DSD.
https://twitter.com/wojtiszon/status/1443613586019037184

What Every IT Person Needs to Know About OpenBSD.
https://bsdly.blogspot.com/2021/09/what-every-it-person-needs-to-know.html

Toolchains Adventures – Q3 2021
https://www.cambus.net/toolchains-adventures-q3-2021/

FreeBSD Adds Support for Jails in freebsd-update(8) Command.
https://cgit.freebsd.org/src/commit/?id=c76da1f01064b2b9a1903b30d4b4c444b85f8724

Cloning Installed System and New Graphical Installer for CultBSD.
https://www.youtube.com/watch?v=HgYqJvrebsE

In Other BSDs for 2021/10/02.
https://www.dragonflydigest.com/2021/10/02/26212.html

Why Vim Uses [H][J][K][L] Keys.
https://www.hillelwayne.com/post/always-more-history/

The helloSystem 0.6.0 Released.
https://github.com/helloSystem/ISO/releases/tag/r0.6.0

LibreSSL 3.3.5 and 3.2.7 Released.
https://bsdsec.net/articles/libressl-3-3-5-3-2-7-released

FreeBSD 12.3-RELEASE Release Process.
https://www.freebsd.org/releases/12.3R/schedule/

PLAN 9 Desktop Guide.
https://pspodcasting.net/dan/blog/2019/plan9_desktop.html

Nextcloud on OpenBSD.
https://blog.stoege.net/posts/nextcloud/

Hardware

6000 RISC-V Cores on Xilinx FPGA Break CoreScore World Record.
https://www.tomshardware.com/news/6000-risc-v-cores-on-a-xilinx-fpga-break-the-corescore-world-record

Klara Systems – RISC-V – New Architecture on the Block.
https://klarasystems.com/articles/risc-v-the-new-architecture-on-the-block/

Gentle Introduction to GPUs Inner Workings.
https://vksegfault.github.io/posts/gentle-intro-gpu-inner-workings/

Life

Greyscale Screens for Anxiety.
https://rubenerd.com/greyscale-screens-for-anxiety/

Japan to End COVID Emergency on Thursday.
https://www3.nhk.or.jp/nhkworld/en/news/20210928_30/

Spike Protein – Dose Dependent Killer?
https://kamal-mokeddem.medium.com/spike-protein-a-dose-dependent-killer-2e26ec28de3f

Let Light in: Why Guardian is Publishing Pandora Papers.
https://www.theguardian.com/news/2021/oct/03/let-the-light-in-why-the-guardian-is-publishing-the-pandora-papers

Pandora Papers: Biggest Ever Leak of Offshore Data Exposes Financial Secrets of Rich and Powerful.
https://www.theguardian.com/news/2021/oct/03/pandora-papers-biggest-ever-leak-of-offshore-data-exposes-financial-secrets-of-rich-and-powerful

India Ivermectin Blackout – Secret Revealed.
https://www.zerohedge.com/covid-19/indias-ivermectin-blackout-secret-revealed

Jeremy Chardy – I Regret Getting Vaccinated – I Have Series of Problems Now.
https://www.tennisworldusa.org/tennis/news/Tennis_Interviews/102836/jeremy-chardy-i-regret-getting-vaccinated-i-have-series-of-problems-now/

Increases in COVID-19 are Unrelated to Levels of Vaccination Across 68 Countries.
https://link.springer.com/article/10.1007/s10654-021-00808-7

Romania Opens Investigation into How Covid Vaccines Were Acquired and Shutsdown Its Vaccine Centers.
https://greatgameindia.com/romania-shutsdown-vaccine-centers/

EOF

Valuable News – 2021/09/27

The Valuable News weekly series is dedicated to provide summary about news, articles and other interesting stuff mostly but not always related to the UNIX or BSD systems. Whenever I stumble upon something worth mentioning on the Internet I just put it here.

Today the amount information that we get using various information streams is at massive overload. Thus one needs to focus only on what is important without the need to grep(1) the Internet everyday. Hence the idea of providing such information ‘bulk’ as I already do that grep(1).

UNIX

Reuse of OpenBSD Packages for Trying Runtime.
https://dataswamp.org/~solene/2021-09-19-openbsd-quick-package-work.html

Linux/BSD Command Line Wizardry – Part 1 – Learn to Think in sed/awk/grep.
https://arstechnica.com/gadgets/2021/08/linux-bsd-command-line-101-using-awk-sed-and-grep-in-the-terminal/

Linux/BSD Command Line Wizardry – Part 2 – Variables and Loops.
https://arstechnica.com/gadgets/2021/09/command-line-wizardry-part-two-variables-and-loops-in-bash/

HIBA – Host Identity Based Authorization for SSH.
https://opensource.googleblog.com/2021/09/announcing-hiba-host-identity-based-authorization-for-SSH.html

Migrating from Apache/WordPress to relayd/httpd/hugo on OpenBSD.
https://www.tumfatig.net/2021/migrating-from-apache-wordPress-to-relayd-httpd-hugo/

Edit /etc/pf.conf Safely with pfedit on FreeBSD.
https://github.com/ropg/pfedit

FreeBSD Improves Long Term Load Balancer in sched_ule(4) Scheduler.
https://cgit.freebsd.org/src/commit/?id=e745d729be60a47b49eb19c02a6864a747fb2744

Klara Systems – OpenZFS – Understanding Transparent Compression.
https://klarasystems.com/articles/openzfs1-understanding-transparent-compression/

FreeBSD Implements and Uses New mixer(3) Library.
https://cgit.freebsd.org/src/commit/?id=903873ce15600fc02a0ea42cbf888cff232b411d
https://wiki.freebsd.org/SummerOfCode2021Projects/SoundMixerImprovements

The helloSystem 0.6.0 FreeBSD Release with Many Improvements.
https://twitter.com/probonopd/status/1440753962001387525

Improving GDB Register Model Compatibility in LLDB on FreeBSD.
https://www.moritz.systems/blog/improving-gdb-register-model-compatibility-in-lldb/

Klara Systems – Understanding OpenZFS ZFS SLOGs.
https://klarasystems.com/articles/what-makes-a-good-time-to-use-openzfs-slog-and-when-should-you-avoid-it/

Colin Percival Shortened FreeBSD Boot Loader Time on EC2 from 5.38 to 0.35 Seconds.
https://twitter.com/cperciva/status/1440702831590199306

GNOME 41 Release Notes.
https://help.gnome.org/misc/release-notes/41.0/

FreeBSD is About to Remove MIPS Support.
https://lists.freebsd.org/archives/freebsd-arch/2021-September/000068.html

Configure OPNsense for Directly Connected PC or Server.
https://homenetworkguy.com/how-to/connect-pc-directly-to-opnsense-interface/

Examining Linux BTRFS Perpetually Half Finished Filesystem.
https://arstechnica.com/gadgets/2021/09/examining-btrfs-linuxs-perpetually-half-finished-filesystem/

BSD Now 421 – ZFS Eats CPU.
https://www.bsdnow.tv/421

In Other BSDs for 2021/09/25.
https://www.dragonflydigest.com/2021/09/25/26196.html

OPNsense 21.7.3 Released.
https://opnsense.org/opnsense-21-7-3-released/

Terminal Case of Linux.
https://fasterthanli.me/articles/a-terminal-case-of-linux

OpenBSD and Wayland.
https://www.sizeofvoid.org/posts/2021-09-26-openbsd-wayland-report/

OpenSSH 8.8 Released.
https://www.openssh.com/txt/release-8.8

AIX 7.3 Open Beta Program.
https://www.linkedin.com/posts/mariarward_ibmaix-ibmsystems-ibmpower10-activity-6847304456443346944-vz2M/

The nerdctl Docker Compatible CLI for containerd Adds FreeBSD Support.
https://github.com/containerd/nerdctl/pull/361

OpenBSD on Vortex86DX CPU.
https://www.cambus.net/openbsd-on-the-vortex86dx-cpu/

Hardware

European Processor Initiative EPAC 1.0 RISC-V Test Chip Samples Delivered.
https://www.techpowerup.com/287033/european-processor-initiative-epac-1-0-risc-v-test-chip-samples-delivered

MIPS Becomes RISC-V.
https://www.eejournal.com/article/wait-what-mips-becomes-risc-v/

FreeBSD Adds NUMA Nodes into CPU Topology.
https://cgit.freebsd.org/src/commit/?id=ef50d5fbc39fc39970eab1234222b5ac1d9ba74c

Life

Mister Rogers Had Simple Set of Rules for Talking to Children.
https://www.theatlantic.com/family/archive/2018/06/mr-rogers-neighborhood-talking-to-kids/562352/

That Time I Told My Wife I Wanted to Quit My Job.
https://keygen.sh/blog/that-time-i-told-my-wife-i-wanted-to-quit-my-job/

File Not Found – Generation that Grew up with Google.
https://www.theverge.com/22684730/students-file-folder-directory-structure-education-gen-z

Why Are We Vaccinating Children Against COVID-19?
https://www.sciencedirect.com/science/article/pii/S221475002100161X

Other

New Malware Targets Windows Subsystem for Linux to Evade Detection.
https://thehackernews.com/2021/09/new-malware-targets-windows-subsystem.html

NMA Olympus 2207 (Fallout Mod) Review.
https://nma-fallout.com/threads/nma-olympus-2207-review.220745/

Man Steals $122 Million from Google/Facebook by Just Asking Them for Money.
https://www.ign.com/articles/2019/03/26/man-steals-122-million-from-google-and-facebook-by-just-asking-them-for-money

EOF

Valuable News – 2021/09/20

The Valuable News weekly series is dedicated to provide summary about news, articles and other interesting stuff mostly but not always related to the UNIX or BSD systems. Whenever I stumble upon something worth mentioning on the Internet I just put it here.

Today the amount information that we get using various information streams is at massive overload. Thus one needs to focus only on what is important without the need to grep(1) the Internet everyday. Hence the idea of providing such information ‘bulk’ as I already do that grep(1).

UNIX

Setting Up Hashicorp Vault on FreeBSD.
https://beerdy.io/2021/09/setting-up-hashicorp-vault-on-freebsd/

Custom ISO with bsdinstall(8) in FreeBSD.
https://amitabhkant.com/custom_iso_with_bsdinstall_in_freebsd/

Fixing Bufferbloat on Your Home Network with OpenBSD 6.2 or Newer.
https://www.pauladamsmith.com/blog/2018/07/fixing-bufferbloat-on-your-home-network-with-openbsd-6.2-or-newer.html

BSD Overview – GhostBSD 21.09.06.
https://www.youtube.com/watch?v=TXVYQxYFkhE

FreeBSD SSH Hardening.
https://gist.github.com/koobs/e01cf8869484a095605404cd0051eb11

OpenBSD Pledge and Unveil from Python.
https://nullprogram.com/blog/2021/09/15/

Linusrants – Collection of All Rants from Linus Torvalds on Linux Kernel.
https://github.com/corollari/linusrants

Using the FreeBSD RACK TCP Stack.
https://klarasystems.com/articles/using-the-freebsd-rack-tcp-stack/

AiryX OS Alpha 0.3PRE Quick Look.
https://www.youtube.com/watch?v=h3XzPBMaUyg

Meet Zyggy – Simple GUI for Basic ZFS Administration in Python.
https://pythonawesome.com/a-simple-gui-for-basic-zfs-administration-in-python/
https://github.com/manoeldesouza/zyggy

Time to Move on FreeBSD.
https://bugswriter.com/blog/time-to-move-on-freebsd/

The nq Queue Utilities Allow Creating Lightweight Job Queue Systems.
https://github.com/leahneukirchen/nq

Analyse of OpenBSD Kernel Lock Contention.
https://www.nmedia.net/tech.mpi.analyse.html

FreeBSD Now Allows Virtual Hugs!
https://lunduke.com/2021/06/freebsd-now-allows-hugs/

Signify – Portable Version of OpenBSD Tool to Sign and Verify Signatures on Files.
https://github.com/aperezdc/signify

Bareos 20.0.3 / 19.2.11 / 18.2.12 Maintenance Releases Available.
https://www.bareos.com/bareos-20-0-3-19-2-11-and-18-2-12/

LibreOffice 7.2.1 Now in the FreeBSD Ports (and Packages).
https://cgit.freebsd.org/ports/commit/?id=1388a453605c2162a8efd9c9d24a9b217419a04e

GNOME Will Prevent Theming Making Community Not Happy.
https://www.osnews.com/story/133955/gnome-to-prevent-theming-wider-community-not-happy/

BSD Now 420 – OpenBSD Makes Life Better.
https://www.bsdnow.tv/420

FreeBSD Announces 11.4-RELEASE End of Life on 2021/09/30.
https://lists.freebsd.org/pipermail/freebsd-announce/2021-September/002060.html

KDE Frameworks 5.86 Landed in the FreeBSD Ports.
https://kde.org/announcements/frameworks/5/5.86.0/

Plasma System Monitor and FreeBSD.
https://euroquis.nl//kde/2021/09/15/systemmonitor.html

Experimenting with New OpenBSD Development Lab.
https://dataswamp.org/~solene/2021-09-16-experiments-openbsd-building.html

FreeBSD Foundation – Technology Roadmap for FreeBSD.
https://freebsdfoundation.org/blog/technology-roadmap/

On FreeBSD OCI Containers.
https://akhramov.github.io/posts/2021-09-16-FreeBSD-OCI-jails.html

Yes of Course There is Now Malware for Windows Subsystem for Linux.
https://www.theregister.com/2021/09/17/windows_subsystem_for_linux_malware/

In Other BSDs for 2021/09/18.
https://www.dragonflydigest.com/2021/09/18/26174.html

OpenZFS 2.1.1 Released for FreeBSD 12.2-RELEASE+ and Linux 3.10-5.14.
https://github.com/openzfs/zfs/releases/tag/zfs-2.1.1

Benchmarking Compilation Time with ccache/mfs on OpenBSD.
https://dataswamp.org/~solene/2021-09-18-openbsd-ccache-mfs.html

What is the Deal with A/UX Anyways?
https://virtuallyfun.com/wordpress/2021/09/19/so-what-is-the-deal-with-a-ux-anyways/

Serving Netflix Video at 400Gb/s on FreeBSD.
https://people.freebsd.org/~gallatin/talks/euro2021.pdf

Ghost in the Shell – Part 7 – ZSH Setup.
https://vermaden.wordpress.com/2021/09/19/ghost-in-the-shell-part-7-zsh-setup/

SteamBSD – Something Different.
https://www.youtube.com/watch?v=pN2D_mwxXIc

Hardware

Boing Ball Badged – Dave Needle Tribute.
https://www.amigalove.com/viewtopic.php?f=5&t=1991
https://www.prolific.com/qwiki.cgi?mode=previewSynd&uuid=E1A3UTG5AA312379VFLE3W2C21QT
https://www.youtube.com/watch?v=Dv_LdSmNhds

First Look at Microchip PolarFire SoC FPGA Icicle RISC-V Development Board.
https://www.cnx-software.com/2021/09/17/microchip-polarfire-soc-icicle-fpga-risc-v-development-board-review/

ADLINK COM-HPC Ampere Altra 80 Core ARM Server Module.
https://www.cnx-software.com/2021/09/16/adlink-com-hpc-ampere-altra-80-core-arm-server-module-targets-embedded-applications/

AMD Stands Ready to Make ARM Chips.
https://www.osnews.com/story/133958/amd-we-stand-ready-to-make-arm-chips/

Life

Edward Snowden – Conspiracy – Theory and Practice.
https://edwardsnowden.substack.com/p/conspiracy-pt1

Please Stop Closing Forums and Moving People to Discord.
https://kotaku.com/please-stop-closing-forums-and-moving-people-to-discord-1847684851

Other

Q1K3 – HTML5/JavaScript Game inJ ust 13 kB.
https://js13kgames.com/entries/q1k3

Meet marginalia.nu Search Engine that Favors Text Heavy Sites and Punishes Modern Web Design.
https://search.marginalia.nu/

Windows 11 – Just Say No.
https://www.computerworld.com/article/3633630/windows-11-just-say-no.html

Hymn for the Winner – Robert Kubica.
https://youtu.be/r_s1w3Y43eA

Quote(s) of the Week

“I have never been ready 100% even when I was racing in my gold times.”
Robert Kubica

EOF

Ghost in the Shell – Part 7 – ZSH Setup

Today I would like to share with you my simple yet useful zsh(1) shell config that I use daily.

You may want to check other articles in the Ghost in the Shell series on the Ghost in the Shell – Global Page where you will find links to all episodes of the series along with table of contents for each episode’s contents.

I have been various UNIX and Linux systems since almost two decades. Through that time I was always looking for the best interactive shell out there. Obviously I have started with the bash(1) on Linux and it generally worked but bash(1) also did not impressed me at all. Just a shell. I have similar experiences with the ksh(1) shell. Today even the plain POSIX /bin/sh shell on FreeBSD has basic completion similar in many ways to what bash(1) or ksh(1) allows. The bash(1) shell gets little better when you install the bash-completion companion but its very limited still.

When I moved to FreeBSD I got to know its default tcsh(1)/csh(1) shell … which is PITA to use and scripting. Its pointless to learn limited CSH shell syntax in 2021. Omit it at any costs. After I settled a little in the FreeBSD wonderland I started to try other shells such as zsh(1) or fish(1) shells. I really liked fish(1) shell preconfigured setup and its defaults because it required literally zero effort to use it at its peak possibilities … but when I tried one of my typical use cases which is some commands | while read I; other command "${I}"; done it came to me that fish(1) is very limited shell and even does not support critical POSIX /bin/sh syntax! What a disappointment to say the last.

I abandoned the fish(1) shell and went to the zsh(1) which by default does not do more then a bash(1) shell and needs well thought configuration to be useful and powerful. After checking some guides and howtos about zsh(1) shell I started to create my own config and this was the interactive environment I was looking for. Of course I had several newbie problems or things that did not worked well for me like for example automatic completion of user home directories or UPPERCASE to lowercase automatic translation but after digging more into the zsh(1) config and man pages I finally settled with sensible and reasonable zsh(1) shell config.

I also tried various ready to use zsh(1) preconfigurations such as PowreLevel10k or Oh-My-Zsh but none of them really satisfied my while being kinda ‘blackbox’ with features that I do not really need. I really like to use things that I understand under the hood so I stayed with my quite simple yet fast loading config.

Why ZSH Shell Anyway?

Besides The Usual Suspects (really great movie by the way) like recursive search with [CTRL]+[R] for forward search and [CTRL]+[SHIFT]+[R] for reverse search – argument completion for most commands like shown below.

% tar -[TAB]
A  -- append to an archive
c  -- create a new archive
f  -- specify archive file or device
t  -- list archive contents
u  -- update archive
v  -- verbose output
x  -- extract files from an archive

The graphical example of that can be shown here. Of course I am not able to show [TAB] key there as I am able to add in the ‘text’ examples.

zsh-gstat

Interactive argument completion like showing the list of processes you can kill(1) by pressing the [TAB] key while being at kill(1) or killall(1) commands.

% kill -9 [TAB]
 9289  4  Ss+  0:00.62 -zsh (zsh)
16994  2  Is   0:00.28 -zsh (zsh)
17860  1  Is+  0:00.17 -zsh (zsh)
23797  3  Is+  0:00.23 -zsh (zsh)
30335  4  S+   0:00.01 -zsh (zsh)
32381  4  R+   0:00.00 ps
44994  0  Is+  0:00.50 -zsh (zsh)
59828  2  I+   0:00.02 /bin/sh /usr/bin/man zsh
65435  2  I+   0:00.05 less

Similar with the pkill(1) command when trying to autocomplete with ‘h‘ letter. The filter adds all running processes that have ‘h‘ letter in them – not only processes that start with the ‘h‘ letter.

zsh-pkill

There are also other more sophisticated completions like completioning the file name but not from the front but by the part of it … or by extension. Take a look at these two examples below. This is out directory listing that we will be using as an example here.

% exa -l
drwxr-xr-x - vermaden 2021-09-18 21:47 and a really PITA dir with spaces
.rw-r--r-- 0 vermaden 2021-09-18 21:54 huge.iso
.rw-r--r-- 0 vermaden 2021-09-18 21:46 really.async.example.txt
.rw-r--r-- 0 vermaden 2021-09-18 21:47 some-plain-file.txt

Three files and one directory with spaces in its name.

To autocomplete any of them with bash(1)you would have to start typing the file or dir name from the beginning. The fish(1) shell is on par with zsh(1) here as it would also support the thing that I want to show you.

First things first – the cd(1) command to change current working directory. Because there is only ONE directory there both zsh(1) and fish(1) shells would properly autocomplete the only once and a really PITA dir with spaces dir for the cd(1) command like shown below.

% exa -l
drwxr-xr-x - vermaden 2021-09-18 21:47 and a really PITA dir with spaces
.rw-r--r-- 0 vermaden 2021-09-18 21:54 huge.iso
.rw-r--r-- 0 vermaden 2021-09-18 21:46 really.async.example.txt
.rw-r--r-- 0 vermaden 2021-09-18 21:47 some-plain-file.txt

% cd [TAB]

// after pressing [TAB] once becomes this

% cd and\ a\ really\ PITA\ dir\ with\ spaces

The bash(1) (and csh(1)/tcsh(1) for the record) would obviously need to start from the first letter of any of those dir or files trying the really stupid completion method.

Now the second part about completion of files extensions or names in the middle of dirs or files. Both zsh(1) and fish(1) shells support that. Examples below.

% exa -l
drwxr-xr-x - vermaden 2021-09-18 21:47 and a really PITA dir with spaces
.rw-r--r-- 0 vermaden 2021-09-18 21:54 huge.iso
.rw-r--r-- 0 vermaden 2021-09-18 21:46 really.async.example.txt
.rw-r--r-- 0 vermaden 2021-09-18 21:47 some-plain-file.txt

% cat txt[TAB]

// NOW zsh(1) will show all files that have 'txt' string in it

% cat le.txt[TAB]

// AFTER SECOND [TAB] HIT IT WILL LIST THEM WITH MENU FEATURE (MORE ON THAT IN A MOMENT)

% cat really.async.example.txt[TAB]
really.async.example.txt  some-plain-file.txt

// NOW FIRST FILE WITH 'txt' IS USED - HIT [TAB] AGAIN TO SWITCH TO NEXT ONE

% cat some-plain-file.txt[TAB]
really.async.example.txt  some-plain-file.txt

// YOU CAN ALSO USE ARROW KEYS TO SELECT BETWEEN THEM - CHECK SCREENSHOT BELOW

Example of menu completion feature below.

zsh-menu-completion

Time to stop showing off and start to provide some useful content.

System Config

There are lots of guides and ideologies about how you spread your zsh(1) configuration between system wide config file and user customized ones like these:

  • /etc/zshenv
  • /etc/zprofil
  • /etc/zshrc
  • /etc/zlogin
  • /etc/zlogout
  • ~/.zshenv
  • ~/.zprofile
  • ~/.zshrc
  • ~/.zlogin
  • ~/.zlogout

My take? Lets not make some big issue about that. I really like simple sensible setups and I use zsh(1) as interactive shell so ‘system wide’ configuration is not crucial here. To make things as simple as possible I only use two of all of the above. The /usr/local/etc/zshrc for the ‘system wide’ part and ~/.zshrc for my ‘user’ part. Thats it. I have been doing that since more then a decade and it worked for me like a charm but as in every case your millage may vary here.

As there are too many Linuxisms out there assuming that you are using Ubuntu Linux or that bash(1) shell is always available as /bin/sh binary after 16 years of me using FreeBSD UNIX there for sure will several BSDisms but at least they are harmless and documented πŸ™‚

The /usr/local/etc/zshrc (or should I say /etc/zshrc on Linux and other then FreeBSD UNIX systems) is as follows.

# BASICS
  umask 022
  export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
  export EDITOR=vi
  export PAGER=less

# USE ftp(1) PASSIVE MODE
  export FTP_PASSIVE_MODE=1

# DISABLE less(1) HISTORY
  export LESSHISTSIZE=0

# IMITATE sockstat(1) ON LINUX
  case $( uname ) in
    (Linux) alias sockstat="netstat -lnptu --protocol=inet,unix" ;;
  esac

# ZSH HISTORY
  export HISTSIZE=655360
  export HISTFILE="${HOME}/.zhistory"
  export SAVEHIST=${HISTSIZE}

# ZSH HISTORY SEARCH
  bindkey -M vicmd '/' history-incremental-pattern-search-backward
  bindkey -M vicmd '?' history-incremental-pattern-search-forward

# ZSH HISTORY SEARCH FOR vi(1) INSERT MODE
  bindkey -M viins '^R' history-incremental-pattern-search-backward
  bindkey -M viins '^F' history-incremental-pattern-search-forward

# ZSH HISTORY MAPPINGS
  bindkey '^[[A' up-line-or-search
  bindkey '^[[B' down-line-or-search
  bindkey "^R" history-incremental-search-backward

# ZSH USE SHIFT-TAB FOR REVERSE COMPLETION
  bindkey '^[[Z' reverse-menu-complete

# ZSH LAST ARG FROM EARLIER COMMAND WITH [ALT]-[.]
  bindkey '\e.' insert-last-word

# ZSH BEGIN/END OF LINE
  bindkey "^A" beginning-of-line
  bindkey "^E" end-of-line

# KEY BINDINGS
  case "${TERM}" in
    (cons25*|linux)
      # PLAIN BSD/LINUX CONSOLE
      bindkey '\e[H'    beginning-of-line   # HOME
      bindkey '\e[F'    end-of-line         # END
      bindkey '\e[5~'   delete-char         # DELETE
      bindkey '[D'      emacs-backward-word # ESC+LEFT
      bindkey '[C'      emacs-forward-word  # ESC+RIGHT
      ;;
    (*rxvt*)
      # RXVT DERIVATIVES
      bindkey '\e[3~'   delete-char         # DELETE
      bindkey '\eOc'    forward-word        # CTRL+RIGHT
      bindkey '\eOd'    backward-word       # CTRL+LEFT
      # RXVT WORKAROUND FOR screen(1) UNDER urxvt(1)
      bindkey '\e[7~'   beginning-of-line   # HOME
      bindkey '\e[8~'   end-of-line         # END
      bindkey '^[[1~'   beginning-of-line   # HOME
      bindkey '^[[4~'   end-of-line         # END
      ;;
    (*xterm*)
      # XTERM DERIVATIVES
      bindkey '\e[H'    beginning-of-line   # HOME
      bindkey '\e[F'    end-of-line         # END
      bindkey '\e[3~'   delete-char         # DELETE
      bindkey '\e[1;5C' forward-word        # CTRL+RIGHT
      bindkey '\e[1;5D' backward-word       # CTRL+LEFT
      # XTERM WORKAROUND FOR screen(1) UNDER xterm(1)
      bindkey '\e[1~'   beginning-of-line   # HOME
      bindkey '\e[4~'   end-of-line         # END
      ;;
    (screen)
      # GNU SCREEN
      bindkey '^[[1~'   beginning-of-line   # HOME
      bindkey '^[[4~'   end-of-line         # END
      bindkey '\e[3~'   delete-char         # DELETE
      bindkey '\eOc'    forward-word        # CTRL+RIGHT
      bindkey '\eOd'    backward-word       # CTRL+LEFT
      bindkey '^[[1;5C' forward-word        # CTRL+RIGHT
      bindkey '^[[1;5D' backward-word       # CTRL+LEFT
      ;;
  esac

# ZSH COMPLETION CASE (IN)SENSITIVE
# zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'

# ZSH DISABLE USER COMPLETION FOR THESE NAMES
  zstyle ':completion:*:*:*:users' ignored-patterns \
    dladm dbus distcache dovecot list ftp games gdm gkrellmd gopher gnats \
    adm amanda apache avahi backup beaglidx bin cacti canna clamav daemon \
    sshd sync sys syslog uucp vcsa smmsp svctag upnp unknown webservd xfs \
    listen mdns fax mailman mailnull mldonkey mysql man messagebus netadm \
    hacluster haldaemon halt hsqldb mail junkbust ldap lp irc xvm libuuid \
    nscd ntp nut nx ident openldap operator pcap pkg5srv postfix postgres \
    netcfg nagios noaccess nobody4 openvpn named netdump nfsnobody nobody \
    proxy privoxy pulse pvm quagga radvd rpc rpcuser shutdown statd squid \
    www-data news nuucp zfssnap rpm '_*'

# ZSH COMPLETION OPSTIONS
  zstyle ':completion:*' completer _expand _complete _correct _approximate _history
  zstyle ':completion:*' matcher-list '' '' 'l:|=* r:|=*' 'l:|=* r:|=*'
  zstyle ':completion:*' list-colors ''
  zstyle ':completion:*' users root
  zstyle ':completion:*' menu select
  zstyle :compinstall filename '~/.zshrc'
  autoload -Uz compinit
  autoload -U colors && colors
  compinit

# ZSH OTHER FEATURES
  unsetopt beep
  setopt no_beep
  setopt nohashdirs
  setopt extended_glob
  setopt auto_cd
  setopt auto_menu
  setopt list_rows_first
  setopt multios
  setopt hist_ignore_all_dups
  setopt append_history
  setopt inc_append_history
  setopt hist_reduce_blanks
  setopt always_to_end
  setopt no_hup
  setopt complete_in_word
  limit coredumpsize 0

# ZSH zshcontrib(1) zmv
  autoload zmv
  alias zmv_to_lower='zmv      "*" "\${(L)f}"'
  alias zmv_to_upper='zmv      "*" "\${(U)f}"'
  alias zmv_to_capital='zmv    "*" "\${(C)f}"'
  alias zmv_to_hypen='zmv      "*" "\$f:gs/ /-/"'
  alias zmv_to_underscore='zmv "*" "\$f:gs/ /_/"'

# COLOR grep(1)
  export GREP_COLOR='1;32'
  export GREP_COLORS='1;32'
  export GREP_OPTIONS='--color=auto'
  alias grep='grep --color'
  alias egrep='egrep --color'

# FreeBSD ifconfig(8) CIDR NOTATION
  export IFCONFIG_FORMAT=inet:cidr

# SET ls(1) COLORS
  export LSCOLORS='exExcxdxcxexhxhxhxbxhx'
  export LS_COLORS='no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32'

# DISABLE XON/XOFF FLOW CONTROL (^S/^Q)
  stty -ixon

# COLOR LIST
# 30 - black     # 34 - blue
# 31 - red       # 35 - magenta
# 32 - green     # 36 - cyan
# 33 - yellow    # 37 - white

# COLOR PROMPT
  cSRV="%F{magenta}"
  case $( whoami ) in
    (root)
      cUSR="%F{red}"
      cPMT="%F{red}"
      ;;
    (*)
      cUSR="%F{green}%B"
      cPMT=""
      ;;
  esac
  cTIM="%F{cyan}%B"
  cPWD="%F{magenta}%B"
  cSTD="%b%f"
  export PS1="$cTIM%T$cSTD $cSRV%m$cSTD $cUSR%n$cSTD $cPWD%~$cSTD $cPMT%#$cSTD "
  export PS2="$cTIM%T$cSTD $cUSR>$cSTD $cPWD"

# SET PROPER ENCODINGS
  case ${TERM} in
    (cons25*) export LC_ALL=en_US.ISO8859-1 ;;
    (*)       export LC_ALL=en_US.UTF-8     ;;
  esac

# ALIASES
  alias rehash='hash -r'
  alias make='env LANG=C LC_ALL=C make'
  alias h='history'
  alias c='clear'
  alias vim='vim -i NONE'
  alias fetch='fetch -Rr --no-verify-peer --no-verify-hostname'
  alias wget='wget -c -t 0'

# LS/GLS/EXA
  case $( uname ) in
    (FreeBSD)
      if /usr/bin/env which exa 1> /dev/null 2> /dev/null
      then
        alias bls='/bin/ls -p -G -D "%Y.%m.%d %H:%M"'
        alias gls='gls -p --color=always --time-style=long-iso --group-directories-first --quoting-style=literal'
        alias ls='exa --time-style=long-iso --group-directories-first'
      elif /usr/bin/env which gls 1> /dev/null 2> /dev/null
      then
        alias bls='/bin/ls -p -G -D "%Y.%m.%d %H:%M"'
        alias ls=' gls -p --color=always --time-style=long-iso --group-directories-first --quoting-style=literal'
      else
        alias ls=' /bin/ls -p -G -D "%Y.%m.%d %H:%M"'
      fi
      ;;
    (OpenBSD)
      export PKG_PATH=http://ftp.openbsd.org/pub/OpenBSD/$( uname -r )/packages/$( uname -m )/
      [ -e /usr/local/bin/colorls ] && alias ls='/usr/local/bin/colorls -G'
      ;;
    (Linux)
      if /usr/bin/env which exa 1> /dev/null 2> /dev/null
      then
        alias gls='ls -p --color=always --time-style=long-iso --group-directories-first --quoting-style=literal'
        alias ls='exa --time-style=long-iso --group-directories-first'
      else
        alias ls='ls -p --color=always --time-style=long-iso --group-directories-first --quoting-style=literal'
      fi
      ;;
  esac
  alias la='ls -A'
  alias ll='ls -l'
  alias exa='exa --time-style=long-iso --group-directories-first'

If for any reason WordPress would mess the above config up here is the plain text version – https://raw.githubusercontent.com/vermaden/scripts/master/zshrc – available from my GitHub scripts repository.

While its comments generally say a lot about that is happening there I will also add several notes here.

I have left disabled the UPPERCASE from/to lowercase transparent translation because while it helped at about 10% of times it really pissed me off with pointless autocomplete suggestions the 90% of the time. If your work/complete schema is different the enable and test it. Maybe it will suit you better then me. Below is the part I am talking about – in enabled form.

# ZSH COMPLETION CASE (IN)SENSITIVE
  zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'

At the end of the config you will find ‘casting’ for the best ls(1) solution existing in a system. After trying various listing commands such as:

  • FreeBSD ls(1) command
  • Linux ls(1) (known as gls(1) under FreeBSD)
  • New exa(1) command
  • New lsd(1) command

I have abandoned lsd(1) as besides colors its close to useless to use exa(1) as primary listing command. The second one that I recommend (that may be a surprise to FreeBSD users) would be the Linux ls(1) command from sysutils/coreutils package on FreeBSD. The last ‘resort’ command would be the FreeBSD ls(1) command as documented in the config. Why you should ask? The answer is quite simple – the directory listing. Both exa(1) and gls(1) have options to list directories (and what is more important SYMLINKS to directories) first. The FreeBSD ls(1) not only does not list symlinks to directories first – it also treat any directory as any other object and just list directories and symlinks put somewhere there withing all other files. Its unacceptable for me. Its just a messy pointless output. As much as I like and respect FreeBSD UNIX this is just plain fucking stupid. No matter how much history is in it.

Here is the comparison between them. I also wanted to show you the long listing (with -l option obviously) but its the same ‘not dirs first’ behavior for the FreeBSD ls(1) so not need for that.

zsh.ls

User Config

I will not add the ‘user’ part of my zsh(1) config and add some comments below.

# IMPORT DOAS/SUDO
  if [ -f ~/.zshrc.DOAS.SUDO ]
  then
    source ~/.zshrc.DOAS.SUDO
  else
    echo "NOPE: file ~/.zshrc.DOAS.SUDO absent."
  fi

# BASICS
  export PATH=${PATH}:~/scripts:~/scripts/bin:~/.cargo/bin
  export EDITOR=vi
  export VISUAL=vi
  export BROWSER=firefox
  export MANWIDTH=tty
  export ENV=${HOME}/.shrc
  export IFCONFIG_FORMAT=inet:cidr
  export LC_COLLATE=C

# BASICS DESKTOP
  export DISPLAY=:0
  export MOZ_DISABLE_IMAGE_OPTIMIZE=1
  export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on'
  export NO_AT_BRIDGE=1

# ENABLE ICONS IN exa(1)
  case ${TERM} in
    (rxvt)   : ;;
    (xterm*) : ;;
    (*)      alias exa='exa --icons' ;;
  esac

# ALIASES
  alias Grep=grep
  alias grpe=grep
  alias grepMAC='grep -i -E "[0-9a-f]{2}\:[0-9a-f]{2}\:[0-9a-f]{2}\:[0-9a-f]{2}\:[0-9a-f]{2}\:[0-9a-f]{2}"'
  alias grepIP='grep -E "([0-9]+\.){3}[0-9]+"'
  alias cls='printf "\033[H\033[J"'
  alias e=exa
  alias bat='bat --color=always'
  alias x='xinit ~/.xinitrc -- -dpi 75 -nolisten tcp 1> /dev/null 2> /dev/null'
  alias ffmpeg='ffmpeg -hide_banner'
  alias mupdf='mupdf -r 120'
  alias tac='tail -r'
  alias lsof='lsof -w'
  alias less='less -r --chop-long-lines'
  alias more='less -r --chop-long-lines'
  alias pstree='pstree -g 2'
  alias lupe='lupe -noshape -mag 2 -nohud -geometry 300x200 -noreticle -noiff'
  alias parallel='parallel --no-notice --progress -j 3'
  alias pv='pv -t -r -a -b -W -B 1048576'
  alias caja='caja --browser --no-desktop'
  alias evince=atril
  alias we="curl -4 http://wttr.in/Lodz\?Q\?n 2> /dev/null | sed '\$d' | sed '\$d'"
  alias cclive='cclive -c'
  alias yu='youtube-dl -c -i -f best --skip-unavailable-fragments'
  alias aria2c='aria2c --file-allocation=none'
  alias dig=drill
  alias cssh='cssh -o "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"'
  alias ssh='ssh -o LogLevel=quiet -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
  alias feh="feh --scale-down \
                 --auto-rotate \
                 --auto-zoom \
                 --fontpath ~/.fonts \
                 --font       ubuntu/8 \
                 --menu-font  ubuntu/8 \
                 --title-font ubuntu/8"
  alias wget='wget -c --no-check-certificate \
                   -U "Opera/12.16 (X11; FreeBSD 13.0 amd64; U; en) Presto/3 Version/12"'
  alias scp='scp -o ControlMaster=yes \
                 -o ControlPath=/tmp/%r@%h:%p \
                 -o UserKnownHostsFile=/dev/null \
                 -o StrictHostKeyChecking=no'

# SHORT HISTORY ALIASES h() H()
  alias h='< ~/.zhistory grep -i'
  alias H='< ~/.zhistory grep'

# SHORT GREP FUNCTIONS
  alias g='grep -i'
  alias G='grep'

# SHORT QUERY FUNCTIONS q()
  q() {
    if [ ${#} -eq 1 ]
    then
      /bin/ls | grep --color -i ${1} 2> /dev/null
    else
      echo "usage: q string"
    fi
  }

# SHORT QUERY FUNCTIONS Q()
  Q() {
    if [ ${#} -eq 1 ]
    then
      /bin/ls | grep --color ${1} 2> /dev/null
    else
      echo "usage: Q string"
    fi
  }

# SHORT QUERY FUNCTIONS qq()
  qq() {
    if [ ${#} -eq 1 ]
    then
      find . \
        | grep -i ${1} 2> /dev/null \
        | cut -c 3-999 \
        | grep --color -i ${1} 2> /dev/null
    else
      echo "usage: qq string"
    fi
  }

# SHORT QUERY FUNCTIONS QQ()
  QQ() {
    if [ ${#} -eq 1 ]
    then
      find . \
        | grep ${1} 2> /dev/null \
        | cut -c 3-999 \
        | grep --color ${1} 2> /dev/null
    else
      echo "usage: QQ string"
    fi
  }

# FUNTIONS / INTELIGENT CD()
  dc() {
    if [ -f "${@}" ]
    then
      cd "${@%/*}"
      return 0
    fi

    if [ -d "${@}" ]
    then
      cd "${@}"
      return 0
    fi

    echo "${0}: no such file or directory: ${@}"
    return 1
  }

# FUNTIONS / PORTS / ports-check()
  ports-check() {
    CUT='Major OS version upgrade detected.'
  # ${CMD} nice -n 20 portsnap auto
    ${CMD} nice -n 20 gitup ports
    echo
    ${CMD} nice -n 20 portmaster -L --index-only \
      | grep -v "${CUT}" \
      | awk '/ [Nn]ew / { print substr($0,9,9999) }'
    echo
    VULNS=$( ${CMD} pkg audit -F 2>&1 | grep ' vulnerable' | sort -u | sed 's/\ is\ vulnerable://g' )
    echo Vulnerabilities:
    if [ "${VULNS}" = "" ]
    then
      echo None.
    else
      echo "${VULNS}"
    fi
    echo
    pkg updating \
      -d $( date -j -f "%s" "$( pkg query -a %t | grep -v "${CUT}" | sort | tail -1 )" "+%Y%m%d" )
  }

# FUNTIONS / PORTS / ports-rebuild()
  ports-rebuild() {
    # OPTIONS
    local PORTS='multimedia/ffmpeg'
  # local PORTS='multimedia/ffmpeg audio/lame sysutils/exfat-utils sysutils/fusefs-exfat'

    for PORT in ${PORTS}
    do
      ${CMD} pkg unlock -y ${PORT} 1> /dev/null 2> /dev/null
      ${CMD} idprio 10 env BATCH=yes DISABLE_VULNERABILITIES=yes make -C /usr/ports/${PORT} build deinstall install clean &
      MAKE=${!}
      ${CMD} rctl -a process:${MAKE}:pcpu:deny=40
      ${CMD} wait ${MAKE}
    # ${CMD} pkg lock -y ${PORT}
    done
  }

# FUNTIONS / PORTS / ports-build()
  ports-build() {
    case ${#} in
      (0) ${CMD} nice -n 20 portmaster -y --no-confirm -m 'BATCH=yes' -d -a ;;
      (*) ${CMD} nice -n 20 portmaster -y --no-confirm -m 'BATCH=yes' -d $@ ;;
    esac
    ${CMD} nice -n 20 find /var/db/pkg -type d -depth 1 -exec rm -rf {} ';' 2> /dev/null
  }

# FUNTIONS / PKG / pkg-defunct()
  pkg-defunct() {
    pkg version -Rl\? | cut -wf1
  }

# FUNTIONS / PORTS / pkg-version()
  pkg-version() {
    pkg version -I -l '<' | awk '{print $1}'
  }

# FUNTIONS / PORTS / pkg-size()
  pkg-size() {
    pkg info -as | sort -k 2 -h | tail -100
  }

# FUNTIONS / BMI
  bmi() { # 1=HEIGHT 2=WEIGHT
    if [ ${#} -ne 2 ]
    then
      echo "usage: $( basename ${0} ) HEIGHT WEIGHT"
      echo
      echo "table:"
      echo "  UNDER WEIGHT   LESS - 18.4"
      echo "  NORMAL WEIGHT  18.5 - 24.9"
      echo "  OVER WEIGHT    25.0 - 29.9"
      echo "  OBESITY        30.0 - MORE"
      echo
      return 1
    fi
    local BMI=$( echo "${2} / ( ${1} * ${1} ) * 10000" | bc -l )
    printf "%.1f\n" "${BMI}"
  }

# FUNTIONS / BFP
  bfp() {
    if [ ${#} -ne 4 ]
    then
      echo "usage: $( basename ${0} ) HEIGHT WEIGHT AGE SEX"
      echo
      echo "SEX: f - female"
      echo "     m - male"
      return 1
    fi
    case ${4} in
      (m) SEX=1 ;;
      (f) SEX=0 ;;
    esac
    local BMI=$( echo "${2} / ( ${1} * ${1} ) * 10000" | bc -l )
    local BFP=$( echo "( 1.2 * ${BMI} ) + ( 0.23 * ${3} ) - ( 10.8 * ${SEX} ) - 5.4" | bc -l )
    printf "%.1f%%\n" "${BFP}"
  }

# FUNTIONS / BMR
  bmr() {
    if [ ${#} -ne 3 ]
    then
      echo "usage: $( basename ${0} ) WIEGHT HEIGHT AGE"
      echo
      return 1
    fi
    local RESULT=$( echo "( 10 * ${1} ) + ( 6.25 * ${2} ) - ( 5 * ${3} ) + 5" | bc -l )
    if echo ${RESULT} | grep -q '^\.'
    then
      echo -n 0
    fi
    echo ${RESULT} | awk -F '.' '{print $1}'
  }

# FUNTIONS / MATH
  math() {
    local SCALE=2
    local INPUT=$( echo "${@}" | tr 'x' '*' | tr ',' '.' )
    local RESULT=$( echo "scale=${SCALE}; ${INPUT}" | bc -l )
    if echo ${RESULT} | grep -q '^\.'
    then
      echo -n 0
    fi
    echo ${RESULT}
  }

# FUNTIONS / MAH2WH
  conv_mah_2_wh() {
    if [ ${#} -ne 2 ]
    then
      echo "usage: $( basename ${0} ) mAh V"
      echo
      return 1
    fi
    local MAH2WH=$( echo "${1} * ${2} / 1000" | bc -l )
    printf "%.1f Wh\n" "${MAH2WH}"
  }

# FUNTIONS / WH2MAH
  conv_wh_2_mah() {
    if [ ${#} -ne 2 ]
    then
      echo "usage: $( basename ${0} ) Wh V"
      echo
      return 1
    fi
    local WH2MAH=$( echo "${1} / ${2} * 1000" | bc -l )
    printf "%.1f mAh\n" "${WH2MAH}"
  }

# FUNTIONS / CM2IN
  conv_cm_2_in() {
    if [ ${#} -ne 1 ]
    then
      echo "usage: $( basename ${0} ) INCH"
      echo
      return 1
    fi
    local CM=$( echo "${1} / 2.54" | bc -l )
    printf "%.1f cm EQUALS %.1f inch(es)\n" "${1}" "${CM}"
  }

# FUNTIONS / IN2CM
  conv_in_2_cm() {
    if [ ${#} -ne 1 ]
    then
      echo "usage: $( basename ${0} ) INCH"
      echo
      return 1
    fi
    local INCH=$( echo "${1} * 2.54" | bc -l )
    printf "%.1f inch(es) EQUALS %.1f cm\n" "${1}" "${INCH}"
  }

# FUNTIONS / REMOVE SSH known_hosts KEY
  ssh_known_hosts_key_remove() {
    if [[ -z "${1}" ]]
    then
      echo "usage: ${0} [host]"
      echo "  Removes specified host from ~/.ssh/known_hosts file."
    else
      sed -i '' -e "/${1}/d" ${HOME}/.ssh/known_hosts
    fi
  }

# FUNTIONS / CAL
  cal() {
    if which gcal 1> /dev/null 2> /dev/null
    then
      local TEST="${@}"
      if [ "${TEST}" = "-3" ]
      then
        gcal -s 1 .  | sed 1,2d | sed 3d
      else
        gcal -s 1 ${@}
      fi
    else
      cal ${@}
    fi
  }

# FUNTIONS / DAY
  day() {
    if [ ${#} -eq 0 ]
    then
      echo "usage: ${0##*/} DAY-OF-MONTH"
      return 1
    fi
    cal $( date +%Y ) \
      | env GREP_COLOR="07;32" grep --color=always -EC 6 " $1 |^$1 | $1\$" \
      | env GREP_COLOR="07;33" grep --color=always -B2 -A6 -E 'Mo|Tu|We|Th|Fr|Sa|Su' \
      | grep -v -- --;
  }

# FUNTIONS / SSH-COPY-ID
  if ! which ssh-copy-id 1> /dev/null 2> /dev/null
  then
    ssh-copy-id() {
      echo 'INFO: ssh-copy-id(1) is not available'
      echo 'HINT: cat ~/.ssh/id_rsa.pub | ssh USER@HOST "cat >> ~/.ssh/authorized_keys"'
    }
  fi

If for any reason WordPress would mess the above config up here is the plain text version – https://raw.githubusercontent.com/vermaden/scripts/master/DOT.zshrc – available from my GitHub scripts repository.

I will not try to describe more useful parts of it. There are tons of aliases there from which these are more interesting ones.

Quickly grep(1) for IP or MAC address with grepIP or grepMAC functions respectively.

While most folks out there recommend the [CTRL]+[L] shortcut I really rarely use it. I know it and I generally advocate for those old UNIX shortcuts but for some reason the right [CTRL] key on my keyboard can not exist. I just do not use it at all. Its like in new condition on any keyboard I use. I should swap [CTRL] keys every quarter to make them look similarly used πŸ™‚

Because of that I often use ‘c‘ shortcut to clear the screen. As I was forced to use Windows in my earlier employer I also had The Microsoft equivalent for clearing the terminal – the cls command – thus you will also find an alias for that in my config – so called muscle memory is still strong πŸ™‚

Other aliases just have some arguments that are useful to add in 95% of cases.

Now some comment on the functions. There are for sure the Short Query Functions that I described in my Ghost in the Shell series. There is also additional dc alias to take me into directory where a file is. For example I have full path file under my X11 PRIMARY BUFFER. For example its /home/vermaden/gfx/wallpapers/amiga-500-grey.png value. I can now type cd and paste that buffer and then remove the amiga-500-grey.png characters with [BACKSPACE] key or type dc and then paste /home/vermaden/gfx/wallpapers/amiga-500-grey.png value and hit [ENTER] key. That alias(1) will now take me to the /home/vermaden/gfx/wallpapers/ dir.

There are several FreeBSD related commands also. Both pkg(8) or FreeBSD Ports related.

There are several that are health related such as BMI/BFP/BMR calculations that I sometimes use.

I really like the (and often use) the math function as it has the best of both worlds – the expr(1) and bc(1) commands.

There are also several functions related to conversions like converting the battery capacities between the Wh and mAh values or inches to centimeters conversions.

Similarly to the FreeBSD ls(1) command I also prefer to use the Linux (or should I say GNU) version of cal(1) command (known as gcal(1) in FreeBSD).

I also sometimes use the day function to highlight the exact day in the context of full year. Sometimes (quite rarely but still) its useful to know each occurrence of the 19 day of each month in current year. Below you will find screenshot with example.

zsh-day

You probably noticed the ~/.zshrc.DOAS.SUDO file at the beginning. Its about the detection of both sudo(8) and doas(1) supervisor commands. I prefer the more secure and simpler doas(1) command so when both are detected in the system then the doas(1) will be chosen as the right one.

Here are the ~/.zshrc.DOAS.SUDO contents.

% cat ~/.zshrc.DOAS.SUDO
SUDO_WHICH=0
SUDO=0
DOAS_WHICH=0
DOAS=1
ROOT=0

# CHECK doas(8) WITH which(1)
if which doas 1> /dev/null 2> /dev/null
then
  DOAS_WHICH=1
else
  DOAS_WHICH=0
fi

# CHECK sudo(8) WITH which(1)
if which sudo 1> /dev/null 2> /dev/null
then
  SUDO_WHICH=1
else
  SUDO_WHICH=0
fi

# CHECK USER WITH whoami(1)
if [ "$( whoami )" = "root" ]
then
  ROOT=1
fi

# CHOOSE ONE FROM doas(8) AND sudo(8)
if [ ${DOAS_WHICH} -eq 1 -o ${SUDO_WHICH} -eq 1 ]
then
  if [   ${DOAS} -eq 0 -a ${SUDO} -eq 1 -a ${SUDO_WHICH} -eq 1 ]
  then
    CMD=sudo
  elif [ ${DOAS} -eq 1 -a ${SUDO} -eq 0 -a ${DOAS_WHICH} -eq 1 ]
  then
    CMD=doas
  elif [ ${DOAS} -eq 1 -a ${SUDO} -eq 1 -a ${DOAS_WHICH} -eq 1 ]
  then
    CMD=doas
  fi
elif [ ${ROOT} -eq 1 ]
then
  CMD=''
else
  echo "NOPE: This script needs 'doas' or 'sudo' to work properly."
  exit 1
fi

unset SUDO_WHICH
unset DOAS_WHICH
unset ROOT

If for any reason WordPress would mess the above config up here is the plain text version – https://raw.githubusercontent.com/vermaden/scripts/master/DOT.zshrc.DOAS.SUDO – available from my GitHub scripts repository.

Summary

As the zsh(1) shell is very configurable there are probably at least dozen guides that make it better then me and in more depth but I just wanted to share all these with you as many of you asked what I actually use as my daily shell ‘driver’ setup.

Maybe you will be able to show me some other interesting zsh(1) tips that would make it even more productive setup πŸ™‚

EOF

Valuable News – 2021/09/13

The Valuable News weekly series is dedicated to provide summary about news, articles and other interesting stuff mostly but not always related to the UNIX or BSD systems. Whenever I stumble upon something worth mentioning on the Internet I just put it here.

Today the amount information that we get using various information streams is at massive overload. Thus one needs to focus only on what is important without the need to grep(1) the Internet everyday. Hence the idea of providing such information ‘bulk’ as I already do that grep(1).

UNIX

ZFS is Mysteriously Eating My CPU.
https://www.brendangregg.com/blog/2021-09-06/zfs-is-mysteriously-eating-my-cpu.html

Switching to i3 Window Manager.
https://vincent.bernat.ch/en/blog/2021-i3-window-manager

OPNsense 21.7.2 Released.
https://forum.opnsense.org/index.php?topic=24648.0

FreeBSD 13.0-RELEASE on Microsoft Azure Marketplace.
https://azuremarketplace.microsoft.com/en-US/marketplace/apps/thefreebsdfoundation.freebsd-13_0

Saving restic Backup the Hard Way.
http://blog.pkh.me/p/30-saving-a-restic-backup-the-hard-way.html

Nice Tool htmlq Similar to jq But for HTML.
https://github.com/mgdm/htmlq

Klara Systems – Understanding ZFS Channel Programs.
https://klarasystems.com/articles/understanding-zfs-channel-programs/

GhostBSD 21.09.06 ISO Images Available.
https://www.opensourcefeed.org/ghostbsd-20210906-release/

AWK – Power and Promise of 40 Year Old Language.
https://www.fosslife.org/awk-power-and-promise-40-year-old-language

GhostBSD 21.09.06 ISO Now Available.
https://ghostbsd.org/ghostbsd_21.09.06_iso_now_available

Quick Fix – GhostBSD 21.09.08 ISO Now Available.
https://www.ghostbsd.org/ghostbsd_21.09.08_iso_now_available

GhostBSD 21.09.06 Released – FreeBSD Based Desktop OS.
https://www.phoronix.com/scan.php?page=news_item&px=GhostBSD-21.09.06-Released

Unlocking UVM Faults Yields Significant Performance Boost on OpenBSD.
https://undeadly.org/cgi?action=article;sid=20210908084117

BSD Weekly – Issue 83.
https://bsdweekly.com/issues/83

OmniOS r151038 Release Notes.
https://github.com/omniosorg/omnios-build/blob/r151038/doc/ReleaseNotes.md

GhostBSD – Simple and Elegant Desktop BSD Operating System.
https://www.youtube.com/watch?v=gleK6huIO4s

GhostBSD 2021.09.08 Review – Stable and Able.
https://www.youtube.com/watch?v=ix_FGur-VEw

Comparing FreeBSD GELI and OpenZFS Encrypted Pools with Keys.
https://rubenerd.com/my-first-prod-encrypted-openzfs-pool/

BSD Now 419 – Rethinking OS Installs.
https://www.bsdnow.tv/419

Comparing FreeBSD GELI and OpenZFS Encrypted Pools with Keys.
https://rubenerd.com/my-first-prod-encrypted-openzfs-pool/

In Other BSDs for 2021/09/11.
https://www.dragonflydigest.com/2021/09/11/26157.html

I Got the J Language Working on OpenBSD.
https://briancallahan.net/blog/20210911.html

Create VLAN Only Interface in OPNsense.
https://homenetworkguy.com/how-to/create-vlan-only-interface-opnsense/

Live Coding – String Handling with Golang in FreeBSD.
https://www.jeremymorgan.com/videos/programming/golang/live-coding-string-handling-with-golang-in-freebsd/

CultBSD (Mate) PRE-ALPHA4 Cursory Glance.
https://www.youtube.com/watch?v=prpwmDcvb5c

Ghost in the Shell – Part 6 – Learn Shell Scripting.
https://vermaden.wordpress.com/2021/09/13/ghost-in-the-shell-part-6-learn-shell-scripting/

Hardware

KDE Slimbook – Best Way to Run KDE.
https://www.osnews.com/story/133880/kde-slimbook-the-best-way-to-run-kde/

Does AMD Chiplet Have Core Count Limit?
https://www.anandtech.com/show/16930/does-an-amd-chiplet-have-a-core-count-limit

iBASE MI989 – AMD Ryzen V2000 MiniITX Motherboard with PCIe x16 and M.2 Expansions.
https://www.cnx-software.com/2021/09/08/ibase-mi989-5g-ready-ryzen-v2000-mini-itx-motherboard-offers-pcie-x16-m-2-expansion/

Ampere Altra Max M128-30 128 Core ARM CPU.
https://www.servethehome.com/ampere-altra-max-m128-30-128-core-arm-cpu-in-the-wild/

Unlike POWER9 IBM New POWER10 CPUs Are Not Completely Open Source.
https://www.osnews.com/story/133931/unlike-power9-ibms-new-power10-processors-are-not-completely-open-source/

Next Gen NVMe SD Card Review – SM2708 Controller Serves it Hot and Fast.
https://www.anandtech.com/show/16938/silicon-motion-sm2708-sd-express-review-nvme-ssd-served-hot

Emulating AMD Approximate Arithmetic Instructions on Intel.
https://robert.ocallahan.org/2021/09/emulating-amd-rsqrtss-etc-on-intel.html

Beam Spring 104+SSK Reproduction Project.
https://deskthority.net/viewtopic.php?f=50&p=491832

Life

Australia New Mass Surveillance Mandate.
https://digitalrightswatch.org.au/2021/09/02/australias-new-mass-surveillance-mandate/

20 Years After 9/11 – Will We Ever Stop Taking Off Shoes at Airports?
https://www.ocregister.com/2021/09/07/20-years-after-9-11-will-we-ever-stop-taking-our-shoes-off-at-airports/

Boys More at Risk from Pfizer Jab Side Effect than Covid – Study Suggests.
https://www.theguardian.com/world/2021/sep/10/boys-more-at-risk-from-pfizer-jab-side-effect-than-covid-suggests-study

Facebook Censored Me for Mentioning Open Source Social Network Mastodon.
https://changelog.complete.org/archives/10285-facebook-censored-me-for-mentioning-open-source-social-network-mastodon

Top Human Rights Lawyer on ‘US Hubris’ of 9/11.
https://www.exberliner.com/features/people/wolfgang-kaleck-us-hubris/

The Greatest Regret of My Life.
https://edwardsnowden.substack.com/p/9-12

Social Networks – Its Worse than You Think.
https://meta.ath0.com/2020/12/social-notwork/

Other

ProtonMail Deletes ‘We Do Not Log Your IP’ from Their Page.
https://www.theregister.com/2021/09/07/protonmail_hands_user_ip_address_police/

Oracle SQL is The Devil.
https://codingtofreedom.com/oracle-sql-is-the-devil/

In Case You Asked – Hacker News Runs on FreeBSD.
https://news.ycombinator.com/item?id=16076041

Mozilla Defeated Microsoft Default Browser Protections in Windows.
https://www.theverge.com/2021/9/13/22671182/mozilla-default-browser-windows-protections-firefox

Trademark Actions Against the PostgreSQL Community.
https://www.postgresql.org/about/news/trademark-actions-against-the-postgresql-community-2302/

EOF

Ghost in the Shell – Part 6 – Learn Shell Scripting

The Ghost in the Shell series were about efficient working in the shell environment but one of the feats of any sysadmin profession is the shell scripting. It is often needed to ‘glue’ various solutions and technologies to work as ‘Business’ requires or to fill the gap where any solution is not available – or at least not for free. It also serves a growing role in the automation of various tasks. Today I will try to show you the basics of writing POSIX /bin/sh compatible shell scripts.

You may want to check other articles in the Ghost in the Shell series on the Ghost in the Shell – Global Page where you will find links to all episodes of the series along with table of contents for each episode’s contents.

Basics

In your own ‘yard’ you can use any shell language you want – there are many good interactive shells like zsh(1)/bash(1)/fish(1)/ksh(1) to name a few. Just keep in mind to stay away from csh(1)/tcsh(1) shells as they are mediocre at most in interactive mode and terrible for scripting. Its really pity that csh(1)/tcsh(1) shells are still used as the default FreeBSD shells today knowing that zsh(1) is available under MIT license and could be painlessly integrated into the FreeBSD Base System – but who I am to fix all the world’s problems … I just install zsh(1) from packages and live on.

By writing POSIX /bin/sh scripts you are making sure that they will run not only on bash(1) in Linux but also on all BSD systems and all other UNIX systems out there. Even the really old dinosaurs like HP-UX or AIX.

I always struggled to find good example for learning the shell scripting but recently I got one idea and we will follow it today.

For our ‘target’ I have chosen the kldstat(8) command from FreeBSD. Its output is far from perfect (from my perspective) with showing the Size column in hexadecimal values – while sysadmin expects values in (mega/giga/tera)bytes. Our task will be to parse that kldstat(8) output into something more human readable.

Lets check that kldstat(8) output then.

% kldstat | head
Id Refs Address                Size Name
 1  133 0xffffffff80200000  1f11f28 kernel
 2    1 0xffffffff82112000   67feb0 zfs.ko
 3    1 0xffffffff82792000    1abe8 geom_eli.ko
 4    3 0xffffffff82a3c000    56ec0 vboxdrv.ko
 5    2 0xffffffff82a93000     4240 vboxnetflt.ko
 6    3 0xffffffff82a98000     aac8 netgraph.ko
 7    1 0xffffffff82aa3000     31c8 ng_ether.ko
 8    1 0xffffffff82aa7000     55e0 vboxnetadp.ko
 9    1 0xffffffff82aad000   158458 i915kms.ko

Now what does 1f11f28 tell me about kernel for the Size column. Not much.

For a start I would like to print just the Size and Name columns in our script – we will call it kld.sh for the lack of better name and I will add version ‘tag’ to its name for each of our steps like kld.0.1.sh for first and ./kld.0.2.sh for the second one and so on.

There are many ways to parse that kldstat(8) output in our script but I will discuss two approaches here.

First is to get the /bin/sh output into variable and then parse it in a loop.

Second one to parse it in a loop in pipe after the command directly. I will use the second one here because the first one – with keeping then /bin/sh output in a variable – my be useful if we want to parse it more then once and as we will parse it only once then its pointless to ‘waste’ memory for that variable. Below you will find the first draft or kld.sh.

0.1

Our first 0.1 version has only the interpreter set at the beginning (the #!/bin/sh shebang) and the simple while read loop to get output of the kldstat(8) command and print it on the screen with shell builtin echo(1) command.

% cat ./kld.0.1.sh
#!/bin/sh

kldstat \
  | while read LINE
    do
      echo "${LINE}"
    done

Here is our script output – its generally identical as the kldstat(8) command.

% ./kld.0.1.sh | head
Id Refs Address                Size Name
1  133 0xffffffff80200000  1f11f28 kernel
2    1 0xffffffff82112000   67feb0 zfs.ko
3    1 0xffffffff82792000    1abe8 geom_eli.ko
4    3 0xffffffff82a3c000    56ec0 vboxdrv.ko
5    2 0xffffffff82a93000     4240 vboxnetflt.ko
6    3 0xffffffff82a98000     aac8 netgraph.ko
7    1 0xffffffff82aa3000     31c8 ng_ether.ko
8    1 0xffffffff82aa7000     55e0 vboxnetadp.ko
9    1 0xffffffff82aad000   158458 i915kms.ko

0.2

As we know that kldstat(8) has fixed number of columns we can read its more intelligently with variables names as its columns and print only Size and Name columns as we wanted it in the first place. We should also omit the first line of kldstat(8) output as we will be printing our own header for just Size and Name columns. We will achieve that with sed(1) command.

Here is out script after our improvements.

% cat kld.0.2.sh
#!/bin/sh

echo "SIZE NAME"
kldstat \
  | sed 1d \
  | while read ID REFS ADDRESS SIZE NAME
    do
      echo "${SIZE} ${NAME}"
    done

Here is its output at current early stage.

% ./kld.0.2.sh | head
SIZE NAME
1f11f28 kernel
67feb0 zfs.ko
1abe8 geom_eli.ko
56ec0 vboxdrv.ko
4240 vboxnetflt.ko
aac8 netgraph.ko
31c8 ng_ether.ko
55e0 vboxnetadp.ko
158458 i915kms.ko

As you can see the columns are not aligned so we can use column(1) command to make it look more like original command.

% ./kld.0.2.sh | column -t | head
SIZE     NAME
1f11f28  kernel
67feb0   zfs.ko
1abe8    geom_eli.ko
56ec0    vboxdrv.ko
4240     vboxnetflt.ko
aac8     netgraph.ko
31c8     ng_ether.ko
55e0     vboxnetadp.ko
158458   i915kms.ko

But typing that each time we execute our script can be PITA so we will now use printf(1) instead of echo(1) to print our output. We will also alight the first Size column to the right to make the command output even more human readable. We will sacrifice 8 places of width for the Size column (%8s) and the rest with aligned to left (%-s) for Name column.

0.3

Here is our improved script.

% cat kld.0.3.sh
#!/bin/sh

printf "%8s %-s\n" SIZE NAME
kldstat \
  | sed 1d \
  | while read ID REFS ADDRESS SIZE NAME
    do
      printf "%8s %-s\n" ${SIZE} ${NAME}
    done

Our output now looks like that one below.

% ./kld.0.3.sh | head
      SIZE NAME
   1f11f28 kernel
    67feb0 zfs.ko
     1abe8 geom_eli.ko
     56ec0 vboxdrv.ko
      4240 vboxnetflt.ko
      aac8 netgraph.ko
      31c8 ng_ether.ko
      55e0 vboxnetadp.ko
    158458 i915kms.ko

Better. Now we will improve two things. First we will start keeping our output format ("%8s %-s\n") in a separate variable and we will finally convert that hexadecimal values into decimal ones – to bytes – there are many ways to do that but I am leaning to use the printf(1) builtin because both of speed and it being available in the shell (builtin).

0.4

Here is the script.

% cat kld.0.4.sh
#!/bin/sh

FORMAT="%8s %-s\n"
printf "${FORMAT}" SIZE NAME
kldstat \
  | sed 1d \
  | while read ID REFS ADDRESS SIZE NAME
    do
      SIZE=$( printf "%d" 0x${SIZE} )
      printf "${FORMAT}" ${SIZE} ${NAME}
    done

And its output with bytes instead of hexadecimal values.

% ./kld.0.4.sh | head
      SIZE NAME
  32579368 kernel
   6815408 zfs.ko
    109544 geom_eli.ko
    356032 vboxdrv.ko
     16960 vboxnetflt.ko
     43720 netgraph.ko
     12744 ng_ether.ko
     21984 vboxnetadp.ko
   1410136 i915kms.ko


Now we have output in bytes and its nicely formatted. Its even easily sortable by the sort(1) command so its leaning nicely with UNIX principles.

% ./kld.0.4.sh | sort -n | head
      SIZE NAME
      8432 coretemp.ko
      8504 cd9660_iconv.ko
      8504 msdosfs_iconv.ko
      8504 udf_iconv.ko
      8576 smbus.ko
      8736 cpuctl.ko
      8800 pty.ko
      9000 lindebugfs.ko
      9024 uhid.ko

The next step would be to print that information in megabytes instead of just plain bytes. To convert bytes into kilobytes we need to divide our bytes value by 1024. To get the megabytes we need to do it twice. We will use the $(( ... )) syntax to use the shell builtin for simple math calculations instead of dropping that task to a subshell with $( ... ) syntax and external commands.

0.5

This is our ‘show in megabytes only’ script looks like.

% cat kld.0.5.sh
#!/bin/sh

FORMAT="%8s %-s\n"
printf "${FORMAT}" SIZE NAME
kldstat \
  | sed 1d \
  | while read ID REFS ADDRESS SIZE NAME
    do
      SIZE=$( printf "%d" 0x${SIZE} )
      SIZE=$(( ${SIZE} / 1024 / 1024 ))
      printf "${FORMAT}" ${SIZE} ${NAME}
    done

And here is its output.

% ./kld.0.5.sh | head
      SIZE NAME
        31 kernel
         6 zfs.ko
         0 geom_eli.ko
         0 vboxdrv.ko
         0 vboxnetflt.ko
         0 netgraph.ko
         0 ng_ether.ko
         0 vboxnetadp.ko
         1 i915kms.ko

That did not wend too well, didn’t it? Because many module use less then 1 megabytes of memory after being rounded to natural numbers its 0 megabytes value for many modules. We will try to use bc(1) calculator instead with up to tenths precision.

0.6

Here is out script after using bc(1) instead of using the $(( ... )) syntax with dividing.

% cat kld.0.6.sh
#!/bin/sh

FORMAT="%8s %-s\n"
printf "${FORMAT}" SIZE NAME
kldstat \
  | sed 1d \
  | while read ID REFS ADDRESS SIZE NAME
    do
      SIZE=$( printf "%d" 0x${SIZE} )
      SIZE=$( echo "scale=1; ${SIZE} / 1024 / 1024" | bc -l )
      printf "${FORMAT}" ${SIZE} ${NAME}
    done

And here is its output.

% ./kld.0.6.sh | head
      SIZE NAME
      31.0 kernel
       6.4 zfs.ko
        .1 geom_eli.ko
        .3 vboxdrv.ko
         0 vboxnetflt.ko
         0 netgraph.ko
         0 ng_ether.ko
         0 vboxnetadp.ko
       1.3 i915kms.ko

Far from ideal. The bc(1) output omits the leading zero if value is less then one. Seems that we can fix that with different printf(1) formatting. Lets try that. We will change from %8s (string) into %8.1f (float). That will also force us to use different formats for header and values so will stop using single FORMAT variable and we will use separate ones.

0.7

This is our current script state.

% cat kld.0.7.sh
#!/bin/sh

HEAD_FORMAT="%8s %-s\n"
LOOP_FORMAT="%8.1f %-s\n"
printf "${HEAD_FORMAT}" SIZE NAME
kldstat \
  | sed 1d \
  | while read ID REFS ADDRESS SIZE NAME
    do
      SIZE=$( printf "%d" 0x${SIZE} )
      SIZE=$( echo "scale=1; ${SIZE} / 1024 / 1024" | bc -l )
      printf "${LOOP_FORMAT}" ${SIZE} ${NAME}
    done

And its output.

% ./kld.0.7.sh | head
      SIZE NAME
      31.0 kernel
       6.4 zfs.ko
       0.1 geom_eli.ko
       0.3 vboxdrv.ko
       0.0 vboxnetflt.ko
       0.0 netgraph.ko
       0.0 ng_ether.ko
       0.0 vboxnetadp.ko
       1.3 i915kms.ko

Works as advertised. We can now think of something different. How about we will also add an argument to include the kernel and modules file sizes as well? Not very useful I think but for the the purpose of shell scripting learning process we will do it anyway. The first caveat here is that kernel modules are on two locations on FreeBSD. The Base System modules are kept at /boot/kernel location and the modules that were installed by pkg(8) packages (or from FreeBSD Ports) are located at /boot/modules place. To get their size we will use the stat(1) command. Similarly like with memory usage – we would like to have the output of kernel and its modules size in megabytes.

There are of course several ways to achieve that. Lets start with the longest most educational example below. I will just paste the fragment that gets that kernel or module size for the FILE column.

if [ -f /boot/modules/${NAME} ]
then
  FILE=$( stat -f %z /boot/modules/${NAME} )
fi

if [ -f /boot/kernel/${NAME} -a -z ${NAME} ]
then
  FILE=$( stat -f %z /boot/kernel/${NAME} )
fi

if [ "${FILE}" = "" ]
then
  FILE=-
fi

FILE=$( echo "scale=1; ${FILE} / 1024 / 1024" | bc -l )

One note about the [ "${FILE}" = "" ] syntax – in all old POSIX shells out there that I used /bin/sh always worked well with that syntax when FILE variable was empty or non existing. In a extreme example this one – [ "" = "" ] – works as desired. In case if you find yourself in a situation when this does not work in some POSIX /bin/sh implementation then use the most secure variant with additional same word added to both sides like that – [ "${FILE}test" = "test" ] – this way even the most badly written POSIX /bin/sh implementation will work πŸ™‚

It first checks the /boot/modules location for the module because I know a period of FreeBSD history in which the i915kms.ko module existed in both of these places and if you had them both then there is 99% percent chance that you are using the one installed by packages – that is why we try the third party modules first – then the ones from the Base System place. We also make sure that if for some reason the file will not be found the stat(1) command would not yield about its missing with 2> /dev/null at the end of command.

If we fail to find it under the third party modules then we will try the Base System location – but only when we did not find anything in the third party place – hence the additional test with -z ${NAME}.

For the record the syntax for these tests is:

  • for single test its like that: [ TEST ]
  • to test for both parameters (AND operator) its like that: [ TEST1 -a TEST ]
  • for only one of tests to pass (OR operator) its like that: [ TEST1 -o TEST ]

If we fail to find the file size then we set that to ‘‘ value.

At the end we divide by 1024 two times so we get megabytes from bytes.

This can be shortened to to take less place (and writing) into something like that.

[ -f /boot/modules/${NAME} ]              && FILE=$( stat -f %z /boot/modules/${NAME} 2> /dev/null )
[ -f /boot/kernel/${NAME} -a -z ${NAME} ] && FILE=$( stat -f %z /boot/kernel/${NAME}  2> /dev/null )
[ ${FILE} = "" ]                          && FILE=-
FILE=$( echo "scale=1; ${FILE} / 1024 / 1024" | bc -l )

The end result is the same but it requires less space and writing. I also added some spaces for ‘logical formatting’ to make it more readable.

There is also more extreme way to shorten this up while keeping the same logic – here it is.

FILE=$( stat -f %z /boot/kernel/${NAME}  2> /dev/null \
     || stat -f %z /boot/modules/${NAME} 2> /dev/null \
     || FILE=- )
FILE=$( echo "scale=1; ${FILE} / 1024 / 1024" | bc -l )

We use then || OR operator in the subshell to make that shorter and still keep it readable. This is the version that we will use in our script.

0.8

Lets see now how it looks after modifications.

% cat kld.0.8.sh
#!/bin/sh

HEAD_FORMAT="%8s %8s %-s\n"
LOOP_FORMAT="%8.1f %8.1f %-s\n"
printf "${HEAD_FORMAT}" SIZE FILE NAME
kldstat \
  | sed 1d \
  | while read ID REFS ADDRESS SIZE NAME
    do
      FILE=$( stat -f %z /boot/kernel/${NAME}  2> /dev/null \
           || stat -f %z /boot/modules/${NAME} 2> /dev/null \
           || FILE=- )
      FILE=$( echo "scale=1; ${FILE} / 1024 / 1024" | bc -l )
      SIZE=$( printf "%d" 0x${SIZE} )
      SIZE=$( echo "scale=1; ${SIZE} / 1024 / 1024" | bc -l )
      printf "${LOOP_FORMAT}" ${SIZE} ${FILE} ${NAME}
    done

And here is its output.

% ./kld.0.8.sh | head
    SIZE     FILE NAME
    31.0     27.7 kernel
     6.4      5.0 zfs.ko
     0.1      0.1 geom_eli.ko
     0.3      0.4 vboxdrv.ko
     0.0      0.0 vboxnetflt.ko
     0.0      0.1 netgraph.ko
     0.0      0.0 ng_ether.ko
     0.0      0.0 vboxnetadp.ko
     1.3      2.2 i915kms.ko

Its interesting to see that used memory and file size are different.

Another step would be printing also the summary of the used RAM for each column. This is where things get more interesting. The while loop is created in a pipe which means its in a subshell. This has some serious implications. Normally we would add two variables like SIZE_TOTAL and FILE_TOTAL to add each module size there and then after the loop ends just print the summary. Because the while loop is spawned as subshell these variables will vanish as soon as the loop will end its life and these variables would not exist (they existed only in that while subshell).

But fear not – there is very clever way with file descriptor to have these variables exist with their values after the while loop ends. Below you will find the shortened prototypes of our currently used ‘pipe’ way and the ‘descriptor’ way.

This is the way you already know.

kldstat \
  | sed 1d \
  | while read LINE
    do
      echo "${LINE}"
      TOTAL="Now You Don't."
    done

echo ${TOTAL}

When you will execute that you will NOT see the "Now You Don't." string.

Now this is the way to overcome that subshell limitation.

while read LINE
do
  echo "${LINE}"
  TOTAL="Now You See Me."
done << BSD
  $( kldstat | sed 1d )
BSD

echo ${TOTAL}

As you try it you will see the "Now You See Me." sign at the end.

This way we will provide summary for each column.

0.9

This is our code after our effort to add summary for the columns. You may noticed that we added the FILE_TOTAL and SIZE_TOTAL before the FILE and SIZE values are converted to megabytes. That ensures we are as accurate as possible. If we would just sum up the SIZE and FILE after they were converted to megabytes we would lost several bytes in the process.

% cat kld.0.9.sh
#!/bin/sh

HEAD_FORMAT="%8s %8s %-s\n"
LOOP_FORMAT="%8.1f %8.1f %-s\n"
printf "${HEAD_FORMAT}" SIZE FILE NAME
while read ID REFS ADDRESS SIZE NAME
do
  FILE=$( stat -f %z /boot/kernel/${NAME}  2> /dev/null \
       || stat -f %z /boot/modules/${NAME} 2> /dev/null \
       || FILE=- )
  FILE_TOTAL=$(( ${FILE_TOTAL} + ${FILE} ))
  FILE=$( echo "scale=1; ${FILE} / 1024 / 1024" | bc -l )
  SIZE=$( printf "%d" 0x${SIZE} )
  SIZE_TOTAL=$(( ${SIZE_TOTAL} + ${SIZE} ))
  SIZE=$( echo "scale=1; ${SIZE} / 1024 / 1024" | bc -l )
  printf "${LOOP_FORMAT}" ${SIZE} ${FILE} ${NAME}
done << BSD
  $( kldstat | sed 1d )
BSD
FILE_TOTAL=$( echo "scale=1; ${FILE_TOTAL} / 1024 / 1024" | bc -l )
SIZE_TOTAL=$( echo "scale=1; ${SIZE_TOTAL} / 1024 / 1024" | bc -l )
printf "${LOOP_FORMAT}" ${SIZE_TOTAL} ${FILE_TOTAL} TOTAL

This is how its execution looks like.

% ./kld.0.9.sh | (head -5; echo '(...)'; tail -5)
    SIZE     FILE NAME
    31.0     27.7 kernel
     6.4      5.0 zfs.ko
     0.1      0.1 geom_eli.ko
     0.3      0.4 vboxdrv.ko
(...)
     0.0      0.0 linsysfs.ko
     0.0      0.0 fdescfs.ko
     0.0      0.0 nullfs.ko
     0.0      0.0 acpi_ibm.ko
    40.9     39.5 TOTAL

As you can see I also used shell feature to pipe output into many commands at once – this allows us to show information that is most important to use – beginning and ending – for the summary.

We even can do nested piping as shown on the screenshot below.

lolcat

I deliberately used head(1) for entire guide because I have total of 42 kernel modules loaded. I did not wanted these outputs to overshadow our objective here. Here at the end I will show you complete output for the sake of it.

% kldstat | wc -l
      42

% ./kld.0.9.sh
    SIZE     FILE NAME
    31.0     27.7 kernel
     6.4      5.0 zfs.ko
     0.1      0.1 geom_eli.ko
     0.3      0.4 vboxdrv.ko
     0.0      0.0 vboxnetflt.ko
     0.0      0.1 netgraph.ko
     0.0      0.0 ng_ether.ko
     0.0      0.0 vboxnetadp.ko
     1.3      2.2 i915kms.ko
     0.4      0.8 drm.ko
     0.0      0.0 linuxkpi_gplv2.ko
     0.0      0.0 lindebugfs.ko
     0.0      0.1 fusefs.ko
     0.0      0.0 coretemp.ko
     0.0      0.0 sem.ko
     0.0      0.0 cpuctl.ko
     0.0      0.0 ichsmb.ko
     0.0      0.0 smbus.ko
     0.0      0.0 cuse.ko
     0.0      0.0 libiconv.ko
     0.0      0.0 cd9660_iconv.ko
     0.0      0.0 msdosfs_iconv.ko
     0.0      0.0 udf_iconv.ko
     0.0      0.0 udf.ko
     0.0      0.0 acpi_wmi.ko
     0.0      0.0 uhid.ko
     0.0      0.0 usbhid.ko
     0.0      0.0 hidbus.ko
     0.0      0.0 wmt.ko
     0.0      0.0 ums.ko
     0.1      0.2 ng_btsocket.ko
     0.0      0.0 ng_bluetooth.ko
     0.2      0.6 linux.ko
     0.0      0.1 linux_common.ko
     0.1      0.5 linux64.ko
     0.0      0.0 pty.ko
     0.0      0.0 linprocfs.ko
     0.0      0.0 linsysfs.ko
     0.0      0.0 fdescfs.ko
     0.0      0.0 nullfs.ko
     0.0      0.0 acpi_ibm.ko
    40.9     39.5 TOTAL

% kldstat
Id Refs Address                Size Name
 1  133 0xffffffff80200000  1f11f28 kernel
 2    1 0xffffffff82112000   67feb0 zfs.ko
 3    1 0xffffffff82792000    1abe8 geom_eli.ko
 4    3 0xffffffff82a3c000    56ec0 vboxdrv.ko
 5    2 0xffffffff82a93000     4240 vboxnetflt.ko
 6    3 0xffffffff82a98000     aac8 netgraph.ko
 7    1 0xffffffff82aa3000     31c8 ng_ether.ko
 8    1 0xffffffff82aa7000     55e0 vboxnetadp.ko
 9    1 0xffffffff82aad000   158458 i915kms.ko
10    1 0xffffffff82c06000    7f548 drm.ko
11    2 0xffffffff82c86000     cbc8 linuxkpi_gplv2.ko
12    2 0xffffffff82c93000     2328 lindebugfs.ko
13    1 0xffffffff82c96000    11f10 fusefs.ko
14    1 0xffffffff82ca8000     20f0 coretemp.ko
15    1 0xffffffff82cab000     39e8 sem.ko
16    1 0xffffffff82caf000     2220 cpuctl.ko
17    1 0xffffffff82cb2000     3250 ichsmb.ko
18    1 0xffffffff82cb6000     2180 smbus.ko
19    1 0xffffffff82cb9000     6730 cuse.ko
20    4 0xffffffff82cc0000     4798 libiconv.ko
21    1 0xffffffff82cc5000     2138 cd9660_iconv.ko
22    1 0xffffffff82cc8000     2138 msdosfs_iconv.ko
23    1 0xffffffff82ccb000     2138 udf_iconv.ko
24    1 0xffffffff82cce000     5a00 udf.ko
25    1 0xffffffff82cd4000     3378 acpi_wmi.ko
26    1 0xffffffff82cd8000     2340 uhid.ko
27    1 0xffffffff82cdb000     3380 usbhid.ko
28    1 0xffffffff82cdf000     31f8 hidbus.ko
29    1 0xffffffff82ce3000     3320 wmt.ko
30    1 0xffffffff82ce7000     4350 ums.ko
31    1 0xffffffff82cec000    1ce48 ng_btsocket.ko
32    1 0xffffffff82d09000     25a8 ng_bluetooth.ko
33    1 0xffffffff82d0c000    388f8 linux.ko
34    4 0xffffffff82d45000     db70 linux_common.ko
35    1 0xffffffff82d53000    30ac8 linux64.ko
36    1 0xffffffff82d84000     2260 pty.ko
37    1 0xffffffff82d87000     639c linprocfs.ko
38    1 0xffffffff82d8e000     3284 linsysfs.ko
39    1 0xffffffff82d92000     3530 fdescfs.ko
40    1 0xffffffff82d96000     4700 nullfs.ko
41    1 0xffffffff82d9b000     41d8 acpi_ibm.ko

Summary

This concludes this Ghost in the Shell episode.

Feel free to share your scripting habits and spells πŸ™‚

EOF