Wednesday, April 27, 2022

Raspberry Pi Zero 2 W NetBSD dmesg text

 Raspberry Pi Zero 2 W NetBSD dmesg text

Installed following brief notes here:

Resulting dmesg output:


[     1.000000] NetBSD 9.2_STABLE (GENERIC) #0: Mon Apr 25 12:39:27 UTC 2022

[     1.000000]

[     1.000000] total memory = 448 MB

[     1.000000] avail memory = 433 MB

[     1.000000] timecounter: Timecounters tick every 10.000 msec

[     1.000000] running cgd selftest aes-xts-256 aes-xts-512 done

[     1.000000] armfdt0 (root)

[     1.000000] simplebus0 at armfdt0: Raspberry Pi Zero 2 W Rev 1.0

[     1.000000] simplebus1 at simplebus0

[     1.000000] simplebus2 at simplebus0

[     1.000000] simplebus3 at simplebus1

[     1.000000] cpus0 at simplebus0

[     1.000000] simplebus4 at simplebus0

[     1.000000] cpu0 at cpus0: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)

[     1.000000] cpu0: DC enabled IC enabled WB enabled EABT branch prediction enabled

[     1.000000] cpu0: 32KB/64B 2-way L1 VIPT Instruction cache

[     1.000000] cpu0: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache

[     1.000000] cpu0: 512KB/64B 16-way write-through L2 PIPT Unified cache

[     1.000000] vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals

[     1.000000] cpu1 at cpus0

[     1.000000] cpu2 at cpus0

[     1.000000] cpu3 at cpus0

[     1.000000] bcmicu0 at simplebus1

[     1.000000] bcmicu1 at simplebus1: Multiprocessor

[     1.000000] bcmcprman0 at simplebus1: BCM283x Clock Controller

[     1.000000] fclock0 at simplebus2: 19200000 Hz fixed clock (osc)

[     1.000000] bcmaux0 at simplebus1

[     1.000000] fclock1 at simplebus2: 480000000 Hz fixed clock (otg)

[     1.000000] gtmr0 at simplebus0: Generic Timer

[     1.000000] gtmr0: interrupting on local_intc irq 3

[     1.000000] armgtmr0 at gtmr0: Generic Timer (19200 kHz, virtual)

[     1.000000] timecounter: Timecounter "armgtmr0" frequency 19200000 Hz quality 500

[     1.000003] plcom0 at simplebus1: ARM PL011 UART

[     1.000003] plcom0: txfifo disabled

[     1.000003] plcom0: interrupting on icu irq 185

[     1.000003] com0 at simplebus1: BCM AUX UART, working fifo

[     1.000003] com0: console

[     1.000003] com0: interrupting on icu irq 157

[     1.000003] usbnopphy0 at simplebus0: USB PHY

[     1.000003] /soc/thermal@7e212000 at simplebus1 not configured

[     1.000003] /soc/dsi@7e209000 at simplebus1 not configured

[     1.000003] bcmgpio0 at simplebus1: GPIO controller

[     1.000003] bcmgpio0: pins 0..31 interrupting on icu irq 177

[     1.000003] bcmgpio0: pins 32..54 interrupting on icu irq 178

[     1.000003] gpio0 at bcmgpio0: 54 pins

[     1.000003] /soc/firmware/gpio at simplebus3 not configured

[     1.000003] bcmdmac0 at simplebus1: DMA0 DMA2 DMA4 DMA5 DMA6 DMA7 DMA8 DMA9 DMA10

[     1.000003] /soc/power at simplebus1 not configured

[     1.000003] mmcpwrseq0 at simplebus0autoconfiguration error: : couldn't get reset GPIOs

[     1.000003] bsciic0 at simplebus1: Broadcom Serial Controller

[     1.000003] iic0 at bsciic0: I2C bus

[     1.000003] bcmpmwdog0 at simplebus1: Power management, Reset and Watchdog controller

[     1.000003] bcmmbox0 at simplebus1: VC mailbox

[     1.000003] bcmmbox0: interrupting on icu irq 193

[     1.000003] vcmbox0 at bcmmbox0

[     1.000003] bcmsdhost0 at simplebus1: SD HOST controller

[     1.000003] bcmsdhost0: interrupting on icu irq 184

[     1.000003] bsciic1 at simplebus1: Broadcom Serial Controller

[     1.000003] iic1 at bsciic1: I2C bus

[     1.000003] /soc/pwm@7e20c000 at simplebus1 not configured

[     1.000003] sdhc0 at simplebus1: SDHC controller

[     1.000003] sdhc0: interrupting on icu irq 190

[     1.000003] bsciic2 at simplebus1: Broadcom Serial Controller

[     1.000003] iic2 at bsciic2: I2C bus

[     1.000003] /soc/vec@7e806000 at simplebus1 not configured

[     1.000003] /soc/hdmi@7e902000 at simplebus1 not configured

[     1.000003] dwctwo0 at simplebus1: USB controller

[     1.000003] dwctwo0: interrupting on icu irq 137

[     1.000003] /soc/gpu at simplebus1 not configured

[     1.000003] genfb0 at simplebus1: switching to framebuffer console

[     1.000003] genfb0: framebuffer at 0xde402000, size 1920x1080, depth 32, stride 7680

