<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Blog</title>
    <description></description>
    <link>https://katron.org/</link>
    <atom:link href="https://katron.org/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Mon, 23 Sep 2024 19:36:21 -0400</pubDate>
    <lastBuildDate>Mon, 23 Sep 2024 19:36:21 -0400</lastBuildDate>
    <generator>Jekyll v4.3.4</generator>
    
      <item>
        <title>Using FreshRSS&apos;s HTML + XPath with GoComics</title>
        <description>&lt;p&gt;FreshRSS supports scraping a site using XPath to generate new items for a feed.
GoComics does not provide an RSS feed for comics to use but it is possible to use XPath on a comic’s page to get each day’s comic.&lt;/p&gt;

&lt;p&gt;Set the feed URL to the comic’s page (e.g. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;https://www.gocomics.com/fminus&lt;/code&gt; for F Minus).&lt;/p&gt;

&lt;p&gt;Under “Type of feed source”, set these options:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Type of feed source: HTML + XPath (Web scraping)&lt;/li&gt;
  &lt;li&gt;finding news items:
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;//div[contains(@class, &quot;gc-deck--cta-0&quot;)]//picture[contains(@class, &quot;gc-card__image&quot;)]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;item title:
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;parent::h4
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;item content:
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./img
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;item link (URL):
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ancestor::a/@href
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;item thumbnail:
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;descendant::img/@src
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;item author:
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&quot;F Minus&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;Custom date/time format:
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Y.m.d
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is enough to regularly check the GoComics page and fetch each day’s comic.
The title won’t reflect the date and instead be &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;urn:sha1:&amp;lt;sha1 hash&amp;gt;&lt;/code&gt;.
I haven’t figured out why that is but I also don’t care enough to fix it.&lt;/p&gt;
</description>
        <pubDate>Mon, 23 Sep 2024 00:00:00 -0400</pubDate>
        <link>https://katron.org/blog/2024/09/freshrss-gocomics-xpath/</link>
        <guid isPermaLink="true">https://katron.org/blog/2024/09/freshrss-gocomics-xpath/</guid>
        
        <category>freshrss</category>
        
        <category>gocomics</category>
        
        <category>xpath</category>
        
        
      </item>
    
      <item>
        <title>NTP using Raspberry Pi 4 with GPS</title>
        <description>
&lt;h2 id=&quot;hardware&quot;&gt;Hardware&lt;/h2&gt;
&lt;h3 id=&quot;parts&quot;&gt;Parts&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/product/4292&quot;&gt;Raspberry Pi 4&lt;/a&gt;.
Any Raspberry Pi Model B will work. The Pi 4 moved the Ethernet to PCIe from USB so that will be less jitter for LAN traffic.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/product/3953&quot;&gt;PoE HAT&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/product/2324&quot;&gt;Ultimate GPS HAT for Raspberry Pi&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;4x 15+5 mm M2.5 brass standoffs.
I bought a large package of multiple sizes on Amazon.
You need a 15 mm tall standoff for the stacking header below.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/product/2223&quot;&gt;GPIO Stacking Header&lt;/a&gt;.
This is the “Extra-long 2x20” version with 10 mm pins.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/product/4855&quot;&gt;GPIO Female Socket Riser Header&lt;/a&gt;.
With the GPIO pins higher up, the PoE pins also need a header to reach the PoE HAT.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/product/851&quot;&gt;SMA to uFL RF Adapter Cable&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.adafruit.com/product/960&quot;&gt;GPS Antenna&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also got a &lt;a href=&quot;https://www.adafruit.com/product/3083&quot;&gt;heatsink&lt;/a&gt; for the Raspberry Pi so the fan on the PoE HAT would not need to run as much.
Once everything was assembled, there was about 2 mm of clearance between the fan and the GPS HAT.&lt;/p&gt;

&lt;p&gt;I ordered almost everything from Adafruit because they are close by so shipping is fast.&lt;/p&gt;

&lt;h3 id=&quot;assembly&quot;&gt;Assembly&lt;/h3&gt;

&lt;p&gt;The Ultimate GPS HAT required soldering the included header.
I have seen other GPS HATs that do not require soldering if that is a problem.
I opted for this one because I had the tools, this is what Adafruit had, and rather wanted to try soldering.&lt;/p&gt;

&lt;p&gt;Here is a component overview with everything that went into the build.
The heatsink has already been applied.
&lt;img src=&quot;/images/raspberry-pi-gps/component-overview.jpg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Connect the stacking and 2x2 headers then attach the PoE HAT to them with the 15 mm standoffs to verify the PoE HAT works.
The pins on the stacking header will go through the PoE HAT.
&lt;img src=&quot;/images/raspberry-pi-gps/rpi4-poe-hat.jpg&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Use the standoffs included with the PoE HAT on top of the HAT and attach the GPS HAT on top of PoE and use the PoE HAT’s screws to secure everything together.&lt;/p&gt;

&lt;p&gt;The PoE HAT was a bit finicky to use.
The first time I connected the PoE HAT, everything was fine.
I then disconnected everything for pictures, reconnected everything, soldered the header to the GPS HAT, and then the PoE HAT didn’t power on the Pi.
I disconnected everything yet again, connected only the PoE HAT, and it worked again.
I connected the GPS HAT a second time and it still worked so I don’t know what happened before.&lt;/p&gt;

&lt;h2 id=&quot;software&quot;&gt;Software&lt;/h2&gt;

&lt;p&gt;All of the steps assume Raspbian 10 (Buster).
Adjust the packages to install to your distro of choice if you are not using Raspbian.
The configuration of the software should remain very similar.&lt;/p&gt;

&lt;p&gt;Install everything needed now at once.
I opted for chrony but NTP works well and needs only small translations of the chrony options.
Contrary to all other documentation I have seen on this, &lt;em&gt;you do not need to compile anything from scratch&lt;/em&gt;.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo apt install chrony gpsd gpsd-clients pps-tools
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;serial-port&quot;&gt;Serial Port&lt;/h3&gt;

&lt;p&gt;The serial port is used to receive the &lt;a href=&quot;https://gpsd.gitlab.io/gpsd/NMEA.html&quot;&gt;NMEA 0183&lt;/a&gt; data from the GPS device.
Logging in from the serial port must be disabled but the serial hardware kept enabled for communication.&lt;/p&gt;

&lt;p&gt;Run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo raspi-config&lt;/code&gt;, choose “Interface Options”.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo raspi-config
┌─────────┤ Raspberry Pi Software Configuration Tool (raspi-config) ├──────────┐
│                                                                              │
│       1 System Options       Configure system settings                       │
│       2 Display Options      Configure display settings                      │
│       3 Interface Options    Configure connections to peripherals            │
│       4 Performance Options  Configure performance settings                  │
│       5 Localisation Options Configure language and regional settings        │
│       6 Advanced Options     Configure advanced settings                     │
│       8 Update               Update this tool to the latest version          │
│       9 About raspi-config   Information about this configuration tool       │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                     &amp;lt;Select&amp;gt;                     &amp;lt;Finish&amp;gt;                    │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Then choose “Serial Port”.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;┌─────────┤ Raspberry Pi Software Configuration Tool (raspi-config) ├──────────┐
│                                                                              │
│    P1 Camera      Enable/disable connection to the Raspberry Pi Camera       │
│    P2 SSH         Enable/disable remote command line access using SSH        │
│    P3 VNC         Enable/disable graphical remote access using RealVNC       │
│    P4 SPI         Enable/disable automatic loading of SPI kernel module      │
│    P5 I2C         Enable/disable automatic loading of I2C kernel module      │
│    P6 Serial Port Enable/disable shell messages on the serial connection     │
│    P7 1-Wire      Enable/disable one-wire interface                          │
│    P8 Remote GPIO Enable/disable remote access to GPIO pins                  │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                                                                              │
│                     &amp;lt;Select&amp;gt;                     &amp;lt;Back&amp;gt;                      │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Select “No” to disable the login shell over serial port and then “Yes” to keep the serial port hardware enabled.
Press Tab to select “Finish”.
The utility will prompt you to reboot so do that.&lt;/p&gt;

&lt;p&gt;Once the Pi comes back up, it is time to test the GPS HAT.
Set the mode for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/serial0&lt;/code&gt; to raw, 9600 baud, 8 bits, no modem control signals, and one stop bit.
See the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stty(1)&lt;/code&gt; man page for more information on everything.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo stty -F /dev/serial0 raw 9600 cs8 clocal -cstopb
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now check &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/serial0&lt;/code&gt; to verify NMEA data appears.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ cat /dev/serial0
0.15,81.69,210821,,,A*56
$GNVTG,81.69,T,,M,0.15,N,0.28,K,A*1B
$GNGGA,154540.000,4XXX.XXXX,N,07XXX.XXXX,W,1,11,0.92,1XX.X,M,-34.2,M,,*4E
$GPGSA,A,3,02,05,20,06,19,09,,,,,,,1.25,0.92,0.84*01
$GLGSA,A,3,65,87,88,71,72,,,,,,,,1.25,0.92,0.84*10
$GNRMC,154540.000,A,4XXX.XXXX,N,07XXX.XXXX,W,0.57,81.69,210821,,,A*57
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;There should be output regardless if there is a fix or not.
Once there is a fix, more of the GPS data will be filled in with much less “mostly comma” output.
This HAT has a LED that will blink every second when it is searching and slow to blinking every 15 seconds when it has a fix.&lt;/p&gt;

&lt;p&gt;I was able to get a fix within a few minutes while indoors, 20 feet from a window, and without attaching the external antenna.&lt;/p&gt;

&lt;h4 id=&quot;one-pulse-per-second-1pps&quot;&gt;One Pulse Per Second (1PPS)&lt;/h4&gt;

&lt;p&gt;Use the pps-tools package to monitor the 1 Pulse Per Second GPS sends to get exactly when each GPS second begins.&lt;/p&gt;

&lt;p&gt;Edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/boot/config.txt&lt;/code&gt; to enable kernel support for PPS.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/boot/overlays/README&lt;/code&gt; documents the available overlays and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pps-gpio&lt;/code&gt; is listed in there.
The Adafruit GPS HAT uses GPIO pin 4 so add that to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;config.txt&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dtoverlay=pps-gpio,gpiopin=4
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Reboot to use the overlay.&lt;/p&gt;

&lt;p&gt;When the Pi boots up, test the signal is received with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ppstest&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo ppstest /dev/pps0
trying PPS source &quot;/dev/pps0&quot;
found PPS source &quot;/dev/pps0&quot;
ok, found 1 source(s), now start fetching data...
source 0 - assert 1629489053.004789031, sequence: 98 - clear  0.000000000, sequence: 0
source 0 - assert 1629489054.004796073, sequence: 99 - clear  0.000000000, sequence: 0
source 0 - assert 1629489055.004806575, sequence: 100 - clear  0.000000000, sequence: 0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;gpsd&quot;&gt;GPSD&lt;/h3&gt;

&lt;p&gt;The gpsd package includes a &lt;a href=&quot;https://www.freedesktop.org/software/systemd/man/systemd.socket.html&quot;&gt;systemd socket unit file&lt;/a&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gpsd.socket&lt;/code&gt;, for systemd to automatically start GPSD when something connects to the default GPSD port of 2947.
This is useful for regular GPS use but can be frustrating when debugging.
My advice is to stop (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo systemctl stop gpsd.socket&lt;/code&gt;) and disable (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sudo systemctl disable gpsd.socket&lt;/code&gt;) the unit file if you need to debug GPSD.
Leaving &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gpsd.socket&lt;/code&gt; disabled will be fine for timekeeping because &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gpsd.service&lt;/code&gt; will be used instead.&lt;/p&gt;

&lt;p&gt;Edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/default/gpsd&lt;/code&gt; to set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;DEVICES&lt;/code&gt; to use the serial port to receive GPS NMEA data and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pps0&lt;/code&gt; device to receive the kernel’s PPS.
Also set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GPSD_OPTIONS&lt;/code&gt; to tell GPSD to immediately talk to the device and not wait for a client to connect.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;DEVICES=&quot;/dev/serial0 /dev/pps0&quot;
GPSD_OPTIONS=&quot;-n&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Restart GPSD to use those devices and enable it to start automatically at boot.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo systemctl restart gpsd.service
$ sudo systemctl enable gpsd.service
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gpsmon&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cgps -s&lt;/code&gt; to connect to GPSD and display the GPS information.
Check for PPS data and PPS lines to appear in the packet log.
&lt;em&gt;Note&lt;/em&gt;, if the terminal is 24 lines tall, you will only see a single line of the packet log and it will be difficult to spot the PPS line.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ gpsmon
tcp://localhost:2947          NMEA0183&amp;gt;
┌──────────────────────────────────────────────────────────────────────────────┐
│Time: 2021-08-22T21:53:45.000Z Lat:  XX XX&apos; XX.XXXX0&quot; Non:  XX XX&apos; XX.XXXX0&quot; W│
└───────────────────────────────── Cooked TPV ─────────────────────────────────┘
┌──────────────────────────────────────────────────────────────────────────────┐
│ GPGST GNGGA GPGSA GLGSA GNRMC GNZDA GPGRS GPGSV GLGSV                        │
└───────────────────────────────── Sentences ──────────────────────────────────┘
┌──────────────────┐┌────────────────────────────┐┌────────────────────────────┐
│Ch PRN  Az El S/N ││Time:      215345.000       ││Time:      215345.000       │
│ 0  XX  XX XX  41 ││Latitude:     4XXX.XXXX N   ││Latitude:  4XXX.XXXX        │
│ 1  XX  XX XX  37 ││Longitude:   07XXX.XXXX W   ││Longitude: 07XXX.XXXX       │
│ 2  XX XXX XX  28 ││Speed:     0.26             ││Altitude:  1XX.X            │
│ 3  XX XXX XX  36 ││Course:    94.750           ││Quality:   1   Sats: 08     │
│ 4  XX XXX XX  27 ││Status:    A       FAA: A   ││HDOP:      1.17             │
│ 5  XX  XX XX  21 ││MagVar:                     ││Geoid:     -34.2            │
│ 6  XX XXX XX   0 │└─────────── RMC ────────────┘└─────────── GGA ────────────┘
│ 7  XX XXX XX   0 │┌────────────────────────────┐┌────────────────────────────┐
│ 8  XX XXX XX   0 ││Mode: A3 Sats: 23 24 10 18  ││UTC: 215345.000RMS: 7.3     │
│ 9 XXX  XX XX   0 ││DOP: H=1.17  V=0.91  P=1.48 ││MAJ: 4.5       MIN: 4.0     │
│10  XX  XX XX  40 ││TOFF:  0.319084138          ││ORI: 164.5     LAT: 4.4     │
│11  XX 1XX XX  37 ││PPS:  0.000759500           ││LON: 4.1       ALT: 24      │
└────── GSV ───────┘└──────── GSA + PPS ─────────┘└─────────── GST ────────────┘
(72) $GPGRS,215344.000,1,-5.93,-0.14,0.83,36.9,3.35,9.75,-0.36,-2.94,,,,*72
(51) $GPGST,215344.000,7.4,4.4,3.9,150.3,4.3,4.0,23*40
------------------- PPS offset:  0.000759500 ------
(75) $GNGGA,215345.000,4XXX.XXXX,N,07XXX.XXXX,W,1,08,1.17,1XX.X,M,-34.2,M,,*4E
(52) $GPGSA,A,3,23,18,24,15,10,,,,,,,,1.48,1.17,0.91*0B
(48) $GLGSA,A,3,69,78,68,,,,,,,,,,1.48,1.17,0.91*12
(71) $GNRMC,215345.000,A,4XXX.XXXX,N,07XXX.XXXX,W,0.26,94.75,220821,,,A*5E
(35) $GNZDA,215345.000,22,08,2021,,*45
(71) $GPGRS,215345.000,1,-5.51,0.95,0.27,37.1,2.82,10.6,-2.84,-3.96,,,,*57
(51) $GPGST,215345.000,7.3,4.5,4.0,164.5,4.4,4.1,24*49
------------------- PPS offset:  0.000758989 ------
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note the “PPS offset” lines and the PPS time offset in the display.
That means GPSD is receiving everything and can send the data to the desired timekeeping daemon.&lt;/p&gt;

&lt;h2 id=&quot;timekeeping&quot;&gt;Timekeeping&lt;/h2&gt;

&lt;p&gt;Before configuring chrony, run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ntpshmmon&lt;/code&gt; as root to find the shared memory (SHM) sources that GPSD is already populating.
Despite its name starting with “ntp”, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ntpshmmon&lt;/code&gt; is part of the gpsd package.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo ntpshmmon
ntpshmmon version 1
#      Name Seen@                Clock                Real                 L Prec
sample NTP0 1629680609.372849180 1629680608.363601521 1629680608.000000000 0 -20
sample NTP2 1629680609.373066773 1629680609.041970056 1629680609.000000000 0 -30
sample NTP0 1629680609.385268612 1629680609.384725334 1629680609.000000000 0 -20
sample NTP2 1629680610.042570932 1629680610.041973357 1629680610.000000000 0 -30
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The precision (Prec) field is the precision of the clock scaled with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;log(2)&lt;/code&gt;.
The lower the value in the precision column, the more accurate that clock is.&lt;/p&gt;

&lt;p&gt;Usually the NMEA clock is at NTP0 and 1PPS is at NTP1.
With this HAT the 1PPS appears at NTP2 (note the more accurate precision of -30 vs -20).&lt;/p&gt;

&lt;h3 id=&quot;chrony&quot;&gt;chrony&lt;/h3&gt;

&lt;p&gt;Edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/chrony/chrony.conf&lt;/code&gt; to use the clocks from GPSD.
I kept the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pool&lt;/code&gt; line to allow chrony to synchronize with hosts over the internet until it can determine the accuracy of the PPS clock.
The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;precision&lt;/code&gt; is because chrony cannot read the precision from the shared memory segments.
The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delay&lt;/code&gt; is because the GPS NMEA data is read over a relatively slow serial port and the larger delay allows greater range for overlap when reading the two clocks.
I will adjust it later once its offset is known.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;refclock SHM 0 refid GPS precision 1e-1 delay 0.1
refclock SHM 2 refid PPS precision 1e-7
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Restart chrony.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo systemctl restart chrony.service
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now wait a while and check periodically to see if chrony picked the PPS clock.
When it does, “PPS” clock will have the prefix be &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;#*&lt;/code&gt;.
Any other sources mixed in with the chosen source will have a prefix of “+” while a prefix of “-“ or “x” are excluded sources.&lt;/p&gt;

&lt;p&gt;I added the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-n&lt;/code&gt; argument to make &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chronyc&lt;/code&gt; not try to resolve the IPs to display the output faster.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ chronyc -n sources
210 Number of sources = 6
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
#x GPS                           0   4   377    17   +387ms[ +387ms] +/-  150ms
#* PPS                           0   4   377    18   -592ns[-1062ns] +/-  851ns
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After waiting for sample times to settle, I used the offset under the “Last sample” column to set an offset for the GPS NMEA clock in the config to bring it closer to the PPS clock and prevent chrony from classifying it as a “falseticker” (the “x” in “#x”).&lt;/p&gt;

&lt;p&gt;Edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/chrony/chrony.conf&lt;/code&gt; to set an offset and then restart &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;chrony.service&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;refclock SHM 0 refid GPS precision 1e-1 offset 0.370
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Note the addition of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;offset&lt;/code&gt; to add a fixed offset to that clock and the removal of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;delay&lt;/code&gt; because the clock is approximately correct with an offset.&lt;/p&gt;

&lt;h2 id=&quot;serving-time&quot;&gt;Serving Time&lt;/h2&gt;
&lt;p&gt;If you are not interested in using the Raspberry Pi as a time server then you are done.
If you are interested, continue onwards.&lt;/p&gt;

&lt;h3 id=&quot;chrony-1&quot;&gt;chrony&lt;/h3&gt;
&lt;p&gt;Edit &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/chrony/chrony.conf&lt;/code&gt; to enable other clients to connect to chronyd.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;allow 192.168.0.0/24
# If you also have IPv6 on the subnet.
allow 2600:8394:a947:bf::/64
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Restart chrony to enable serving time.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo systemctl restart chrony.service
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;dhcp&quot;&gt;DHCP&lt;/h3&gt;

&lt;p&gt;I use pfSense as a router and first set the Raspberry Pi to have a fixed IP address and then added that IP address as an NTP server on the LAN interface.
My Fedora laptop automatically picked up the new NTP server but a different Raspberry Pi running Debian and a FreeBSD server did not.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ chronyc -n sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^? ...
^* 192.168.0.4                   1   9   377   469    -11us[ -114us] +/- 1260us
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That is almost one millisecond accuracy over WiFi.
The other Raspberry Pi averages 300 µs accuracy over Ethernet.&lt;/p&gt;

&lt;h2 id=&quot;sources&quot;&gt;Sources&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://learn.adafruit.com/adafruit-ultimate-gps-hat-for-raspberry-pi/basic-test&quot;&gt;Adafruit Ultimate GPS HAT for Raspberry Pi Tutorial&lt;/a&gt;.
This was useful for setting up the Raspberry Pi’s serial port and checking the serial device. The tutorial used &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/ttyAMA0&lt;/code&gt; but it’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/ttyS0&lt;/code&gt; on Raspberry Pi 3 and newer.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://unixwiz.net/techtips/raspberry-pi3-gps-time.html&quot;&gt;Steve Friedl’s  Building a GPS Time Server with the Raspberry Pi 3&lt;/a&gt;
I found this helpful as proof that everything would work.
He used a Raspberry Pi 3 but the same HAT.&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://gpsd.gitlab.io/gpsd/gpsd-time-service-howto.html&quot;&gt;GPSD Time Service HOWTO&lt;/a&gt;
This was invaluable for learning how GPSD interacted with chrony and NTP.
How to configure the two time keeping daemons was pulled from this site.
Additional information on tuning performance is also available.&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Fri, 15 Oct 2021 00:00:00 -0400</pubDate>
        <link>https://katron.org/blog/2021/10/raspberry-pi-gps/</link>
        <guid isPermaLink="true">https://katron.org/blog/2021/10/raspberry-pi-gps/</guid>
        
        <category>raspberry pi</category>
        
        <category>gps</category>
        
        <category>ntp</category>
        
        
      </item>
    
      <item>
        <title>MPT BIOS Fault 05h encountered at adapter PCI(02h,00h,00h)</title>
        <description>&lt;p&gt;I noticed a drive failed in my NAS recently.
I have a SuperMicro 826 chassis with the SAS backplane that has activity and failure lights.
Rather than checking all of the drives manually, I wanted to activate the failure light for that slot and pull a single drive.&lt;/p&gt;

&lt;p&gt;Long story short, I ended up breaking the onboard firmware plus had to pull all of the drives to check the serial manually.
Check the end for the solution.&lt;/p&gt;

&lt;p&gt;I followed &lt;a href=&quot;https://dan.langille.org/2016/11/03/flashing-an-lsi-sas-9201-16i/&quot;&gt;Dan Langille’s&lt;/a&gt; guide to flashing the firmware using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mpsutil&lt;/code&gt;.
The flashing succeeded but no change in the ability to activate any failure lights.
I tried again using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sas2flash&lt;/code&gt; and it went poorly as it finished.
The flashing again went okay but when &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sas2flash&lt;/code&gt; tried to reset the LSI controller, the kernel crashed.
The controller was attached to the front SAS enclosure that contained all of the drives for the system, including for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/&lt;/code&gt;.
That in retrospect wasn’t a good idea.&lt;/p&gt;

&lt;p&gt;Once the system rebooted, I was greeted with this alarming message:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Unable to load LSI Corporation MPT BIOS
MPT BIOS Fault 05h encountered at adapter PCI(02h,00h,00h)
Press any key to continue...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;megarec&lt;/code&gt; utility couldn’t find the controller at all so I feared I had bricked it.
Turned out I was simply using the wrong tools to find and flash the controller.
The Mega* utilities are for the MegaRAID firmware while the onboard controller always had the basic IT firmware.
Instead I needed &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sas2flash&lt;/code&gt; the entire time.&lt;/p&gt;

&lt;p&gt;I tried flashing with other LSI firmware files for the 2116 but they never fully succeeded.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sas2flsh.exe&lt;/code&gt; (I was running in FreeDOS now) always ended with an error like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Chip is in RESET state.  Attempting Host Boot...
ERROR: Firmware Host Boot Failed !
Due to error remaining commands will not be executed.
Unable to Process Commands.
Exiting SAS2Flash.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;solution&quot;&gt;Solution&lt;/h3&gt;

&lt;p&gt;SuperMicro’s site has the P19 firmware but someone at ServeTheHome got the P20 firmware from SuperMicro and &lt;a href=&quot;https://forums.servethehome.com/index.php?threads/upgrade-lsi-2116it-in-x10sdv-4c-7tp4f-to-p20.14211/&quot;&gt;posted it on the site&lt;/a&gt;.
The format of the files is a bit different but the ROM files worked perfectly with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sas2flsh.exe&lt;/code&gt;.
I copied the extracted files from the zip to a FreeDOS live CD and followed the commands from the BAT file.
One of the commands (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sas2flsh -e 7&lt;/code&gt;) cleared the &lt;em&gt;entire&lt;/em&gt; firmware, including the SAS address.
I had written down the SAS address before so I could recover the original one but the erasing wasn’t necessary in the first place.
I wrote the firmware then the BIOS and rebooted.
The LSI BIOS loaded successfully and FreeBSD was able to use the controller once again.&lt;/p&gt;

</description>
        <pubDate>Thu, 09 Sep 2021 00:00:00 -0400</pubDate>
        <link>https://katron.org/blog/2021/09/supermicro-onboard-lsi-2116/</link>
        <guid isPermaLink="true">https://katron.org/blog/2021/09/supermicro-onboard-lsi-2116/</guid>
        
        <category>freebsd</category>
        
        <category>lsi 2116</category>
        
        <category>sas2flash</category>
        
        <category>supermicro</category>
        
        
      </item>
    
      <item>
        <title>Upgrade Nexus 4 to LineageOS 16.0</title>
        <description>
&lt;p&gt;I recently found my Nexus 4 after the move and wanted to get it usable again.
It was running the last official version of Android, 5.1.1, for the device from November 2014.
LineageOS dropped support for it several years ago, the device was released in 2012, so I hoped to find either the last nightly build or an unofficial build of something more recent.
I found &lt;a href=&quot;https://lineageosroms.com/mako/&quot;&gt;an install guide&lt;/a&gt; for the device that I used when installing LineageOS.&lt;/p&gt;

&lt;h2 id=&quot;partitioning&quot;&gt;Partitioning&lt;/h2&gt;

&lt;p&gt;First however, I needed to repartition &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/system&lt;/code&gt; because the original partition size was no longer large enough.
There were scripts out there to manage the partitioning but as an experienced Linux sysadmin I opted to do it myself.
I also didn’t search hard and realize the scripts existed before trying.&lt;/p&gt;

&lt;p&gt;I installed &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;android-tools&lt;/code&gt; from Fedora’s repositories, plugged in the phone, and got it work.
I could &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb reboot&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb shell&lt;/code&gt; all I wanted but &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fastboot&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb sideload&lt;/code&gt; refused to work.
The install guide mentioned this so I connected through a USB 3.0 hub and that fixed all of the sideload and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fastboot&lt;/code&gt; problems.&lt;/p&gt;

&lt;p&gt;With &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fastboot&lt;/code&gt; working, I booted the &lt;a href=&quot;https://twrp.me/lg/lgnexus4.html&quot;&gt;latest TWRP image for the Nexus 4&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# adb reboot bootloader
# fastboot boot /path/to/tmp/lineageos/twrp-3.5.2_9-0-mako.img
Sending &apos;boot.img&apos; (10528 KB)                      OKAY [  0.431s]
Booting                                            OKAY [  0.030s]
Finished. Total time: 0.486s
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;From &lt;a href=&quot;https://forum.xda-developers.com/t/rom-unofficial-lineageos-16-0-mako.3758779/&quot;&gt;an unofficial image thread&lt;/a&gt;, I knew I needed &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/system&lt;/code&gt; to be at least 1272 MB.
I ran &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;adb shell&lt;/code&gt;, mounted &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/system&lt;/code&gt;, and checked its size to see it was only 827 MB.
&lt;a href=&quot;https://android.stackexchange.com/questions/216123/android-how-to-increase-system-partition-and-decrease-data-partition&quot;&gt;Following an answer on Android StackExchange on repartitioning a different device&lt;/a&gt;, I set out to increase &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/system&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I pushed a statically linked &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;parted&lt;/code&gt; (I didn’t need &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gdisk&lt;/code&gt; but pushed it anyway).&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# adb push /path/to/tmp/lineageos/parted /
/path/to/tmp/lineageos/parted: 1 file pushed, 0 skipped. 591.9 MB/s (464372 bytes in 0.001s)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now shell in, mark &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/parted&lt;/code&gt; as executable for later, and check the partition layout.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# adb shell
~ # chmod +x /parted
~ # fdisk -l /dev/block/mmcblk0
Found valid GPT with protective MBR; using GPT

Disk /dev/block/mmcblk0: 30777344 sectors, 2740M
Logical sector size: 512
Disk identifier (GUID): 98101b32-bbe2-4bf2-a06e-2bb33d000c20
Partition table holds up to 28 entries
First usable sector is 34, last usable sector is 30777310

Number  Start (sector)    End (sector)  Size       Code  Name
   1            1024          132095       64.0M   0700  modem
   2          132096          133119        512K   0700  sbl1
   3          133120          134143        512K   0700  sbl2
   4          134144          138239       2048K   0700  sbl3
   5          138240          139263        512K   0700  tz
   6          139264          184319       22.0M   0700  boot
   7          184320          229375       22.0M   0700  recovery
   8          229376          230935        780K   0700  m9kefs1
   9          230936          232495        780K   0700  m9kefs2
  10          232496          234055        780K   0700  m9kefs3
  11          234496          235519        512K   0700  rpm
  12          235520          236543        512K   0700  aboot
  13          236544          237567        512K   0700  sbl2b
  14          237568          241663       2048K   0700  sbl3b
  15          241664          242687        512K   0700  abootb
  16          242688          243711        512K   0700  rpmb
  17          243712          244735        512K   0700  tzb
  18          244736          245759        512K   0700  metadata
  19          245760          278527       16.0M   0700  misc
  20          278528          311295       16.0M   0700  persist
  21          311296         2031615        840M   0700  system
  22         2031616         3178495        560M   0700  cache
  23         3178496        30775295       13.1G   0700  userdata
  24        30775296        30776319        512K   0700  DDR
  25        30776320        30777310        495K   0700  grow
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/system&lt;/code&gt; is partition 21.
In order to resize it, I need to move at least the next partition.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/cache&lt;/code&gt; is next but at 560 MB, it was not large enough and I would also need to shrink userdata (or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/data&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;I saved the above layout in case I needed to redo it exactly.
&lt;strong&gt;NOTE&lt;/strong&gt;, I already unlocked the bootloader and wiped everything but if you haven’t, this will reformat and lose everything and you must start from scratch.&lt;/p&gt;

&lt;p&gt;Unmount partitions 21, 22, and 23 if mounted.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;~ # df -h
Filesystem                Size      Used Available Use% Mounted on
tmpfs                   935.1M     20.0K    935.1M   0% /dev
tmpfs                   935.1M     16.0K    935.1M   0% /tmp
/dev/block/mmcblk0p23
                         12.9G    129.6M     12.8G   1% /data
/dev/block/mmcblk0p23
                         12.9G    129.6M     12.8G   1% /sdcard
/dev/block/mmcblk0p22
                        551.7M      9.8M    541.9M   2% /cache
~ # umount /sdcard /data /cache
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Delete partitions 21, 22, and 23.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;~ # /parted /dev/block/mmcblk0
GNU Parted 3.2
Using /dev/block/mmcblk0
...
(parted) print
Error: The backup GPT table is corrupt, but the primary appears OK, so that will
be used.
OK/Cancel? ok
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The backup GPT being corrupt was disconcerting but I couldn’t do anything about it so accepted and continued onward.
The StackExchange answer used &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;parted&lt;/code&gt;’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;resizepart&lt;/code&gt; but that only works if there’s space after the partition.
There is zero free space here so must delete and recreate.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Model: MMC 016G92 (sd/mmc)
Disk /dev/block/mmcblk0: 15.8GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name      Flags
 1      524kB   67.6MB  67.1MB  fat16        modem     msftdata
 2      67.6MB  68.2MB  524kB                sbl1
 3      68.2MB  68.7MB  524kB                sbl2
 4      68.7MB  70.8MB  2097kB               sbl3
 5      70.8MB  71.3MB  524kB                tz
 6      71.3MB  94.4MB  23.1MB               boot
 7      94.4MB  117MB   23.1MB               recovery
 8      117MB   118MB   799kB                m9kefs1
 9      118MB   119MB   799kB                m9kefs2
10      119MB   120MB   799kB                m9kefs3
11      120MB   121MB   524kB                rpm
12      121MB   121MB   524kB                aboot
13      121MB   122MB   524kB                sbl2b
14      122MB   124MB   2097kB               sbl3b
15      124MB   124MB   524kB                abootb
16      124MB   125MB   524kB                rpmb
17      125MB   125MB   524kB                tzb
18      125MB   126MB   524kB                metadata
19      126MB   143MB   16.8MB               misc
20      143MB   159MB   16.8MB  ext4         persist
21      159MB   1040MB  881MB   ext4         system
22      1040MB  1627MB  587MB   ext4         cache
23      1627MB  15.8GB  14.1GB  ext4         userdata
24      15.8GB  15.8GB  524kB                DDR
25      15.8GB  15.8GB  507kB                grow

(parted) rm 21
(parted) rm 22
(parted) rm 23
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I switched the units to sectors to get the partition math exactly correct.
I did not think using MB, or anything other than only B(ytes), would be precise enough and using bytes could cause a partition to not end on a sector boundary.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;parted&lt;/code&gt; warned if I did not end on a good boundary, I think every 2 MB?
When doing the sector math, I ensured the three partitions ended on a 2 MB boundary and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;parted&lt;/code&gt; was satisfied.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;(parted) unit S
(parted) print
Model: MMC 016G92 (sd/mmc)
Disk /dev/block/mmcblk0: 30777344s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start      End        Size      File system  Name      Flags
 1      1024s      132095s    131072s   fat16        modem     msftdata
 2      132096s    133119s    1024s                  sbl1
 3      133120s    134143s    1024s                  sbl2
 4      134144s    138239s    4096s                  sbl3
 5      138240s    139263s    1024s                  tz
 6      139264s    184319s    45056s                 boot
 7      184320s    229375s    45056s                 recovery
 8      229376s    230935s    1560s                  m9kefs1
 9      230936s    232495s    1560s                  m9kefs2
10      232496s    234055s    1560s                  m9kefs3
11      234496s    235519s    1024s                  rpm
12      235520s    236543s    1024s                  aboot
13      236544s    237567s    1024s                  sbl2b
14      237568s    241663s    4096s                  sbl3b
15      241664s    242687s    1024s                  abootb
16      242688s    243711s    1024s                  rpmb
17      243712s    244735s    1024s                  tzb
18      244736s    245759s    1024s                  metadata
19      245760s    278527s    32768s                 misc
20      278528s    311295s    32768s    ext4         persist
21      311296s    2811295s   2500000s  ext4         system
24      30775296s  30776319s  1024s                  DDR
25      30776320s  30777310s  991s                   grow

(parted) mkpart primary ext4 311296s 3178495s
(parted) mkpart primary ext4 3178496s 4202495s
(parted) mkpart primary ext4 4202496s 30775295s
(parted) print
Model: MMC 016G92 (sd/mmc)
Disk /dev/block/mmcblk0: 30777344s
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start      End        Size       File system  Name      Flags
 1      1024s      132095s    131072s    fat16        modem     msftdata
 2      132096s    133119s    1024s                   sbl1
 3      133120s    134143s    1024s                   sbl2
 4      134144s    138239s    4096s                   sbl3
 5      138240s    139263s    1024s                   tz
 6      139264s    184319s    45056s                  boot
 7      184320s    229375s    45056s                  recovery
 8      229376s    230935s    1560s                   m9kefs1
 9      230936s    232495s    1560s                   m9kefs2
10      232496s    234055s    1560s                   m9kefs3
11      234496s    235519s    1024s                   rpm
12      235520s    236543s    1024s                   aboot
13      236544s    237567s    1024s                   sbl2b
14      237568s    241663s    4096s                   sbl3b
15      241664s    242687s    1024s                   abootb
16      242688s    243711s    1024s                   rpmb
17      243712s    244735s    1024s                   tzb
18      244736s    245759s    1024s                   metadata
19      245760s    278527s    32768s                  misc
20      278528s    311295s    32768s     ext4         persist
21      311296s    3178495s   2867200s   ext4
22      3178496s   4202495s   1024000s   ext4
23      4202496s   30775295s  26572800s  ext4
24      30775296s  30776319s  1024s                   DDR
25      30776320s  30777310s  991s                    grow

(parted) name 21 system
(parted) name 22 cache
(parted) name 23 userdata
(parted) unit MB
(parted) print
Model: MMC 016G92 (sd/mmc)
Disk /dev/block/mmcblk0: 15758MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start    End      Size     File system  Name      Flags
 1      0.52MB   67.6MB   67.1MB   fat16        modem     msftdata
 2      67.6MB   68.2MB   0.52MB                sbl1
 3      68.2MB   68.7MB   0.52MB                sbl2
 4      68.7MB   70.8MB   2.10MB                sbl3
 5      70.8MB   71.3MB   0.52MB                tz
 6      71.3MB   94.4MB   23.1MB                boot
 7      94.4MB   117MB    23.1MB                recovery
 8      117MB    118MB    0.80MB                m9kefs1
 9      118MB    119MB    0.80MB                m9kefs2
10      119MB    120MB    0.80MB                m9kefs3
11      120MB    121MB    0.52MB                rpm
12      121MB    121MB    0.52MB                aboot
13      121MB    122MB    0.52MB                sbl2b
14      122MB    124MB    2.10MB                sbl3b
15      124MB    124MB    0.52MB                abootb
16      124MB    125MB    0.52MB                rpmb
17      125MB    125MB    0.52MB                tzb
18      125MB    126MB    0.52MB                metadata
19      126MB    143MB    16.8MB                misc
20      143MB    159MB    16.8MB   ext4         persist
21      159MB    1627MB   1468MB   ext4         system
22      1627MB   2152MB   524MB    ext4         cache
23      2152MB   15757MB  13605MB  ext4         userdata
24      15757MB  15757MB  0.52MB                DDR
25      15757MB  15758MB  0.51MB                grow
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Partitions created.
I shrunk &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/cache&lt;/code&gt; from 587 MB to 524 MB and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/data&lt;/code&gt; from 14.1 GB to 13.6 GB.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/system&lt;/code&gt; went from 881 MB to 1468 MB.&lt;/p&gt;

&lt;h3 id=&quot;creating-file-systems&quot;&gt;Creating File Systems&lt;/h3&gt;

&lt;p&gt;Next re-created the ext4 file system for the three partitions.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;~ # make_ext4fs /dev/block/mmcblk0p21
Creating filesystem with parameters:
    Size: 1468006400
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8160
    Inode size: 256
    Journal blocks: 5600
    Label:
    Blocks: 358400
    Block groups: 11
    Reserved block group size: 87
Created filesystem with 11/89760 inodes and 11769/358400 blocks
~ # make_ext4fs /dev/block/mmcblk0p22
Creating filesystem with parameters:
    Size: 524288000
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8000
    Inode size: 256
    Journal blocks: 2000
    Label:
    Blocks: 128000
    Block groups: 4
    Reserved block group size: 31
Created filesystem with 11/32000 inodes and 4110/128000 blocks
~ # make_ext4fs /dev/block/mmcblk0p23
Creating filesystem with parameters:
    Size: 13605273600
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8144
    Inode size: 256
    Journal blocks: 32768
    Label:
    Blocks: 3321600
    Block groups: 102
    Reserved block group size: 815
Created filesystem with 11/830688 inodes and 93063/3321600 blocks
~ # e2fsck -f /dev/block/mmcblk0p21
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
system: 2563/53760 files (0.0% non-contiguous), 176829/215040 blocks
~ # resize2fs /dev/block/mmcblk0p21
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/block/mmcblk0p21 to 358400 (4k) blocks.
The filesystem on /dev/block/mmcblk0p21 is now 358400 blocks long.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I forgot to verify if &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/system&lt;/code&gt; was created as a 1.4 GB file system or as 827 MB but &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;resize2fs&lt;/code&gt; grew the file system so I assume it was too small.
One last check that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/fstab&lt;/code&gt; will function&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;~ # cat /etc/fstab
/dev/block/mmcblk0p21 /system ext4 rw 0 0
/dev/block/mmcblk0p23 /data ext4 rw 0 0
/dev/block/mmcblk0p22 /cache ext4 rw 0 0
~ # mount /system
~ # mount /data
~ # mount /cache
~ # df -h
Filesystem                Size      Used Available Use% Mounted on
tmpfs                   935.1M     20.0K    935.1M   0% /dev
tmpfs                   935.1M     16.0K    935.1M   0% /tmp
/dev/block/mmcblk0p21
                          1.3G     26.2M      1.3G   2% /system
/dev/block/mmcblk0p23
                         12.4G    129.5M     12.3G   1% /data
/dev/block/mmcblk0p22
                        492.6M      8.6M    483.9M   2% /cache
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;installing-lineageos&quot;&gt;Installing LineageOS&lt;/h2&gt;

&lt;p&gt;I tried to sideload the image now but there were errors about unable to detect filesystem for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/block/platform/msm_sdcc.1/by-name/system&lt;/code&gt;.
I rebooted, skipped through the warning about no OS, and booted the recovery image again from fastboot.&lt;/p&gt;

&lt;p&gt;I had numerous issues when trying to sideload the last nightly LineageOS 15.1 image for the Nexus 4 along with the matching Open GApps.
That image resized &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/system&lt;/code&gt; back to 827 MB each time.
After growing it again to sideload Open GApps, rebooting would load LineageOS only for it to reboot into the recovery image.&lt;/p&gt;

&lt;p&gt;What did work was the &lt;a href=&quot;https://forum.xda-developers.com/t/rom-unofficial-lineageos-16-0-mako.3758779/&quot;&gt;unofficial image created by voron00&lt;/a&gt; and the matching Open GApps for Android 9.0, micro version.
The LineageOS 15.1 image also shrunk &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/system&lt;/code&gt; a small amount that I grew back to its maximum size before sideloading Open GApps.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# adb sideload /path/to/tmp/lineageos/lineage-16.0-20210311-UNOFFICIAL-mako-signed.zip
Total xfer: 1.00x
# adb shell
# ...resizing again...
# adb sideload /path/to/tmp/lineageos/open_gapps-arm-9.0-micro-20210409.zip
Total xfer: 1.07x
# adb reboot
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I watched the LineageOS boot screen for a long time and then the Android 9.0 startup screen appeared.
I breezed through the setup and the device was ready.&lt;/p&gt;

&lt;p&gt;I also have the Nexus 7 from 2012 (code name grouper) that suffers from the same problem.
Next up, moving that to something newer than the CyanogenMod 12.1 install.&lt;/p&gt;
</description>
        <pubDate>Thu, 15 Apr 2021 00:00:00 -0400</pubDate>
        <link>https://katron.org/blog/2021/04/nexus-4-upgrade/</link>
        <guid isPermaLink="true">https://katron.org/blog/2021/04/nexus-4-upgrade/</guid>
        
        <category>Android</category>
        
        <category>LineageOS</category>
        
        <category>Nexus 4</category>
        
        
      </item>
    
      <item>
        <title>Installing FreeBSD using libvirt and bhyve</title>
        <description>&lt;p&gt;I needed to do some testing with jails in FreeBSD and rather than enable nested jails I decided to use a FreeBSD VM.
FreeBSD hosts VM images but their root disk is 30 GB when I only needed something in the 10 GB range.
The &lt;a href=&quot;https://www.freebsd.org/doc/handbook/virtualization-host-bhyve.html&quot;&gt;official docs&lt;/a&gt; start with installing FreeBSD so I decided to replicate it with libvirt.&lt;/p&gt;

&lt;p&gt;Overall it was straightforward except for getting the ISO to boot.
The &lt;a href=&quot;https://libvirt.org/drvbhyve.html&quot;&gt;libvirt docs&lt;/a&gt; state to put the ISO first to boot from it.
That did not work.
The &lt;a href=&quot;https://libvirt.org/formatdomain.html#elementsOSBIOS&quot;&gt;key part was discovering&lt;/a&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;boot dev=&apos;cdrom&apos;/&amp;gt;&lt;/code&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;os&amp;gt;&lt;/code&gt; to select the boot device.&lt;/p&gt;

&lt;p&gt;After &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libvirt start freebsd-11&lt;/code&gt; finished, running &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;virsh console freebsd-11&lt;/code&gt; brought up the boot sequence and then installer.&lt;/p&gt;

&lt;p&gt;Working domain XML.
The disk image was created using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;truncate&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;domain type=&apos;bhyve&apos;&amp;gt;
    &amp;lt;name&amp;gt;freebsd-11&amp;lt;/name&amp;gt;
    &amp;lt;uuid&amp;gt;82d9b876-d6bd-47a0-8c66-e2c8ddd967f2&amp;lt;/uuid&amp;gt;
    &amp;lt;memory&amp;gt;262144&amp;lt;/memory&amp;gt;
    &amp;lt;currentMemory&amp;gt;262144&amp;lt;/currentMemory&amp;gt;
    &amp;lt;vcpu&amp;gt;1&amp;lt;/vcpu&amp;gt;
    &amp;lt;os&amp;gt;
       &amp;lt;type&amp;gt;hvm&amp;lt;/type&amp;gt;
       &amp;lt;boot dev=&apos;cdrom&apos;/&amp;gt;
    &amp;lt;/os&amp;gt;
    &amp;lt;features&amp;gt;
      &amp;lt;apic/&amp;gt;
      &amp;lt;acpi/&amp;gt;
    &amp;lt;/features&amp;gt;
    &amp;lt;clock offset=&apos;utc&apos;/&amp;gt;
    &amp;lt;on_poweroff&amp;gt;destroy&amp;lt;/on_poweroff&amp;gt;
    &amp;lt;on_reboot&amp;gt;restart&amp;lt;/on_reboot&amp;gt;
    &amp;lt;on_crash&amp;gt;destroy&amp;lt;/on_crash&amp;gt;
    &amp;lt;devices&amp;gt;
      &amp;lt;disk type=&apos;file&apos;&amp;gt;
        &amp;lt;driver name=&apos;file&apos; type=&apos;raw&apos;/&amp;gt;
        &amp;lt;source file=&apos;/vm/freebsd-11/freebsd-11.raw&apos;/&amp;gt;
        &amp;lt;target dev=&apos;vda&apos; bus=&apos;virtio&apos;/&amp;gt;
      &amp;lt;/disk&amp;gt;
      &amp;lt;disk type=&apos;file&apos; device=&apos;cdrom&apos;&amp;gt;
        &amp;lt;driver name=&apos;file&apos; type=&apos;raw&apos;/&amp;gt;
        &amp;lt;source file=&apos;/vm/freebsd-11/FreeBSD-11.2-RELEASE-amd64-bootonly.iso&apos;/&amp;gt;
        &amp;lt;target dev=&apos;hda&apos; bus=&apos;sata&apos;/&amp;gt;
        &amp;lt;readonly/&amp;gt;
      &amp;lt;/disk&amp;gt;
      &amp;lt;interface type=&apos;bridge&apos;&amp;gt;
        &amp;lt;model type=&apos;virtio&apos;/&amp;gt;
        &amp;lt;source bridge=&quot;bridge0&quot;/&amp;gt;
      &amp;lt;/interface&amp;gt;
      &amp;lt;serial type=&quot;nmdm&quot;&amp;gt;
        &amp;lt;source master=&quot;/dev/nmdm2A&quot; slave=&quot;/dev/nmdm2B&quot;/&amp;gt;
      &amp;lt;/serial&amp;gt;
    &amp;lt;/devices&amp;gt;
&amp;lt;/domain&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Fri, 23 Nov 2018 08:00:00 -0500</pubDate>
        <link>https://katron.org/blog/2018/11/installing-freebsd-with-libvirt-bhyve/</link>
        <guid isPermaLink="true">https://katron.org/blog/2018/11/installing-freebsd-with-libvirt-bhyve/</guid>
        
        <category>bhyve</category>
        
        <category>freebsd</category>
        
        <category>libvirt</category>
        
        
      </item>
    
      <item>
        <title>Electricity Usage Monitoring with rtl-sdr</title>
        <description>&lt;p&gt;Inspired by &lt;a href=&quot;https://blog.kroy.io/2017/12/19/monitoring-home-power-consumption-for-less-than-25/&quot;&gt;a blog post&lt;/a&gt;, I wanted to start tracking my household’s electricity usage.
A quick trip to &lt;a href=&quot;https://www.amazon.com/gp/product/B01GDN1T4S/&quot;&gt;Amazon and $30 later&lt;/a&gt;, I had my own rtl-sdr device.
I like rrdtool’s graphs though so I used that for the data storage and graphing.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;https://github.com/seankelly/utility-monitor&quot;&gt;source code is on GitHub&lt;/a&gt;.
One interesting though about the meter is that it reports in decaWatt-hours.
Mine appears to consistently update its total every five minutes.
It does not happen precisely every 300 seconds but in the 300-330 second range.&lt;/p&gt;

&lt;h3 id=&quot;example-graph&quot;&gt;Example Graph&lt;/h3&gt;

&lt;p&gt;&lt;img src=&quot;/images/utility-monitor/example_day_usage.png&quot; alt=&quot;Example usage graph for a full day&quot; title=&quot;Example usage graph&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The usage is noisier than I thought when not running a large appliance such as the oven or (electric) dryer.&lt;/p&gt;

</description>
        <pubDate>Sat, 27 Oct 2018 00:00:00 -0400</pubDate>
        <link>https://katron.org/blog/2018/10/electrical-usage-monitoring/</link>
        <guid isPermaLink="true">https://katron.org/blog/2018/10/electrical-usage-monitoring/</guid>
        
        <category>rtl-sdr</category>
        
        <category>utility</category>
        
        <category>monitoring</category>
        
        
      </item>
    
      <item>
        <title>Brocade ICX 6450</title>
        <description>&lt;p&gt;Thanks to &lt;a href=&quot;https://forums.servethehome.com/index.php?threads/brocade-icx6450-icx6610-etc.21107/&quot;&gt;a deal on ServeTheHome&lt;/a&gt;, I upgraded the core switch for the house from a &lt;a href=&quot;http://us.dlink.com/products/business-solutions/dgs-1510-28x/&quot;&gt;D-Link DGS 1510-28X&lt;/a&gt; to a &lt;a href=&quot;http://www.ruckussecurity.com/ICX-6450-48P.asp&quot;&gt;Brocade ICX 6450-48P&lt;/a&gt;.
I wanted the 6450-24P instead but couldn’t find any good prices except for the 48P.
I got very lucky in my purchase though because the switch came fully licensed.&lt;/p&gt;

&lt;h2 id=&quot;fans&quot;&gt;Fans&lt;/h2&gt;
&lt;p&gt;When the switch has power, the fans start at 100% and they are very loud.
Eventually FastIron starts and adjusts the fans to a lower speed.
For me, even at the lower speed they are still rather loud so I’m documenting here what model they are to make it easier to find replacements in the future.&lt;/p&gt;

&lt;p&gt;The model I saw was Nidec W40S12BGB5-52 but the closest model available are the &lt;a href=&quot;https://www.nidec.com/en-NA/product/fan/category/F010/G030/P2000074/&quot;&gt;W40S-A5&lt;/a&gt;.
They are 40x40x28 mm, push 21.2 CFM at most, and the maximum noise is 51 dB.&lt;/p&gt;

&lt;p&gt;I used a voltmeter to determine the fan starts at 11.9 V and then drops to 4.4 V on low.
I next used a sound meter on the phone and measured around 50 dB a foot in front of the switch when the fans were on low.
Even assuming inaccuracy from not using a proper meter, that was much too high and justified looking into replacements.
Others on the STH thread had similar issues despite the switch supposedly being “silent” on low.
Checking the fan status with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;show chassis&lt;/code&gt; indicated the fans had failed but they were still moving a lot of air.&lt;/p&gt;

&lt;p&gt;I looked around a lot for a replacement fan and ended up picking the Sunon KDE1204PKVX.
When replacing the fans, the wire arrangement of the original Nidec differed from what the Sunon used so the Sunon fans did not start with the switch.
In the image below, the Nidec fan is on the left and the unmodified Sunon is on the right.
&lt;img src=&quot;/images/icx-6450/Nidec vs Sunon.jpg&quot; alt=&quot;Nidec fan pin layout on left versus Sunon pin layout on right&quot; title=&quot;Nidec fan on left versus Sunon on right&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I succeeded in popping out the yellow and black wires using a heavy duty staple and then swapped them on each fan.
I removed each Nidec fan, installed the Sunon fan in the appropriate orientation to keep the air blowing from front to back, and tidied the wires using the clips.
The wires didn’t fully fit in the clip so none of them are latched but it is enough to keep the wires in place.
&lt;img src=&quot;/images/icx-6450/Sunon fans installed.jpg&quot; alt=&quot;Sunon fans installed and wires organized&quot; title=&quot;Sunon fans installed and wires organized&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The switch no longer thinks the fans have failed, instead reporting their speed as auto.
I hoped the RPMs would be reported but no luck.
After leaving the switch on for a few hours, the reported temps are in the low 40s Celsius.
This is higher than before, when they were around 35 °C.
The switch being near silent is worth the ten degree change plus the warning temp is at 69 °C, plenty of thermal room.&lt;/p&gt;

</description>
        <pubDate>Sun, 21 Oct 2018 00:00:00 -0400</pubDate>
        <link>https://katron.org/blog/2018/10/brocade-icx6450/</link>
        <guid isPermaLink="true">https://katron.org/blog/2018/10/brocade-icx6450/</guid>
        
        <category>brocade</category>
        
        <category>fastiron</category>
        
        <category>icx6450</category>
        
        <category>ruckus</category>
        
        
      </item>
    
      <item>
        <title>Brocade VDX VCS-1002 error</title>
        <description>&lt;p&gt;I found zero hits for the VCS-1002 error for Extreme Networks (formerly Brocade) VDX line so this is my experience with it and how to fix it.&lt;/p&gt;

&lt;p&gt;I had two VDX switches and wanted to form a VCS logical-chassis fabric.
I knew their firmwares had to be the same version but was unsure how much needed to match: one switch had NOS 6.0.2b and the other 6.0.2f.
I hoped that it was enough to match on the “6.0.2” part (short version: no).
The switches never formed a logical-chassis fabric.&lt;/p&gt;

&lt;p&gt;I finally realized how to check the logs and saw an error about the primary switch being unable to configure the secondary.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;2018/04/30-12:55:39 [VCS-1002], 10559, SW/0 | Active, ERROR, VDX6740, Event: VCS cluster create, Coordinator IP: IP, VCS ID: 1, Status: VCS cluster failed to be created, Reason: Failed to configure all new locations.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I backed down the VCS level to fabric cluster and then a fabric formed.
I still wanted the full thing however so opened a support case and after talking to the representative, discovered the versions must &lt;em&gt;exactly&lt;/em&gt; match.
I got the 6.0.2f firmware, upgraded the other switch, and logical-chassis fabric formed immediately (or as immediately as the slow switches can).&lt;/p&gt;

&lt;p&gt;Some time later a third switch was added and this time it seamlessly joined the fabric once the VCS ID was updated.&lt;/p&gt;
</description>
        <pubDate>Wed, 22 Aug 2018 00:00:00 -0400</pubDate>
        <link>https://katron.org/blog/2018/08/brocade-vcs-error/</link>
        <guid isPermaLink="true">https://katron.org/blog/2018/08/brocade-vcs-error/</guid>
        
        <category>brocade</category>
        
        <category>extreme networks</category>
        
        <category>vdx</category>
        
        
      </item>
    
      <item>
        <title>FreeBSD devfs.rules(5)</title>
        <description>&lt;p&gt;I was experimenting with an &lt;a href=&quot;https://www.rtl-sdr.com/&quot;&gt;RTL-SDR&lt;/a&gt; on FreeBSD.
I could run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rtl_tcp&lt;/code&gt; on Linux as a regular user but not on FreeBSD.
Checking the mode and no group or world permission bits were set.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;crw-------  1 root  operator  0x2b May 30 08:58 /dev/usb/0.1.0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I needed at least group permissions.
Because &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rtl_tcp&lt;/code&gt; is getting data from the outside world I opted for a separate user for only that.
Conveniently, an example very similar to this was in the manpage for &lt;a href=&quot;https://www.freebsd.org/cgi/man.cgi?query=devfs.rules&amp;amp;apropos=0&amp;amp;sektion=0&amp;amp;manpath=FreeBSD+11.1-RELEASE+and+Ports&amp;amp;arch=default&amp;amp;format=html&quot;&gt;devfs.rules(5)&lt;/a&gt;.
First I created a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;usb&lt;/code&gt; user and group and now need to allow it to read USB devices.&lt;/p&gt;

&lt;p&gt;USB devices appear in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/usb&lt;/code&gt; so that path is what need to be used in the rules.
The name can be anything while the number is the ID of the rules.
Add this to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/devfs.rules&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[localrules=10]
add path &apos;usb/*&apos; mode 0660 group usb
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Those new rules have to be enabled using that name.
Add this to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/rc.conf&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;devfs_system_ruleset=&quot;localrules&quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To make the new rules take effect, devfs needs to be restarted:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;/etc/rc.d/devfs restart
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now, this is what the USB device looks like:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;crw-rw----  1 root  usb  0x2e May 30 07:59 /dev/usb/0.1.0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Mon, 04 Jun 2018 00:00:00 -0400</pubDate>
        <link>https://katron.org/blog/2018/06/freebsd-devfs-rules/</link>
        <guid isPermaLink="true">https://katron.org/blog/2018/06/freebsd-devfs-rules/</guid>
        
        <category>freebsd</category>
        
        <category>devfs</category>
        
        
      </item>
    
      <item>
        <title>bhyve, libvirt, and grub2-bhyve</title>
        <description>&lt;p&gt;At the end of my &lt;a href=&quot;/blog/2016/09/bhyve-and-libvirt/&quot;&gt;bhyve and libvirt&lt;/a&gt; post is note that booting with grub isn’t automatic:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Needing to manually tell grub how to boot the VM is frustrating but being able to use virtio for the disk and network is good enough.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I solved this a while ago and forgot to include how.
Eventually, I noticed the Debian cloud image I used as a base used &lt;a href=&quot;http://www.syslinux.org/wiki/index.php?title=EXTLINUX&quot;&gt;extlinux&lt;/a&gt; to boot instead of what I expected, grub.
Grub can’t boot if there’s no grub config so I installed grub2, set the configuration, and installed it on disk.
The VM booted fine after that.&lt;/p&gt;

&lt;p&gt;Later on I tried to boot a CentOS 7 cloud image.
I knew it used grub already but it wouldn’t boot when using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;virsh start&lt;/code&gt;.
After several times back and forth between my Linux laptop, where I could dissect the image, and the VM host running FreeBSD, where I only had access to the serial console, I noticed the problem.
The key thing is the command may be grub-bhyve but the package name is grub2-bhyve.
The problem is easier to see with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--help&lt;/code&gt; option:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;grub-bhyve --help
Usage: grub-bhyve [OPTION...] vmname
...
  -d, --directory=DIR        use GRUB files in the directory DIR
                             [default=/boot/grub]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;By default it checks for the grub configuration in /boot/grub.
Debian uses &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/boot/grub&lt;/code&gt; so I didn’t notice.
CentOS 7 however uses &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/boot/grub2&lt;/code&gt; (and has &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/boot/grub1&lt;/code&gt;).
I added a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grub&lt;/code&gt; symlink to point to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grub2&lt;/code&gt;, ran &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;virsh start&lt;/code&gt; and it booted fine too.&lt;/p&gt;

&lt;p&gt;Summary: make sure &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/boot/grub&lt;/code&gt; exists and has a usable &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grub.cfg&lt;/code&gt;.
Grub does not have to be installed to the disk because that bootloader isn’t run.&lt;/p&gt;

</description>
        <pubDate>Tue, 01 Aug 2017 17:59:00 -0400</pubDate>
        <link>https://katron.org/blog/2017/08/bhyve-libvirt-grub/</link>
        <guid isPermaLink="true">https://katron.org/blog/2017/08/bhyve-libvirt-grub/</guid>
        
        <category>bhyve</category>
        
        <category>grub</category>
        
        <category>libvirt</category>
        
        
      </item>
    
  </channel>
</rss>