[     1.000003] wsdisplay0 at genfb0 kbdmux 1: console (default, vt100 emulation)

[     1.000003] wsmux1: connecting to wsdisplay0

[     1.000003] wsdisplay0: screen 1-3 added (default, vt100 emulation)

[     1.000003] vchiq0 at simplebus1: BCM2835 VCHIQ

[     1.000003] armpmu0 at simplebus0: Performance Monitor Unit

[     1.000003] gpioleds0 at simplebus0: ACT

[     1.000003] /soc/timer@7e003000 at simplebus1 not configured

[     1.000003] /soc/txp@7e004000 at simplebus1 not configured

[     1.000003] bcmrng0 at simplebus1: RNG

[     1.000003] timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0

[     1.000003] cpu1: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)

[     1.706895] cpu1: DC enabled IC enabled WB enabled EABT branch prediction enabled

[     1.736896] cpu1: 32KB/64B 2-way L1 VIPT Instruction cache

[     1.776900] cpu1: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache

[     1.806906] cpu1: 512KB/64B 16-way write-through L2 PIPT Unified cache

[     1.846909] vfp1 at cpu1: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals

[     1.876912] cpu2: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)

[     1.916916] cpu2: DC enabled IC enabled WB enabled EABT branch prediction enabled

[     1.946920] cpu2: 32KB/64B 2-way L1 VIPT Instruction cache

[     1.986925] cpu2: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache

[     2.016928] cpu2: 512KB/64B 16-way write-through L2 PIPT Unified cache

[     2.056933] vfp2 at cpu2: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals

[     2.096938] cpu3: 600 MHz Cortex-A53 r0p4 (Cortex V8A core)

[     2.126941] cpu3: DC enabled IC enabled WB enabled EABT branch prediction enabled

[     2.166945] cpu3: 32KB/64B 2-way L1 VIPT Instruction cache

[     2.196950] cpu3: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache

[     2.236954] cpu3: 512KB/64B 16-way write-through L2 PIPT Unified cache

[     2.276958] vfp3 at cpu3: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals

[     2.426974] sdmmc0 at bcmsdhost0

[     2.426974] sdhc0: SDHC 3.0, rev 153, platform DMA, 200000 kHz, HS 3.3V, re-tuning mode 1, 1024 byte blocks

[     2.437171] sdmmc1 at sdhc0 slot 0

[     2.437171] dwctwo0: Core Release: 2.80a (snpsid=4f54280a)

[     2.437171] usb0 at dwctwo0: USB revision 2.0

[     2.477042] armpmu0: interrupting on local_intc irq 9

[     2.487042] uhub0 at usb0: NetBSD (0000) DWC2 root hub (0000), class 9/0, rev 2.00/1.00, addr 1

[     2.487042] uhub0: 1 port with 1 removable, self powered

[     2.527046] IPsec: Initialized Security Association Processing.

[     2.547047] sdmmc0: direct I/O error 5, r=6 p=0xa541bf2c write

[     2.617057] sdmmc1: sdmmc_mem_enable failed with error 60

[     2.627056] sdmmc1: autoconfiguration error: couldn't enable card: 60

[     2.647059] sdmmc0: SD card status: 4-bit, C4

[     2.657189] ld0 at sdmmc0: <0x03:0x5344:SS16G:0x80:0xa5864a9d:0x115>

[     2.657189] ld0: 15193 MB, 7717 cyl, 64 head, 63 sec, 512 bytes/sect x 31116288 sectors

[     2.697067] ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz

[     3.207111] WARNING: 2 errors while detecting hardware; check system log.

[     3.217113] boot device: ld0

[     3.217113] root on ld0a dumps on ld0b

[     3.247116] root file system type: ffs

[     3.257117] kern.module.path=/stand/evbarm/9.2/modules

[     3.267117] vchiq0: interrupting on icu irq 194

[     3.267117] vchiq: vchiq_init_state: slot_zero = 0xa5880000, is_master = 0

[     3.267117] vchiq: local ver 8 (min 3), remote ver 8.

[     3.267117] vcaudio0 at vchiq0: auds

[     3.267117] WARNING: no TOD clock present

[     3.277120] WARNING: using filesystem time


[     3.297122] audio0 at vcaudio0: playback

[     3.297122] audio0: slinear_le:16 -> slinear_le:16 2ch 48000Hz, blk 7680 bytes (40ms) for playback

[     3.307121] spkr0 at audio0: PC Speaker (synthesized)

[     3.307121] wsbell at spkr0 not configured

[     5.787575] wsdisplay0: screen 4 added (default, vt100 emulation)

[     9.788463] uhub1 at uhub0 port 1: vendor 05e3 (0x5e3) USB2.0 Hub (0x608), class 9/0, rev 2.00/9.01, addr 2

[     9.798471] uhub1: single transaction translator

[     9.798471] uhub1: 4 ports with 4 removable, self powered

[    11.108627] ure0 at uhub1 port 2

[    11.118623] ure0: Realtek (0xbda) USB 10/100/1000 LAN (0x8153), rev 2.10/31.00, addr 3

[    11.128628] ure0: RTL8153 unknown ver 6010

[    11.198637] rgephy0 at ure0 phy 0: RTL8251 1000BASE-T media interface, rev. 0

[    11.198637] rgephy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, auto

[    11.218636] ure0: Ethernet address 00:00:00:00:00:00

[    12.308752] uhidev0 at uhub1 port 3 configuration 1 interface 0

[    12.308752] uhidev0: Logitech (0x46d) USB Receiver (0xc52b), rev 2.00/12.11, addr 4, iclass 3/1

[    12.378765] ukbd0 at uhidev0

[    12.788796] wskbd0 at ukbd0: console keyboard, using wsdisplay0

[    12.788796] uhidev1 at uhub1 port 3 configuration 1 interface 1

[    12.798925] uhidev1: Logitech (0x46d) USB Receiver (0xc52b), rev 2.00/12.11, addr 4, iclass 3/1

[    12.978946] uhidev1: 8 report ids

[    12.978946] ums0 at uhidev1 reportid 2: 16 buttons, W and Z dirs

[    12.978946] wsmouse0 at ums0 mux 0

[    12.990544] uhid0 at uhidev1 reportid 3: input=4, output=0, feature=0

[    12.990544] uhid1 at uhidev1 reportid 4: input=1, output=0, feature=0

[    13.013252] uhid2 at uhidev1 reportid 8: input=1, output=0, feature=0

[    13.013252] uhidev2 at uhub1 port 3 configuration 1 interface 2

[    13.022501] uhidev2: Logitech (0x46d) USB Receiver (0xc52b), rev 2.00/12.11, addr 4, iclass 3/0

[    13.112515] uhidev2: 33 report ids

[    13.112515] uhid3 at uhidev2 reportid 16: input=6, output=6, feature=0

[    13.112515] uhid4 at uhidev2 reportid 17: input=19, output=19, feature=0

[    13.125073] uhid5 at uhidev2 reportid 32: input=14, output=14, feature=0

[    13.142920] uhid6 at uhidev2 reportid 33: input=31, output=31, feature=0

[    13.152996] uhub0: autoconfiguration error: illegal enable change, port 1

[  2146.262218] audio0(vcaudio0): setting play.port=0 failed: errno=22

[  2146.262218] audio0(vcaudio0): setting play.port=0 failed: errno=22

[  2391.675509] audio0(vcaudio0): setting play.port=0 failed: errno=22

[  2391.685588] audio0(vcaudio0): setting play.port=0 failed: errno=22

[  2731.793669] audio0(vcaudio0): setting play.port=0 failed: errno=22

[  2731.793669] audio0(vcaudio0): setting play.port=0 failed: errno=22

Thursday, April 21, 2022

Defenders Trail, Day Three

 Over a decade ago, I walked most of the "Defenders Trail" around North Point, in Baltimore County. I posted 2 summaries of those hikes as "Day One" and "Day Two", so though there is a big jump in elapsed time, this is "Day Three".

Looking back at the images I captured and the notes I took, a bit has changed, in particular Google shut down the Panoramio web site. The images I and others uploaded, were mostly retained by Google, except the former URLs are broken and are now harder to find. For a while, I could not find any of the thousands of geo-tagged photos I contributed, but at some point, they showed up in Google Earth Pro when you select "show photo layers". Fortunately I was able to pull down my contributions and spent a little time recovering shots from the first 2 posts to make them readable again.

Methodist Meeting House

Nothing is left of the original building, though this substantial marker should last a few centuries, above or below the water line. There are no sidewalks or paths leading to this fenced-off area, so you'd need to park on a nearby street and wander around. 

Nearby is the Bread & Cheese Creek streambed, where there are high water markers for times when upstream runoff rushes into a constricted area. Needless to say, don't walk on North Point Road past the narrowing.

North Point Battlefield

When I hiked these trails in 2011, the North Point Battlefield Park did not exist in the condition that it does in 2022.


It's flat, and wet. I hope enough people use these trails to keep back the phragmites. But the wetlands are pervasive, and invasive.

North Point 

One site mentioned in the old trail guide was "Cooks Tavern". That's long gone, replaced by a variety of shopping center buildings. This view shows North Point Boulevard, the Beltway, and in the distance, a road sign commemorating the battle of North Point.

Speaking of signs, here's two.

No giant flags here, just swamp and stickerbushes.

Friday, February 18, 2022

Building out an intra-home data aggregator

 After I put a couple Raspberry Pi environment monitoring devices into my shopping cart and pile of unconnected devices, I looked around for a central data aggregator that would be a step up from individual cron jobs and RRD repositories. The open source platform Zabbix looked interesting, as it was noted in online posts about pulling data from remote devices. Around the end of January, as the weather pushed me to inside projects, I started figuring out the moving parts.

My first thought was I'd like to run the database and system on NetBSD, but after looking at the state of Zabbix server and agent version availability, I found FreeBSD has an advantage in having better coverage. I thought I could put the server processes on one node and the database itself on a different node, since I already had working PostgreSQL systems. Trying to activate NetBSD packages on the arm Pi systems ended up with a battle between mysql and mariadb, meaning the package wouldn't use postgreSQL as I wanted.

The package version of Zabbix for FreeBSD, is also pre-configured for MySQL, despite the configuration file indicating that a few tweaks could alter the database connection. I tried several permutations of ports and other values before coming to the realization that if I wanted a different database I'd need to build the application from sources. But running both a binary package repository and one from source on one node can be problematic, leading me to start from scratch with a fresh FreeBSD system.

After a few feints, I was able to get FreeBSD 13 set up on an SSD drive connected through USB to a Pi 4. Turns out, that was the easy part. I tried to find the least common denominator of underlying libraries to minimize the time spent watching auto-configure and make run through huge software stacks. I was expecting there might be several days worth of churn ahead but was pleasantly surprised as I watched the component parts get laid down.

Somewhere around Groundhog Day, I had the Zabbix server working, along with at least one other agent, and proceeded to deploy the front end. Fortunately, I had a working httpd server on another FreeBSD on Pi, so adding the php code was a minor hassle.

In a prior life, I worked with enterprise scale software/hardware/application monitoring software, from PMC Patrol/Enterprise Manager, to HP OpenView, to Computer Associates tools, and finally, to the now-tainted SolarWinds. Much of the design of Zabbix, as well as the agent technologies, looked pretty familiar. After the web front end was running, it looked very clean and modern, with menus and paths that looked straightforward.


 43331:20220204:013743.375 cannot send list of active checks to "x.x.x.x": host [Name] not found


(04 February 2022)

Alas, not everything was as simple as it appeared. The learning curve was not too steep, though it involved translating a few terms into understandable chunks. Like "not supported" as a state for a monitoring element. On the surface, that would mean to me that the combination was just not going to work, as opposed to a condition where an element went offline or was unreachable for some reason. There were more subtleties under the surface as I'd learn by trial and error.

The first hurdle was the nomenclature of server and agent, where you could put a label on something that matched a DNS entry, or didn't match. I knew that once I started making configuration choices (like short name or long name), I'd probably be stuck with that decision once the beast took on a life of its own.


 85706:20220205:173436.157 resuming Zabbix agent checks on host "sample": connection restored


(05 February 2022)

Finally, with database, server, agents, and the web front-end connected and working properly, it was time to examine the contents and see what hath been wrought.

Total disk space on "/" and Free disk space on "/" are shown on the graphic above, with 115 and 85 GB, roughly, or 100% and 74%. But wait, that red pie slice doesn't occupy 100% of a circle, it's only 26% (more or less). A graphic that "works" but is wrong.

This is good. Gold, even.

(07 February 2022)

Here, I noticed a large network stream to/from one device, which was apparently running an audio program that no one was listening to. It happens. So, the Zabbix charts revealed useful information within a couple days.

Back to the Raspberry Pi tuning tweaks. I found several examples of adding monitoring to Zabbix, and started with 2 of them. One has a bash script with over a dozen metrics included, and the other has 4 metrics contained within one add-on.

I learned the basic add-on set includes an XML or other defined method of setting up configuration, and a set of commands, usually shell scripts (but could be other languages if wrapped correctly).

Derived metrics

Obviously, with chips made these days, temperatures would be reported in Celsius not Fahrenheit, but as an American, I'm more conversant with the latter. So it would make sense to calculate a derived value inside the monitoring suite, as good practice for learning how to build and deploy future readings from wherever (home thermostat/outside weather/noise levels). Let's see: nine-fifths pus thirty-two, in words, works out to this in configure-speak:


Wait, where did the 1000 come from?
Er, turns out the Raspberry Pi user interface reports temperatures with up to 3 digits, like this:

 $ cat /sys/class/thermal/thermal_zone0/temp

$ vcgencmd measure_temp


This measurement is 41 degrees, plus a fraction. Depending on how the data are pulled, the decimal points might get shifted around.

This chart shows the derived "Betriebstemperatur" in Fahrenheit. Errors in getting the formula correct caused the first several numbers to be incorrect, rather than simply missing. I expect the impact of this will diminish over time. I couldn't find a quick way to purge old data (yet).

(08 February 2022)

ZBX_NOTSUPPORTED: Invalid item key format.
ZBX_NOTSUPPORTED: Unsupported item key.

In checking out one metric, I noticed the above 2 message look similar, particularly the identical all-upper case intro, but invalid is not unsupported. The former looks more fixable on the surface; looking for the root cause would ascertain for sure

Now it's the 11th, after a week or so of building, deploying, configuring, troubleshooting, tuning, and rebuilding. I think this was worth it just to show the capability of a $100 Raspberry Pi + SSD combo with FreeBSD.

Issues and Fixes

[3.] Add zabbix user to video group
   $ sudo usermod -a -G video zabbix

This is necessary based on the default command permissions. Adjust based on user prefences.

In earlier Raspberry Pi versions, apparently the command to interrogate internal counters and more (vcgencmd) was installed under the directory /opt/vc/bin/. The "opt" directory is one of those UNIX relics like "/usr/local/" where custom software might be installed outside the base release. But, as happens, that location became obsolete when the newer versions but vcgencmd into /usr/bin which would be in a typical PATH search.  With the nature of some google searches leading to older code based on hit counts, you might be trying to run something that isn't there, with the resulting obscure side effects.

 85684:20220205:013853.811 item "" became not supported: Value of type "string" is not suitable for value type "Numeric (float)". Value "sh: 1: /opt/vc/bin/vcgencmd: not found"

So, I saw 2 obvious ways to fix this. First, alter the script to the correct path; second, put a link into the old location pointing to the new location. I chose the latter as having fewer steps, though purists may prefer to alter the source.

pi@pi:/opt/vc/bin $ sudo ln -s /usr/bin/vcgencmd vcgencmd

More  issues and fixes

zabbix_agentd [7518]: cannot create locks: cannot create semaphore set: [28] No
                        space left on device

This bug stumped me for a little while. On another node that was already running postgreSQL before adding a Zabbix agent, I was getting errors showing "no space left on device", despite having a nearly empty 500GB SSD. If I stopped the database, the agent would launch. But both would not run at the same time (on NetBSD 9.x).

Locks and semaphores are another obscure UNIX facility, going back to the early AT&T System V releases. I fortunately was experiences with configuring shared memory for large Oracle database deployments, so even though that was decades ago, the seeds are still there. Looking at the error message, it's unclear which memory parameter might be limiting, as several settings have very similar names mentioning semaphores and shared memory.

SHMMNI  Maximum number of shared memory segments system-wide 
SEMMNI  Maximum number of semaphore identifiers (i.e., sets)  
SEMMNS  Maximum number of semaphores system-wide  

The ipcs command will show the current state.

$ ipcs -a
IPC status from <running system> as of Mon Feb  7 02:04:06 2022

And the sysctl command will show kernel and other settings on BSD.


kern.ipc.semmni = 10
kern.ipc.semmns = 60
kern.ipc.semmnu = 30


kern.ipc.semmni = 100
kern.ipc.semmns = 600
kern.ipc.semmnu = 300

I could have tried to optimize these settings one by one using small increments, but knowing that these default values date back decades to much less capable systems, I increased each of them by a factor of 10. I speculated that any wasted resources would be minimal, and was rewarded by both processes starting and running without errors.

ALSO: swap

pid 92246 (c++), jid 0, uid 0, was killed: out of swap space

I had tried to build an X Windows program after getting Zabbix working, but the compile failed with obscure "internal errors". Later I found the more succinct root cause of the failure: out of swap space. Wow, also an old timey issue on virtual memory systems from the 1980s like DEC VMS.

On a Pi Zero 2 W:

$ swapon --show
/var/swap file 100M 97.9M   -2

then, later:

$ sudo swapon
/var/swapfile2 file 1024M   0B   -2

For FreeBSD/NetBSD, swap metrics are tricky with Zabbix. I used the FreeBSD template to connect to NetBSD nodes as Zabbix only includes FreeBSD and OpenBSD (pity). The FreeBSD nodes reported swap issues different than the Linux conditions noted above, while the NetBSD swap metrics failed most likely due to syntax Babel amongst the BSD descendants. Though not directly Zabbix related, I wanted to address the out-of-the-box swap configuration, at least to have a learning experience, with the added risk factor of wiping an entire installation with an errant format command.

At first, it didn't appear that FreeBSD supported swap files but only devices. And as I didn't want to go back and try to repartition a running system I was leaning toward adding a USB memory dongle for swap when I dug deeper into the manual pages. My initial surmise was incorrect, I could build a swap file (if I wanted) in a manner very similar to the Linux steps, which makes future build errors less likely.
Initially, no swap on a FreeBSD Pi build:

[]# dd if=/dev/zero of=/var/swapfile2 bs=1024k count=16384
[]# chmod 0600 /var/swapfile2

/etc/rc.conf: 26 lines, 511 characters
swapfile="/var/swapfile2"   # Set to name of swapfile if desired.

[]# mdconfig -a -t vnode -f /var/swapfile2 -u 0 && swapon /dev/md0

Swap: 16G Total, 16G Free

warning: total configured swap (4194304 pages) exceeds maximum recommended amount (3928456 pages).
warning: increase kern.maxswzone or reduce amount of swap.

OK, I overdid it, but now I have the classic swap at > 2 times physical memory, ha!

The top command reports:

Swap: 16G Total, 11M Used, 16G Free

and then, with a big compile running:

Swap: 16G Total, 4770M Used, 11G Free, 29% Inuse, 18M In, 2124K Out

And: CPU Throttling

Initially, this metric failed with an error saying something obscure, then disabling later readings with the "not supported" declaration. Hitting the link changes the item to disabled, hitting it again enables the readings to be tried again. Of course, if the underlying glitch isn't fixed the result is again not supported/out of service on the next cycle.

Problem: find(/Raspberry Pi/rpi.cpuThrottled,,"iregexp","\\b(0x0)\\b")=0
Recovery: find(/Raspberry Pi/rpi.cpuThrottled,,"iregexp","\\b(0x0)\\b")=1

Here, the root cause of this issue was self-inflicted, somehow, in pulling down the configuration and transferring into the Zabbix server some kind of code page shift occurred, adding bogus text into the trigger definitions. Right out of the box, this failed with little fanfare. I researched the supplied functions and suspected the fault lie within.

Once I found the configuration details and could save them as above, I edited the parameters to more cogently reflect the expected function output. The output is normally "0x0", meaning zero, and higher hex values have specific meanings. Since the first pattern match always failed, the CPU always appeared throttled incorrectly.

New values:


Disk I/O

min(/pi/[mmcblk0],15m) > {$VFS.DEV.READ.AWAIT.WARN:"mmcblk0"} or
min(/pi/[mmcblk0],15m) > {$VFS.DEV.WRITE.AWAIT.WARN:"mmcblk0"}

Ending up setting the write time to 50ms to avoid pesky un-addressable errors; a future workaround might be to set up storage device classes so that SSD and SD cards are treated individually in terms of known capabilities.

"Linux block devices by Zabbix agent" is the template that contains macros where the above thresholds can be edited.


Gah. I tried it out and Zabbix can go down that net walk with the best. I didn't find anything spectacular or dismal to report on, so this section will be brief.

These temperature values are reported without decimals, so the graph jumps in digital hops rather than spreading around in an analog sweeps. I wasn't that interested in finding out why system temperature was reported and not CPU. There were other temperature values that I'd investigate further once more trends age in place as it were.

Agent "2"

./configure --enable-agent2

Go errors

go: downloading v1.14.8
        imports build constraints exclude all Go files in /u
*** Error code 1

make[3]: stopped in /usr/local/src/zabbix/zabbix-5.4.9/src/go
*** Error code 1

Works on Windows 32/64.

Last thoughts

After letting things settle for a few days, I must say I admire the completeness of the installation, the vision, and the big things that cover the small mistakes. Without reading too many manuals, I was able to set up a variety of monitoring collections that help more than they hinder. The controls to display charts are intuitive, quick, and quite legible. I even found that zooming in on a time segment was as easy as highlighting a period with the pointer (though this action didn't work on an Android device for me).

This chart includes values from 2 sensors on one Raspberry Pi hats, which report in degrees Centigrade. Given the sensors are close enough to be affected by heat from the Pi itself, I added a calculation to return a value as close to ambient as I could manage using a reference thermometer and readings over a period of time. Since the sensor base readings differ, no wonder the results also don't coincide. But they are within one or two degrees (Fahrenheit) and produce useful information. ("Hey, close the door, do you live in a barn?")

Monday, January 10, 2022

NetBSD on a Raspberry Pi 4, Current 2022

After more than one flub, I've gotten through the hoops to make NetBSD run on a Raspberry Pi 4. I had already gotten 2 different working versions on a Pi 3, but the 4 was giving me fits.

All credit goes to the very clear directions from Astro:

Those instructions are reasonably recent, 6 months or so, and the version I pulled down is NetBSD-current from just after New Year's 2022.

Pictures are at the end, as I've given up trying to make google-blogspot do the thing right.


I went through several passes of getting UEFI boot-code onto a micro-SD card that would then allow NetBSD install and reboot onto something other than the limited lifetime SD chip a few months back. OK, it was 2020, but probably also later.

Re: NetBSD/aarch64 on 8 GB Raspberry Pi 4B?

FreeBSD/ARM on the Raspberry Pi familyPi

This time for sure, Rocky.


user@pi:~ $ sudo mkfs.vfat /dev/sdb1 -n UEFI

mkfs.fat 4.2 (2021-01-31)

Install Source

user@pi:~/iso $ sudo dd if=NetBSD-9.99.93-evbarm-aarch64.iso  of=/dev/sda

Worked fine. In the past I've used the die-hard method of burning a CD-RW (or DVD-RW) from the ISO image, and finally evolved to using a USB stick. Alas, when I shopped for SD boot chips, I could not find anything smaller than 32GB, and that was the exact size of the source USB stick I picked out for this attempt. As mentioned in the instructions referenced above, different size devices make the steps easier. Otherwise, you'll do what I did and try to write the OS onto the install device.

I had a 128GB USB micro-stick (about as big as my thumbnail) ready for NetBSD but somewhere along the way that device had been partitioned or initialized in a way the install could not detect it. So, in a shortcut to avoid another shopping trip (or delay for shipping) I connected a 500GB SSD. The adapter is nice in that no extra power is needed, and the Pi supplies enough.

But, the Pi does not supply enough power for an SSD and a spinning external USB-powered CD drive; I saw overcurrent messages on the install startup. Also, don't try to plug in the CD drive after the install has started. It might work, but it might also generate spurious on-screen messages, fouling up the normal curses menu.

-rw-r--r--  1 me   users    11500 Jan  2 23:55 dmesg-netbsd-1.txt

[     1.000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
[     1.000000]     2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
[     1.000000]     2018, 2019, 2020, 2021, 2022
[     1.000000]     The NetBSD Foundation, Inc.  All rights reserved.
[     1.000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[     1.000000]     The Regents of the University of California.  All rights reserved.

[     1.000000] NetBSD 9.99.93 (GENERIC64) #0: Sun Jan  2 23:46:21 UTC 2022
[     1.000000]
[     1.000000] total memory = 2967 MB
[     1.000000] avail memory = 2863 MB
[     1.000000] entropy: ready
[     1.000000] timecounter: Timecounters tick every 10.000 msec
[     1.000000] Kernelized RAIDframe activated
[     1.000000] armfdt0 (root)
[     1.000000] armfdt0: using EFI runtime services for RTC
[     1.000000] simplebus0 at armfdt0: Raspberry Pi Foundation Raspberry Pi 4 Model B
[     1.000000] cpu1 at acpi0: Arm Cortex-A72 r0p3 (v8-A), id 0x1
[     1.000003] bcmmbox0 at acpi0 (RPIQ, BCM2849-0): mem 0xfe00b880-0xfe00b8a3 irq 65
[     1.000003] vcmbox0 at bcmmbox0
[     1.000003] brgphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto

Tire Kicking

As the doc page mentions, X Windows install is broken in some way, and the workaround of un-tarring the distribution files is clear and unambiguous. 

The bash shell is one of the first packages I install on a new OS, and, surprisingly, this didn't work right, complaining about missing object libraries.

netbsd$ bash
bash: Shared object "" not found

This error points to an evolution of the base OS from a prior release, where code progression may require newer support libraries, even something as anciently proscribed as terminfo. Fortunately, I have NetBSD running on pair of Pi 3s (one 9.2 and one -current) and pulled the missing libraries onto the newer system. I'm sure the technically correct method is to recompile the package from source rather than using pre-rolls. But so far, no bash failures.


The usual apps that can be problematic on a new OS or platform include, or me, Firefox, LibreOffice, and VLC. The first 2 work great on the Pi with NetBSD, and the only fault is I haven't gotten audio to work, either through the HDMI or the audio jack (or even with a USB dongle, oddly, since that works on the Pi3).

Kicking off database interfaces through the OpenOffice/LibreOffice/StarOffice suite worked after a bit of wrestling with PostGreSQL knobs and a Java run-time library path. The screens are quite snappy.

Most application packages I tried to throw on the system worked via the pkg interfaces, after putting in a minimal bootstrap of the pkgsrc stack. 


I tried a few classic/legacy benchmark programs, after observing the basic capabilities of complex applications such as LibreOffice, browsing, and Audacity.

Byte script forked 8 shell scripts (I think I expected 4 because number of cores) but it cold be 32, I'm not sure.

Shell Scripts (8 concurrent) -- 4 copies
The machine locked up on this test, where another Pi 4 running FreeBSD didn't glitch. I started looking at the Run script, which led to Perl scripts, and many many other dependencies. I like running these for historic reference ("this would take 4 hours on a Sparc 2"). And it confirms the look and feel of the interface.  On a second test, I got an error message and the chance to take the xload screenshot while the Pi was running.

Real world tests are kicking off YouTube or just browsing stack exchange for answers to questions at hand:

bash-5.1$ time /usr/pkg/java/openjdk8/bin/java jnt.scimark2.commandline

SciMark 2.0a

Composite Score: 13.172917614747846
FFT (1024): 5.155837817236967
SOR (100x100):   23.99097379633297
Monte Carlo : 2.0763881384178022
Sparse matmult (N=1000, nz=5000): 15.568224761205355
LU (100x100): 19.07316356054613

java.vendor: Oracle Corporation
java.version: 1.8.0_292-internal
os.arch: aarch64 NetBSD
os.version: 9.99.93

real    0m23.936s
user    0m22.768s
sys     0m0.101s

For comparison, a 6-core AMD amd64 system has much higher values on this ancient ruler [SciMark 2 from NIST].

$ time /usr/pkg/java/openjdk11/bin/java jnt.scimark2.commandline
Composite Score: 2676.381811111611
FFT (1024): 1141.1453612165665
SOR (100x100):   2196.586040880107
Monte Carlo : 1731.8416382934442
Sparse matmult (N=1000, nz=5000): 2580.1573979710483
LU (100x100): 5732.178617196888

I could not find a newer Java run engine higher than 8 for this base, so it isn't an exact test comparison.


Some old-school trees didn't build but others dropped and ran with non-critical warnings.

cc  -o wermit  ckcmai.o ckclib.o ckutio.o ckufio.o  ckcfns.o ckcfn2.o ckcfn3.o ckuxla.o  ckcpro.o ckucmd.o ckuus2.o ckuus3.o  ckuus4.o ckuus5.o ckuus6.o ckuus7.o  ckuusx.o ckuusy.o ckuusr.o ckucns.o  ckudia.o ckuscr.o ckcnet.o ckusig.o  ckctel.o ckcuni.o ckupty.o ckcftp.o  ckuath.o ck_crp.o ck_ssl.o -lcurses -lcrypt -lm 
ld: ckcmai.o: in function `main':
ckcmai.c:(.text+0x1c6c): warning: warning: reference to compatibility time(); include <time.h> for correct reference
ckcpro.o: in function `wart':
ckcpro.c:(.text+0x8604): relocation truncated to fit: R_AARCH64_LDST64_ABS_LO12_NC against symbol `dest' defined in .bss section in ckcmai.o
ld: ckuusx.c:(.text+0x2548): warning: one possible cause of this error is that the symbol is being referenced in the indicated code as if it had a larger alignment than was declared where it was defined
*** Error code 1
make[1]: stopped in /src/kermit
*** Error code 1
make: stopped in /home/jim/src-local/kermit
       88.93 real        81.54 user         5.50 sys

Kermit compiled partway through on FreeBSD on a Pi 4 in 2 minutes 14 seconds, and failed later in the make on the NetBSD Pi 4 in 89 seconds (45 seconds diff). The former still has a micro-SD but the latter benefits from SSD. As the failure was almost at the end, the time comparison is fair to me. If the install moves on, the wermit executable is renamed to be kermit.

bash-5.1$ bin/smpfbench -n 4
smpfbench 0.5.12:
using 4 fork(s) and 10000 * 10000 loops, run each test 7 times
executing float_div: ....... Approx: 1.138 secs, loops/s: 351571878

ld: /tmp//cceUJ8Lh.o: in function `main':
dhry_1.c:(.text+0x2da): warning: warning: reference to compatibility time(); include <time.h> for correct reference

The temperature readings I found on the Pi 3 with earlier NetBSD kernels has doubled (from 1 metric to 2), as seen in the dmesg text above. The last 2 images below show these track pretty closely, maintaining a small delta.

I still like the bash scripts to create and view data via RRDtool, like this:

TEMP_READING=$(/usr/sbin/envstat -d acpitz0|/usr/bin/tail -1|/usr/bin/awk '{print $3}') ### netbsd

The X ScreenSaver app works on most of the bundled hacks, and is a noticeable load which I shut off when running benchmarks. 

I always think I should benchmark the hacks themselves, as sometimes the heat maps show one doing more CPU work than another. One day.

Java running under the project management suite GanttProject started up and ran without a hitch. Can't wait to see this on a large monitor and build out more details than the old monitor I used to get going.

To Do

  • Figure out font paths in VNC (works from an x86 system but not arm64)
  • Unpeel the perl onion surrounding the Byte benchmark and get valid results
  • Try 2 monitors. I guess you need to buy them in pairs now.
  • Locate a functional USB wi-fi dongle (have one on the 3)
  • Open problem reports if it seems fixable and/or important
  • Refactor shell scripts to perl/python
  • find the "Limit RAM to 3 GB" option and disable it.


Figure 0: boot screen

Figure 1 and 2: photos of the Pi 4, external SSD and X on-screen, plus a USB receptacle.

Figure 1

Figure 2

Figures 3 and 4 are screenshots from the Pi4

Figure 3 via xpaint

Figure 4 xload

Figure 5: Ganttproject 2.x

 Figure 6 and 7 are RRD views of CPU metrics (vcmbox0 and acpitz0).


Friday, December 31, 2021

2021 The Longest Bengies Season Ever, Part 2

Follow-up to Part 1, which covered the winter months from January through March 2021, where the Bengies Theatre season opened months earlier than normal, leading to the longest season. In fact, probably the longest possible season given the drive-in would not operate on a New Years or Christmas week in the beginning or end of the year. How many weeks did they operate? Close to 50, I'd have to think.

April - December

  1. Free Guy
  2. Shang Chi and the Legend of the Ten Rings
  3. Suicide Squad 2021
  4. Ghostbusters Afterlife
  5. Eternals
  6. Respect
  7. No Time To Die
  8. Ron's Gone Wrong
  9. Clifford The Big Red Dog
  10. Space Jam: A New Legacy / The Mask (1994)

That's my top eleven for half (or 3/4) of 2021, in a fairly representative based on my recollections of the film slightly biased by weather, food intake, and crowdedness. 

The top two were shown at the Scout camp-in, our tenth so far. It was great to see first-run features, and other than The Mask, all on this list are new releases (whether planned for 2020 I am unsure). Of the two, I favored Free Guy for the special features and plot twists more than acting or directing.

Suicide Squad had the most imaginative scope even more than a James Bond or the 10 Rings, even. Brutal, and only cathartic if you have the stomach. For drive-in fare: perfect.

The last film we saw in 2021 was the newest Ghostbusters. As a late in life sequel, it had an uphill climb to be digestible, and with the least amount of the old crew as possible, a good tale. I was particularly moved by the many homages and nods to Harold Ramis, even with the modern studio bent to put virtual words and motions into the late population.

Eternals; spouse loved it. Will watch again on blu-ray.

The story of Respect was more hard-hitting than a run-of-the-mill biopic, and I'd have enjoyed it more in an indoor setting for some reason. Maybe not a big-screen epic, a big heart reveal.

Bond. 007. Still going. Great escapism. Expected chases and explosions, not disappointed. Daniel Craig is aging slowly, but I think he's close to done with the franchise.

I would not have included Ron's Gone Wrong if it didn't have that yippie streak of revolt and independence that so reminds me of the 60s. A kids picture with an adult moral. On the surface, about social media and technology, but underneath human social challenges exemplified by loneliness and exclusion.

Clifford, likewise, was adorable enough without major sweetness to quality for inclusion. I needed to get to 10 on the list only for my internal goal. Stretching the year into 2 separate "Top 10" lists required viewing more than (or at least as many as) twenty films through. Leaving 10 minutes into the start doesn't qualify either.

Space Jam hits at the buzzer.


Dune shows up on the marquee photo below in mid-November and I flinched and didn't go then. The bill wasn't held over to the next week, and I regret my call. Sigh. Good or bad, would have stayed through the end.

We saw trailers for Spider-Man which didn't show at the end of the year. Holiday classics took hold, which makes sense given there would be fewer than 100 customers by my guess. 

No images from April through June even though the Bengies didn't close more than a handful of scheduled dates through the whole year. I have the pictures, we just didn't go to those for whatever reason (don't like horror, too much animation, and yes, hard rain).