Sunrise and Sunset in C++

I wanted to calculate sunrise and sunset at my location for a recent project I was working on where I wouldn’t necessarily have access to internet connectivity. I did some quick searching and found a Wikipedia page with equations and thought it would be straightforward to put those equations into code. Somehow, I was not able to get the routines working correctly.

I came across a NOAA page that used equations in a different form, and also had links to an excel spreadsheet I could download and play with. I was able to reverse engineer the spreadsheet into C++ code to get a working routine that calculates the sunrise and sunset to an accuracy that is good enough for my needs.

I’m sharing my code here. If you see anything I’ve done wrong, please let me know. If you find it useful, please let me know about that as well.

/////////////////////////////////////////////////////////////////////////////
// From NOAA Spreadsheet https://gml.noaa.gov/grad/solcalc/calcdetails.html
bool getSunriseSunset(time_t& Sunrise, time_t& Sunset, const time_t& TheTime, const double Latitude, double Longitude)
{
	bool rval = false;
	struct tm LocalTime;
	if (0 != localtime_r(&TheTime, &LocalTime))
	{
		// if we don't have a valid latitude or longitude, declare sunrise to be midnight, and sunset one second before midnight
		if ((Latitude == 0) || (Longitude == 0))
		{
			LocalTime.tm_hour = 0;
			LocalTime.tm_min = 0;
			LocalTime.tm_sec = 0;
			Sunrise = mktime(&LocalTime);
			Sunset = Sunrise + 24*60*60 - 1;
		}
		else
		{
			double JulianDay = Time2JulianDate(TheTime); // F
			double JulianCentury = (JulianDay - 2451545) / 36525;	// G
			double GeomMeanLongSun = fmod(280.46646 + JulianCentury * (36000.76983 + JulianCentury * 0.0003032), 360);	// I
			double GeomMeanAnomSun = 357.52911 + JulianCentury * (35999.05029 - 0.0001537 * JulianCentury);	// J
			double EccentEarthOrbit = 0.016708634 - JulianCentury * (0.000042037 + 0.0000001267 * JulianCentury);	// K
			double SunEqOfCtr = sin(radians(GeomMeanAnomSun)) * (1.914602 - JulianCentury * (0.004817 + 0.000014 * JulianCentury)) + sin(radians(2 * GeomMeanAnomSun)) * (0.019993 - 0.000101 * JulianCentury) + sin(radians(3 * GeomMeanAnomSun)) * 0.000289; // L
			double SunTrueLong = GeomMeanLongSun + SunEqOfCtr;	// M
			double SunAppLong = SunTrueLong - 0.00569 - 0.00478 * sin(radians(125.04 - 1934.136 * JulianCentury));	// P
			double MeanObliqEcliptic = 23 + (26 + ((21.448 - JulianCentury * (46.815 + JulianCentury * (0.00059 - JulianCentury * 0.001813)))) / 60) / 60;	// Q
			double ObliqCorr = MeanObliqEcliptic + 0.00256 * cos(radians(125.04 - 1934.136 * JulianCentury));	// R
			double SunDeclin = degrees(asin(sin(radians(ObliqCorr)) * sin(radians(SunAppLong))));	// T
			double var_y = tan(radians(ObliqCorr / 2)) * tan(radians(ObliqCorr / 2));	// U
			double EquationOfTime = 4 * degrees(var_y * sin(2 * radians(GeomMeanLongSun)) - 2 * EccentEarthOrbit * sin(radians(GeomMeanAnomSun)) + 4 * EccentEarthOrbit * var_y * sin(radians(GeomMeanAnomSun)) * sin(2 * radians(GeomMeanLongSun)) - 0.5 * var_y * var_y * sin(4 * radians(GeomMeanLongSun)) - 1.25 * EccentEarthOrbit * EccentEarthOrbit * sin(2 * radians(GeomMeanAnomSun))); // V
			double HASunriseDeg = degrees(acos(cos(radians(90.833)) / (cos(radians(Latitude)) * cos(radians(SunDeclin))) - tan(radians(Latitude)) * tan(radians(SunDeclin)))); // W
			double SolarNoon = (720 - 4 * Longitude - EquationOfTime + LocalTime.tm_gmtoff / 60) / 1440; // X
			double SunriseTime = SolarNoon - HASunriseDeg * 4 / 1440;	// Y
			double SunsetTime = SolarNoon + HASunriseDeg * 4 / 1440;	// Z
			LocalTime.tm_hour = 0;
			LocalTime.tm_min = 0;
			LocalTime.tm_sec = 0;
			time_t Midnight = mktime(&LocalTime);
			Sunrise = Midnight + SunriseTime * 86400;
			Sunset = Midnight + SunsetTime * 86400;
		}
		rval = true;
	}
	return(rval);
}

I’ve included the individual routines I created when trying to duplicate the Wikipedia equations. If anyone can point out why they didn’t work for me, I’d appreciate that as well.

/////////////////////////////////////////////////////////////////////////////
double radians(const double degrees)
{
	return((degrees * M_PI) / 180.0);
}
double degrees(const double radians)
{
	return((radians * 180.0) / M_PI);
}
double Time2JulianDate(const time_t& TheTime)
{
	double JulianDay = 0;
	struct tm UTC;
	if (0 != gmtime_r(&TheTime, &UTC))
	{
		// https://en.wikipedia.org/wiki/Julian_day
		// JDN = (1461 × (Y + 4800 + (M ? 14)/12))/4 +(367 × (M ? 2 ? 12 × ((M ? 14)/12)))/12 ? (3 × ((Y + 4900 + (M - 14)/12)/100))/4 + D ? 32075
		JulianDay = (1461 * ((UTC.tm_year + 1900) + 4800 + ((UTC.tm_mon + 1) - 14) / 12)) / 4
			+ (367 * ((UTC.tm_mon + 1) - 2 - 12 * (((UTC.tm_mon + 1) - 14) / 12))) / 12
			- (3 * (((UTC.tm_year + 1900) + 4900 + ((UTC.tm_mon + 1) - 14) / 12) / 100)) / 4
			+ (UTC.tm_mday)
			- 32075;
		// JD = JDN + (hour-12)/24 + minute/1440 + second/86400
		double partialday = (static_cast<double>((UTC.tm_hour - 12)) / 24) + (static_cast<double>(UTC.tm_min) / 1440.0) + (static_cast<double>(UTC.tm_sec) / 86400.0);
		JulianDay += partialday;
	}
	return(JulianDay);
}
time_t JulianDate2Time(const double JulianDate)
{
	time_t TheTime = (JulianDate - 2440587.5) * 86400;
	return(TheTime);
}
double JulianDate2JulianDay(const double JulianDate)
{
	double n = JulianDate - 2451545.0 + 0.0008;
	return(n);
}
/////////////////////////////////////////////////////////////////////////////
// These equations all come from https://en.wikipedia.org/wiki/Sunrise_equation
double getMeanSolarTime(const double JulianDay, const double longitude)
{
	// an approximation of mean solar time expressed as a Julian day with the day fraction.
	double MeanSolarTime = JulianDay - (longitude / 360);
	return (MeanSolarTime);
}
double getSolarMeanAnomaly(const double MeanSolarTime)
{
	double SolarMeanAnomaly = fmod(357.5291 + 0.98560028 * MeanSolarTime, 360);
	return(SolarMeanAnomaly);
}
double getEquationOfTheCenter(const double SolarMeanAnomaly)
{
	double EquationOfTheCenter = 1.9148 * sin(radians(SolarMeanAnomaly)) + 0.0200 * sin(radians(2 * SolarMeanAnomaly)) + 0.0003 * sin(radians(3 * SolarMeanAnomaly));
	return(EquationOfTheCenter);
}
double getEclipticLongitude(const double SolarMeanAnomaly, const double EquationOfTheCenter)
{
	double EclipticLongitude = fmod(SolarMeanAnomaly + EquationOfTheCenter + 180 + 102.9372, 360);
	return(EclipticLongitude);
}
double getSolarTransit(const double MeanSolarTime, const double SolarMeanAnomaly, const double EclipticLongitude)
{
	// the Julian date for the local true solar transit (or solar noon).
	double SolarTransit = 2451545.0 + MeanSolarTime + 0.0053 * sin(radians(SolarMeanAnomaly)) - 0.0069 * sin(radians(2 * EclipticLongitude));
	return(SolarTransit);
}
double getDeclinationOfTheSun(const double EclipticLongitude)
{
	double DeclinationOfTheSun = sin(radians(EclipticLongitude)) * sin(radians(23.44));
	return(DeclinationOfTheSun);
}
double getHourAngle(const double Latitude, const double DeclinationOfTheSun)
{
	double HourAngle = (sin(radians(-0.83)) - sin(radians(Latitude)) * sin(radians(DeclinationOfTheSun))) / (cos(radians(Latitude)) * cos(radians(DeclinationOfTheSun)));
	return(HourAngle);
}
double getSunrise(const double SolarTransit, const double HourAngle)
{
	double Sunrise = SolarTransit - (HourAngle / 360);
	return(Sunrise);
}
double getSunset(const double SolarTransit, const double HourAngle)
{
	double Sunset = SolarTransit + (HourAngle / 360);
	return(Sunset);
}

Here’s the code snippet I was using when trying to get the Wikipedia equations working.

double JulianDay = JulianDate2JulianDay(Time2JulianDate(LoopStartTime));
double MeanSolarTime = getMeanSolarTime(JulianDay, Longitude);
double SolarMeanAnomaly = getSolarMeanAnomaly(MeanSolarTime);
double EquationOfTheCenter = getEquationOfTheCenter(SolarMeanAnomaly);
double EclipticLongitude = getEclipticLongitude(SolarMeanAnomaly, EquationOfTheCenter);
double SolarTransit = getSolarTransit(MeanSolarTime, SolarMeanAnomaly, EclipticLongitude);
double DeclinationOfTheSun = getDeclinationOfTheSun(EclipticLongitude);
double HourAngle = getHourAngle(Latitude, DeclinationOfTheSun);
double Sunrise = getSunrise(SolarTransit, HourAngle);
double Sunset = getSunset(SolarTransit, HourAngle);
std::cout.precision(std::numeric_limits<double>::max_digits10);
std::cout << "         Julian Date: " << Time2JulianDate(LoopStartTime) << std::endl;
std::cout << "           Unix Time: " << LoopStartTime << std::endl;
std::cout << "         Julian Date: " << timeToExcelLocal(JulianDate2Time(Time2JulianDate(LoopStartTime))) << std::endl;
std::cout << "            Latitude: " << Latitude << std::endl;
std::cout << "           Longitude: " << Longitude << std::endl;
std::cout << "          Julian Day: " << JulianDay << std::endl;
std::cout << "       MeanSolarTime: " << MeanSolarTime << std::endl;
std::cout << "    SolarMeanAnomaly: " << SolarMeanAnomaly << std::endl;
std::cout << " EquationOfTheCenter: " << EquationOfTheCenter << std::endl;
std::cout << "   EclipticLongitude: " << EclipticLongitude << std::endl;
std::cout << "        SolarTransit: " << timeToExcelLocal(JulianDate2Time(SolarTransit)) << std::endl;
std::cout << " DeclinationOfTheSun: " << DeclinationOfTheSun << std::endl;
std::cout << "           HourAngle: " << HourAngle << std::endl;
std::cout << "             Sunrise: " << timeToExcelLocal(JulianDate2Time(Sunrise)) << std::endl;
std::cout << "              Sunset: " << timeToExcelLocal(JulianDate2Time(Sunset)) << std::endl;

Set default XTerm font and screen size

xrdp xterm default

I’ve been employing the interesting hack to run a single graphical program on my raspberry Pi of installing and running xrdp without having installed a full graphical window manager. When I connect to the rdp session and have my window set to 1920×1080, the terminal window that appears runs in the top left of the session window with no visible borders. If the mouse is over the terminal session the cursor works as expected. If the mouse is over the vast blackness of the rest of the screen, the cursor is a simple X cursor.

It’s never been a huge deal to me because I just run the single command of my graphical program most of the time. I had been looking for a way to configure the terminal to be a specific size based on the RDP session, but it’s not really designed for that.

What I finally found was that if I specify the font and window geometry based on the font, it will create the terminal window appropriately. A bit of trial and error and I came up with the following file in my user directory. One nice feature of this fix is that it’s not modifying any systemwide configuration.

wim@WimPi4:~ $ cat ~/.Xresources 
xterm*faceName: Luxi Mono
xterm*faceSize: 16
xterm*geometry: 147x41

Thanks to this post for giving me the solution.

Google Domains Dynamic DNS and IPv6

I’ve been wanting to use a dynamic address in my personal domain and IPv6. While I read that it should be possible, finding the exact method of configuring ddclient to do so was not obvious to me. The default installation configures everything to register an IPv4 address and finding specific configuration examples using IPv6 was hard. It turns out that finding examples was hard because the process itself is easy.

Go to domains.google.com, configure your domain to include dynamic DNS hosts, add the hostname you want to register, and retrieve the specific credentials for that hostname. There are help pages describing that process at google. It will create a record with the hostname you specify, and an A record (IPv4) with a 1 minute time to live.

Google Domains

Install ddclient using apt and go through the debconf wizard to enter the credentials. It will set up the default configuration using IPv4.

sudo apt install ddclient -y
domains.google
ddclient –force –verbose to see if errors occur
Google Domains IPv4 address registered

Manually editing /etc/ddclient.conf and changing the use= statement to usev6= and running ddclient a second time will switch to registering the IPv6 address.

wim@WimPiZeroW-Wim:~ $ sudo cat /etc/ddclient.conf
# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf

protocol=googledomains \
usev6=if, if=wlan0 \
login=**************** \
password='***************' \
wimpizerow-wim.wimsworld.com
wim@WimPiZeroW-Wim:~ $
another ddclient –force –verbose to confirm changes didn’t create errors

running sudo systemctl confirms that ddclient.service is loaded active and running. If the address were to change, it should automatically be updated in the dynamic domain entry.

More Networking with SIM7600G-H 4G HAT (B) for Raspberry Pi

I initially set up my Waveshare SIM7600G-H 4G HAT (B) for Raspberry Pi as described in the post last week.

Partly because the original web article I was following mentioned different modes of connecting to the internet, and partly because of my infatuation with IPv6, I decided to try to see the performance of different modes I might be able to set up with the device I have.

The support wiki for the device has four pages related to networking setup with the Raspberry Pi, RNDIS, NDIS, SIM868 PPP, and “3G Router“. I’d looked up definitions of NDIS and RNDIS on Wikipedia and didn’t really understand the differences, but the SIM868 page is titled “SIM7600X ECM dial-up Internet” and the ECM led me to believe it was the same as the second type of networking defined in the original article I’d been following. (Choosing QMI or ECM)

I’d been able to issue commands to the board by echoing the correct AT command to /dev/sttyUSB2. I was using the command echo AT+CGPS=1 >/dev/ttyUSB2 to enable the GPS on each boot. Following the Waveshare RNDIS instructions I blithely issued the command echo AT+CUSBPIDSWITCH=9011,1,1 >/dev/sttyUSB2 on my raspberry. The wwan0 device that I’d had set up and running went away and was replaced by a usb0 network device that Raspbian automatically enabled and acquired a valid internet address for. It had a routing metric that was lower than my wlan0 interface, but I figured it might be easier to organize this later without adding udhcpc into the mix of networking software on my raspberry. It also acquired an IPv6 address, which I’d not figured out how to do with the QMI setup and qmicli tools in my initial configuration. The original article mentioned possibly a lower networking latency using ECM vs QMI, so because one of the Waveshare pages had ECM in the title, I tried echo AT+CUSBPIDSWITCH=9018,1,1 /dev/sttyUSB2.

The latency seemed to be slightly different, and I wanted to switch back and do some real testing. That’s when I realized that I no longer had any /dev/ttyUSB devices to be able to send commands to. Completely power cycling the device made no difference. This is when I realized there are no reset jumpers on the device at all, and it had been able to remember the carrier APN that I’d initially set up before switching modes. Looking at the support web page, the only way I could figure out to recover the device was to connect it to a windows machine and install their drivers. I was not interested in downloading drivers from an unknown source and installing them on my primary workstation but realized my old Windows7 machine that hadn’t been turned on in close to a year was a good sacrifice if I could get things working.

First, I had to download the SIM7600X Driver, then I had to get their software.

Initial look at software

It took me a while to figure out that I had to hit the “Tools->STC/IAP15 ISP Programmer” menu, followed by the “Send Multi Char” tab on the resulting window pane to get the list of AT commands it could send.

Simcom Software

It also took me a while to recognize that while I could type commands into the primary window on the left, when I pasted commands that I’d typed in notepad, they were displayed but not executed by the card. The program also didn’t let me easily copy the contents of the main window so I could keep track of what commands I’d used and gotten as a result. After a while, I realized that this was essentially just a specialized serial terminal, and I had serial terminals I’m much more familiar with on my machine already. The Simcom HS-USB ports are visible in the windows device manager as COM12, COM13, COM14, and COM16. The purpose of each port is visible in the naming of the port in the current mode, NMEA, AT PORT, Diagnostics, and Audio.

AT+CRESET appeared to be a good command to get me back to a reasonable working state, but it only seemed to reboot the card, without changing any of the settings that had been stored. I was finally able to figure out that the AT&F command would set all the settings back to the factory defaults. After doing that I was no longer automatically connecting to Google FI, which at least meant I was no longer using up my data allowance while I was figuring things out.

I’d originally gotten into trouble by issuing the command AT+CUSBPIDSWITCH=9018,1,1. I came across the list of all available commands, which is much larger than what was listed in the Simcom Software itself. Issuing the command AT+CUSBPIDSWITCH? returns the current mode, and AT+CUSBPIDSWITCH=? lists the possible modes.

After the factory reset and switch back to 9011 mode, I got some of these results:

AT&F
OK
ATI
Manufacturer: SIMCOM INCORPORATED
Model: SIMCOM_SIM7600G-H
Revision: SIM7600M22_V2.0.1
SVN: 01
IMEI: 868822042540193
+GCAP: +CGSM

AT+CGDCONT?
+CGDCONT: 1,"IPV4V6","Telstra.internet","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 2,"IPV4V6","","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 3,"IPV4V6","","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 4,"IPV4V6","","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 5,"IPV4V6","","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 6,"IPV4V6","","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0

OK
AT+CGDCONT=?
+CGDCONT: (1-24),"IP",,,(0-2),(0-4),(0-1),(0-1)
+CGDCONT: (1-24),"PPP",,,(0-2),(0-4),(0-1),(0-1)
+CGDCONT: (1-24),"IPV6",,,(0-2),(0-4),(0-1),(0-1)
+CGDCONT: (1-24),"IPV4V6",,,(0-2),(0-4),(0-1),(0-1)

OK
AT+CUSBPIDSWITCH?
+CUSBPIDSWITCH: 9011

OK
AT+CUSBPIDSWITCH=?
+CUSBPIDSWITCH: (9000,9001,9002,9003,9004,9005,9006,9007,9011,9016,9018,9019,901A,901B,9020,9021,9022,9023,9024,9025,9026,9027,9028,9029,902A,902B),(0-1),(0-1)

Following some instructions I found on a post written by Mathieu Leguey, I was able to reconfigure the APN to connect to Google Fi. That page is also where I found the link to the complete list of commands. This other page is what led me to believe I need to set the APN twice to get IPv6 operating properly.

AT+CGDCONT?
+CGDCONT: 1,"IPV4V6","h2g2","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 2,"IPV4V6","","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 3,"IPV4V6","","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 4,"IPV4V6","","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 5,"IPV4V6","","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0
+CGDCONT: 6,"IPV4V6","h2g2","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0",0,0,0,0

I later realized I could configure the GPS to automatically start with the command AT+CGPSAUTO=1. The final configuration commands I decided to use that seem to work for my purposes are as follows:

AT&F
AT+CUSBPIDSWITCH=9011,1,1
AT+CGDCONT=1,"IPV4V6","h2g2"
AT+CGDCONT=6,"IPV4V6","h2g2"
AT+CGPSAUTO=1
SecureCRT Display

By doing this, I was able to avoid installing any networking drivers or configuration on Raspian that wasn’t automatically installed with the minimal system image. I should have been able to issue all of the commands via the echo command and the /dev/sttyUSB2 port if I’d not initially put the unit into 9018 mode and removed the USB control port.

ip a
ifconfig -a
route -v -n
wim@WimPiZeroW-Hope:~ $ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:7c:6a:80 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.53/24 brd 192.168.0.255 scope global dynamic noprefixroute wlan0
       valid_lft 10481sec preferred_lft 9131sec
    inet6 2604:4080:1304:8010:347f:5b74:9cac:5a2/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 27sec preferred_lft 17sec
    inet6 fe80::7a98:f2b1:147d:36d0/64 scope link
       valid_lft forever preferred_lft forever
3: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether fe:5c:c9:12:f4:3a brd ff:ff:ff:ff:ff:ff
    inet 192.168.225.31/24 brd 192.168.225.255 scope global dynamic noprefixroute usb0
       valid_lft 42884sec preferred_lft 37484sec
    inet6 2607:fb90:8062:ac89:b44d:ec7e:82c0:b337/64 scope global mngtmpaddr noprefixroute
       valid_lft forever preferred_lft forever
    inet6 fe80::5ade:a00c:113f:dfcd/64 scope link
       valid_lft forever preferred_lft forever
wim@WimPiZeroW-Hope:~ $ ifconfig -a
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 14  bytes 1876 (1.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14  bytes 1876 (1.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.225.31  netmask 255.255.255.0  broadcast 192.168.225.255
        inet6 2607:fb90:8062:ac89:b44d:ec7e:82c0:b337  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::5ade:a00c:113f:dfcd  prefixlen 64  scopeid 0x20<link>
        ether fe:5c:c9:12:f4:3a  txqueuelen 1000  (Ethernet)
        RX packets 74  bytes 6149 (6.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 100  bytes 14461 (14.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.53  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::7a98:f2b1:147d:36d0  prefixlen 64  scopeid 0x20<link>
        inet6 2604:4080:1304:8010:347f:5b74:9cac:5a2  prefixlen 64  scopeid 0x0<global>
        ether b8:27:eb:7c:6a:80  txqueuelen 1000  (Ethernet)
        RX packets 3068  bytes 458727 (447.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 956  bytes 151187 (147.6 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wim@WimPiZeroW-Hope:~ $ route -v
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         mobileap.qualco 0.0.0.0         UG    203    0        0 usb0
default         192.168.0.1     0.0.0.0         UG    302    0        0 wlan0
192.168.0.0     0.0.0.0         255.255.255.0   U     302    0        0 wlan0
192.168.225.0   0.0.0.0         255.255.255.0   U     203    0        0 usb0
wim@WimPiZeroW-Hope:~ $ route -v -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.225.1   0.0.0.0         UG    203    0        0 usb0
0.0.0.0         192.168.0.1     0.0.0.0         UG    302    0        0 wlan0
192.168.0.0     0.0.0.0         255.255.255.0   U     302    0        0 wlan0
192.168.225.0   0.0.0.0         255.255.255.0   U     203    0        0 usb0
wim@WimPiZeroW-Hope:~ $ ping -I usb0 www.google.com -c 4
PING www.google.com(nuq04s43-in-x04.1e100.net (2607:f8b0:4005:810::2004)) from 2607:fb90:8062:ac89:b44d:ec7e:82c0:b337 usb0: 56 data bytes
64 bytes from nuq04s43-in-x04.1e100.net (2607:f8b0:4005:810::2004): icmp_seq=1 ttl=116 time=68.0 ms
64 bytes from nuq04s43-in-x04.1e100.net (2607:f8b0:4005:810::2004): icmp_seq=2 ttl=116 time=67.1 ms
64 bytes from nuq04s43-in-x04.1e100.net (2607:f8b0:4005:810::2004): icmp_seq=3 ttl=116 time=65.2 ms
64 bytes from nuq04s43-in-x04.1e100.net (2607:f8b0:4005:810::2004): icmp_seq=4 ttl=116 time=65.5 ms

--- www.google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 65.217/66.449/68.012/1.159 ms
wim@WimPiZeroW-Hope:~ $ ping -I wlan0 www.google.com -c 4
PING www.google.com(nuq04s43-in-x04.1e100.net (2607:f8b0:4005:810::2004)) from 2604:4080:1304:8010:347f:5b74:9cac:5a2 wlan0: 56 data bytes
64 bytes from nuq04s43-in-x04.1e100.net (2607:f8b0:4005:810::2004): icmp_seq=1 ttl=50 time=68.0 ms
64 bytes from nuq04s43-in-x04.1e100.net (2607:f8b0:4005:810::2004): icmp_seq=2 ttl=50 time=27.3 ms
64 bytes from nuq04s43-in-x04.1e100.net (2607:f8b0:4005:810::2004): icmp_seq=3 ttl=50 time=30.4 ms
64 bytes from nuq04s43-in-x04.1e100.net (2607:f8b0:4005:810::2004): icmp_seq=4 ttl=50 time=44.7 ms

--- www.google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3008ms
rtt min/avg/max/mdev = 27.330/42.629/68.048/16.072 ms
wim@WimPiZeroW-Hope:~ $ lsusb
Bus 001 Device 003: ID 1e0e:9011 Qualcomm / Option SimTech, Incorporated
Bus 001 Device 002: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
wim@WimPiZeroW-Hope:~ $ lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 3, If 0, Class=Communications, Driver=rndis_host, 480M
        |__ Port 1: Dev 3, If 1, Class=CDC Data, Driver=rndis_host, 480M
        |__ Port 1: Dev 3, If 2, Class=Vendor Specific Class, Driver=option, 480M
        |__ Port 1: Dev 3, If 3, Class=Vendor Specific Class, Driver=option, 480M
        |__ Port 1: Dev 3, If 4, Class=Vendor Specific Class, Driver=option, 480M
        |__ Port 1: Dev 3, If 5, Class=Vendor Specific Class, Driver=option, 480M
        |__ Port 1: Dev 3, If 6, Class=Vendor Specific Class, Driver=option, 480M
ping results

One thing that jumped out when using the USB interface is that the default gateway is an internal Qualcomm name, mobileap.qualco.

lsusb results

I still need to figure out how to change the metric of usb0 to be higher than wlan0 probably installing the ifmetric program, following directions similar to this answer.

Update 7/17/2020

Adding an interface and metric line to the end of /etc/dhcpd.conf got me the routing I wanted without having to add any new programs. It also means the IPv6 stuff is taken care of automatically.

wim@WimPiZeroW-Hope:~ $ tail -5 /etc/dhcpcd.conf
#interface eth0
#fallback static_eth0

interface usb0
metric 400
wim@WimPiZeroW-Hope:~ $ route -n -v
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    302    0        0 wlan0
0.0.0.0         192.168.225.1   0.0.0.0         UG    400    0        0 usb0
192.168.0.0     0.0.0.0         255.255.255.0   U     302    0        0 wlan0
192.168.225.0   0.0.0.0         255.255.255.0   U     400    0        0 usb0
wim@WimPiZeroW-Hope:~ $ route -n -v -6
Kernel IPv6 routing table
Destination                    Next Hop                   Flag Met Ref Use If
::1/128                        ::                         U    256 2     0 lo
2604:4080:1304:8010::/64       ::                         U    302 1     0 wlan0
2607:fb90:80c7:b02e::/64       ::                         U    400 2     0 usb0
fe80::/64                      ::                         U    256 1     0 usb0
fe80::/64                      ::                         U    256 1     0 wlan0
::/0                           fe80::b27f:b9ff:fe83:6591  UG   302 1     0 wlan0
::/0                           fe80::6c86:c4b4:1f1:c09    UG   400 2     0 usb0
::1/128                        ::                         Un   0   4     0 lo
2604:4080:1304:8010:347f:5b74:9cac:5a2/128 ::                         Un   0   2     0 wlan0
2607:fb90:80c7:b02e:b86b:f626:1fa9:3a62/128 ::                         Un   0   4     0 usb0
fe80::7a98:f2b1:147d:36d0/128  ::                         Un   0   3     0 wlan0
fe80::88be:29ff:2c84:e5a0/128  ::                         Un   0   5     0 usb0
ff00::/8                       ::                         U    256 2     0 usb0
ff00::/8                       ::                         U    256 2     0 wlan0
::/0                           ::                         !n   -1  1     0 lo
usb0 routing metric fixed

References:

LTE wireless on SIM7600G-H 4G HAT (B) for Raspberry Pi

After coming across the recent and well written article Using 4G LTE wireless modems on a Raspberry Pi, I decided to give it a try myself. I looked at his parts list, and then ended up going in a different direction by buying an all-in-one unit designed explicitly for the Raspberry Pi Zero.

What’s on the Board
  1. SIM7600G-H
  2. FE1.1S USB HUB chip
  3. NAU8810 audio decoder
  4. RT9193-33 voltage translator
  5. USB HUB input D+/D- pogo pin: for Raspberry Pi Zero/Zero W MicroUSB connector: for other Raspberry Pi boards or PC
  6. Pogo pin power supply 5V: connects to 5V pin of Zero/Zero W, up to 2A current GND: connects to GND pin of Zero/Zero W
  1. USB extended ports USB1~USB2: USB-A connectors USB3: solder pad
  2. SIM card slot supports 1.8V/3V SIM card
  3. 3.5mm earphone/mic jack
  4. MAIN antenna connector
  5. AUX auxiliary antenna connector
  6. GNSS antenna connector
  7. Power indicator
  8. Network status indicator

I’m using Google Fi Unlimited Plus as my network on my phone right now, and one of its features is the ability to have multiple data only devices using part of your data allocation. That makes experimentation with a device like this fairly easy as I was able to order a data sim from Google and put it in the device and it just worked.

I’d never heard of pogo pins before. These are spring loaded contacts that line up with pads on the Raspberry Pi Zero to make electrical contact. They worked the first time I screwed everything together, but when I took it apart and put it back together a second time the board wasn’t recognized. I removed power, pushed down the pins with some tweezers, restored power, and the board was recognized again.

wim@WimPiZeroWCamera:~ $ lsusb
Bus 001 Device 003: ID 1e0e:9001 Qualcomm / Option
Bus 001 Device 002: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
wim@WimPiZeroWCamera:~ $ lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=option, 480M
        |__ Port 1: Dev 3, If 1, Class=Vendor Specific Class, Driver=option, 480M
        |__ Port 1: Dev 3, If 2, Class=Vendor Specific Class, Driver=option, 480M
        |__ Port 1: Dev 3, If 3, Class=Vendor Specific Class, Driver=option, 480M
        |__ Port 1: Dev 3, If 4, Class=Vendor Specific Class, Driver=option, 480M
        |__ Port 1: Dev 3, If 5, Class=Vendor Specific Class, Driver=qmi_wwan, 480M
wim@WimPiZeroWCamera:~ $ sudo apt install libqmi-utils udhcpc ifmetric

I went through the test commands from Jeff Geerling’s post related to QMI Mode setup, then created a config file for my wwan0 interface:

auto wwan0
iface wwan0 inet manual
     pre-up ifconfig wwan0 down
     pre-up echo Y > /sys/class/net/wwan0/qmi/raw_ip
     pre-up for _ in $(seq 1 10); do /usr/bin/test -c /dev/cdc-wdm0 && break; /bin/sleep 1; done
     pre-up for _ in $(seq 1 10); do /usr/bin/qmicli -d /dev/cdc-wdm0 --nas-get-signal-strength && break; /bin/sleep 1; done
     pre-up sudo qmicli -p -d /dev/cdc-wdm0 --device-open-net='net-raw-ip|net-no-qos-header' --wds-start-network="apn='h2g2',ip-type=4" --client-no-release-cid
     pre-up udhcpc -i wwan0
     pre-up /usr/sbin/ifmetric wwan0 400
     post-down /usr/bin/qmi-network /dev/cdc-wdm0 stop
You can see where I added the ifmetric command as the last pre-up line
Route and Ping from interfaces.

You can see in the image above that my Wi-Fi network is running IPv6 and the default ping uses that interface, while specifying the wwan0 interface causes the traffic to travel a different path.

ifconfig details.
wim@WimPiZeroWCamera:~ $ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:7c:6a:80 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.53/24 brd 192.168.0.255 scope global dynamic noprefixroute wlan0
       valid_lft 10482sec preferred_lft 9132sec
    inet6 2604:4080:1304:8010:8a38:1e12:3b21:5443/64 scope global dynamic mngtmpaddr noprefixroute
       valid_lft 24sec preferred_lft 14sec
    inet6 fe80::ea0d:3fe8:b6c4:da64/64 scope link
       valid_lft forever preferred_lft forever
3: wwan0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/none
    inet 100.198.30.32/26 scope global wwan0
       valid_lft forever preferred_lft forever
wim@WimPiZeroWCamera:~ $ sudo qmicli -d /dev/cdc-wdm0 --nas-get-signal-info
-get-serving-system
sudo qmi-network /dev/cdc-wdm0 status
sudo qmicli -d /dev/cdc-wdm0  --wds-get-packet-service-status[/dev/cdc-wdm0] Successfully got signal info
LTE:
        RSSI: '-74 dBm'
        RSRQ: '-12 dB'
        RSRP: '-102 dBm'
        SNR: '4.4 dB'
wim@WimPiZeroWCamera:~ $ sudo qmicli -d /dev/cdc-wdm0 --nas-get-signal-strength
[/dev/cdc-wdm0] Successfully got signal strength
Current:
        Network 'lte': '-74 dBm'
RSSI:
        Network 'lte': '-74 dBm'
ECIO:
        Network 'lte': '-2.5 dBm'
IO: '-106 dBm'
SINR (8): '9.0 dB'
RSRQ:
        Network 'lte': '-12 dB'
SNR:
        Network 'lte': '4.4 dB'
RSRP:
        Network 'lte': '-102 dBm'
wim@WimPiZeroWCamera:~ $ sudo qmicli -d /dev/cdc-wdm0 --nas-get-home-network
[/dev/cdc-wdm0] Successfully got home network:
        Home network:
                MCC: '310'
                MNC: '260'
                Description: 'T-Mobile'
wim@WimPiZeroWCamera:~ $ sudo qmicli -d /dev/cdc-wdm0 --nas-get-serving-system
[/dev/cdc-wdm0] Successfully got serving system:
        Registration state: 'registered'
        CS: 'attached'
        PS: 'attached'
        Selected network: '3gpp'
        Radio interfaces: '1'
                [0]: 'lte'
        Roaming status: 'off'
        Data service capabilities: '1'
                [0]: 'lte'
        Current PLMN:
                MCC: '310'
                MNC: '260'
                Description: '����.��i'
        Roaming indicators: '1'
                [0]: 'off' (lte)
        3GPP time zone offset: '-420' minutes
        3GPP daylight saving time adjustment: '1' hours
        3GPP location area code: '65534'
        3GPP cell ID: '45023373'
        Detailed status:
                Status: 'available'
                Capability: 'cs-ps'
                HDR Status: 'none'
                HDR Hybrid: 'no'
                Forbidden: 'no'
        LTE tracking area code: '11316'
        Full operator code info:
                MCC: '310'
                MNC: '260'
                MNC with PCS digit: 'yes'
wim@WimPiZeroWCamera:~ $ sudo qmi-network /dev/cdc-wdm0 status
Profile at '/etc/qmi-network.conf' not found...
Getting status with 'qmicli -d /dev/cdc-wdm0 --wds-get-packet-service-status  '...
Status: connected
wim@WimPiZeroWCamera:~ $ sudo qmicli -d /dev/cdc-wdm0  --wds-get-packet-service-status
[/dev/cdc-wdm0] Connection status: 'connected'
extra information

GPS on SIM7600G-H 4G HAT (B) for Raspberry Pi

I bought this device from Amazon to use for a project with a Raspberry Pi Zero and a data sim from my Google Fi Account where I wanted network connectivity. The fact that it had GPS as well was a bonus.

I installed gpsd on raspian. (apt install gpsd gpsd-clients -y) It didn’t automatically recognize the GPS. I was able to get it working by modifying /etc/default/gpsd to have the line DEVICES=”/dev/ttyUSB1″ and then starting the GPS with the command echo AT+CGPS=1 >/dev/ttyUSB2

After that combination, running gpsmon or cgps returned results after the GPS had been able to achieve a fix.

vi /etc/default/gpsd
echo AT+CGPS=1
gpsmon
lsusb -t

I’ve still not got it automatically starting the GPS with the echo command and am working to figure the best place to have that command.

SIM7600G-H 4G HAT (B) for Raspberry Pi, LTE Cat-4 4G / 3G / 2G Support, GNSS Positioning, Global Band
SKU: 19485
Part Number: SIM7600G-H 4G HAT (B)
Brand: Waveshare

Newsletter Signup

I remember visiting their web page from my phone. I remember visiting the restaurant last Friday. I don’t remember signing up for a newsletter, or actively giving them my email address.

Newsletter Email

I paid with my credit card by handing it to the server, who returned with the slips for me to sign.

I’m guessing that this is related to a merchant feature of using Square (or whatever they are named now) as a credit card processing platform, along with the fact that often with Square I’ll have email receipts instead of paper receipts.

Westcott Bay Shellfish Co.

Raspberry Pi ZeroW Camera Focus with libcamera-vid

Several years ago I was trying to play with a camera on a Raspberry Pi Zero and was using FFMPEG to stream video to my PC. Now that I’m trying out the Bullseye release of Raspian, I’m attempting to use the camera tools that are installed by default.

I’ve got an Arducam with 160° lens connected to my Pi Zero.

pi@WimPiZeroCamera:~ $ libcamera-vid --list-cameras
[0:01:26.600607679] [701]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3544-22656360
[0:01:26.690670361] [702] ERROR CameraSensor camera_sensor.cpp:591 'ov5647 10-0036': Camera sensor does not support test pattern modes.
[0:01:26.842438396] [702]  INFO RPI raspberrypi.cpp:1356 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media3 and ISP device /dev/media0
Available cameras
-----------------
0 : ov5647 [2592x1944] (/base/soc/i2c0mux/i2c@1/ov5647@36)
    Modes: 'SGBRG10_CSI2P' : 640x480 1296x972 1920x1080 2592x1944 

First I ran the previous command to see that the camera is recognized, then I run the following command to set up the port on the Pi. The program produces no output in the terminal until I connect from my PC.

pi@WimPiZeroCamera:~ $ libcamera-vid --timeout 0 --nopreview --listen --output tcp://0.0.0.0:5000

On the PC, I run VLC

Open Network Stream
tcp/h264://192.168.0.63:5000
View from the camera

looking back at the console output, you can see that it’s defaulting to 640×480 resolution.

pi@WimPiZeroCamera:~ $ libcamera-vid --timeout 0 --nopreview --listen --output tcp://0.0.0.0:5000
[2:02:18.390718603] [16931]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3544-22656360
[2:02:18.502791615] [17031] ERROR CameraSensor camera_sensor.cpp:591 'ov5647 10-0036': Camera sensor does not support test pattern modes.
[2:02:18.636067629] [17031]  INFO RPI raspberrypi.cpp:1356 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media3 and ISP device /dev/media0
[2:02:18.641028629] [16931]  INFO Camera camera.cpp:1029 configuring streams: (0) 640x480-YUV420
[2:02:18.644508629] [17031]  INFO RPI raspberrypi.cpp:760 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 640x480-SGBRG10_1X10 - Selected unicam format: 640x480-pGAA

When I stop the video on the PC, libcamera-vid exits on the Pi.

I can specify the width and height of the output at the Pi, but it seems to be having problems delivering data.

libcamera-vid --timeout 0 --nopreview --width 1920 --height 1080 --inline --listen -o tcp://0.0.0.0:5000
the video starts, but rapidly freezes.
pi@WimPiZeroCamera:~ $ libcamera-vid --timeout 0 --nopreview --width 1920 --height 1080 --inline --listen -o tcp://0.0.0.0:5000 
[0:01:23.973536453] [670]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3544-22656360
[0:01:24.087323064] [704] ERROR CameraSensor camera_sensor.cpp:591 'ov5647 10-0036': Camera sensor does not support test pattern modes.
[0:01:24.241746679] [704]  INFO RPI raspberrypi.cpp:1356 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media3 and ISP device /dev/media0
[0:01:24.247247304] [670]  INFO Camera camera.cpp:1029 configuring streams: (0) 1920x1080-YUV420
[0:01:24.250886379] [704]  INFO RPI raspberrypi.cpp:760 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1920x1080-SGBRG10_1X10 - Selected unicam format: 1920x1080-pGAA

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.204113] Internal error: Oops: 80000005 [#1] ARM

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.205952] Process libcamera-vid (pid: 704, stack limit = 0x5546931d)

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.205993] Stack: (0xc2d2de10 to 0xc2d2e000)

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206027] de00:                                     c2d2de3b c1b70ea0 c2d2de5c 00000000

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206068] de20: 00000000 00000000 00000000 00000000 c3b2ed20 b58bc074 00c9c038 00000003

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206104] de40: 00000002 00278d00 00004002 00000001 00000000 00000056 00000000 000180b5

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206140] de60: 00000000 00000000 00000000 00000000 00000000 00000000 00000004 0000001d

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206178] de80: 00278d00 00000000 00000000 c2d2de98 c0046c80 c000b100 c13b6014 c1b70ea0

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206216] dea0: c0c2b2c0 c1888ea0 00000000 c41df8c0 c2d2dedc c2d2dec0 c0013798 0a121acf

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206253] dec0: 00000000 bf1d1d50 c3b2ed21 00000000 c3b2ed20 c0c1f028 b58bc074 0000000e

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206292] dee0: c2d2defc c2d2def0 bf1d1d6c bf1d17b4 c2d2df14 c2d2df00 bf1c9148 bf1d1d5c

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206330] df00: c044560f c3b2ed21 c2d2dfa4 c2d2df18 c021fda0 bf1c9108 00000000 c0c1f028

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206369] df20: c0008ff0 00c5387d c2d2df6c c2d2df38 c0014720 c001377c 00000000 00000000

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206406] df40: 00000000 00000000 c0c9c038 60000010 c0008ff0 00c5387d 00000000 c0009104

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206444] df60: c2d2df94 c2d2df70 c00f8f20 c00fa1fc b6968a5c 0a121acf ffffffff b58bc074

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206481] df80: b4f11558 b4f0ba30 00000036 c00083e4 c2d2c000 00000000 00000000 c2d2dfa8

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206518] dfa0: c0008260 c021fc98 b58bc074 b4f11558 0000000e c044560f b58bc074 b6dfb788

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206555] dfc0: b58bc074 b4f11558 b4f0ba30 00000036 0bde9f08 00000014 b6ad9124 01167c88

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206595] dfe0: b6aabe94 b58bc04c b6a354a0 b6bcb1ac 60000010 0000000e 00000000 00000000

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206625] Backtrace: 

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.206653] [<bf1d17a8>] (video_usercopy [videodev]) from [<bf1d1d6c>] (video_ioctl2+0x1c/0x24 [videodev])

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.207763]  r10:0000000e r9:b58bc074 r8:c0c1f028 r7:c3b2ed20 r6:00000000 r5:c3b2ed21

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.207800]  r4:bf1d1d50

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.207820] [<bf1d1d50>] (video_ioctl2 [videodev]) from [<bf1c9148>] (v4l2_ioctl+0x4c/0x64 [videodev])

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.208594] [<bf1c90fc>] (v4l2_ioctl [videodev]) from [<c021fda0>] (sys_ioctl+0x114/0x9b0)

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.209024]  r5:c3b2ed21 r4:c044560f

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.209047] [<c021fc8c>] (sys_ioctl) from [<c0008260>] (ret_fast_syscall+0x0/0x1c)

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.209094] Exception stack(0xc2d2dfa8 to 0xc2d2dff0)

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.209128] dfa0:                   b58bc074 b4f11558 0000000e c044560f b58bc074 b6dfb788

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.209167] dfc0: b58bc074 b4f11558 b4f0ba30 00000036 0bde9f08 00000014 b6ad9124 01167c88

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.209202] dfe0: b6aabe94 b58bc04c b6a354a0 b6bcb1ac

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.209233]  r10:00000000 r9:c2d2c000 r8:c00083e4 r7:00000036 r6:b4f0ba30 r5:b4f11558

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.209261]  r4:b58bc074

Message from syslogd@WimPiZeroCamera at Jun  3 21:06:16 ...
 kernel:[   86.209294] Code: bad PC value

I’m including the output of dmesg here in case anyone has a solution to my problem. Most likely I’m going to switch back to the Buster release of raspian and see if everything works properly there.

pi@WimPiZeroCamera:~ $ dmesg 
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.15.32+ (dom@buildbot) (arm-linux-gnueabihf-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1538 Thu Mar 31 19:37:58 BST 2022
[    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[    0.000000] OF: fdt: Machine model: Raspberry Pi Zero W Rev 1.1
[    0.000000] random: fast init done
[    0.000000] Memory policy: Data cache writeback
[    0.000000] Reserved memory: created CMA memory pool at 0x0bc00000, size 256 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x000000001bffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x000000001bffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x000000001bffffff]
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 113680
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 video=Composite-1:720x480@60i smsc95xx.macaddr=B8:27:EB:B0:8B:F5 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  console=ttyS0,115200 console=tty1 root=PARTUUID=fb77dacb-02 rootfstype=ext4 fsck.repair=yes rootwait
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 177232K/458752K available (8994K kernel code, 1338K rwdata, 2932K rodata, 436K init, 546K bss, 19376K reserved, 262144K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] ftrace: allocating 31774 entries in 94 pages
[    0.000000] ftrace: allocated 94 pages with 5 groups
[    0.000000] trace event string verifier disabled
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] random: get_random_bytes called from start_kernel+0x474/0x6d8 with crng_init=1
[    0.000006] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns
[    0.000103] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
[    0.000218] bcm2835: system timer (irq = 27)
[    0.001053] Console: colour dummy device 80x30
[    0.001743] printk: console [tty1] enabled
[    0.001850] Calibrating delay loop... 697.95 BogoMIPS (lpj=3489792)
[    0.060393] pid_max: default: 32768 minimum: 301
[    0.060674] LSM: Security Framework initializing
[    0.060954] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.061048] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.063506] cgroup: Disabling memory control group subsystem
[    0.064019] CPU: Testing write buffer coherency: ok
[    0.066192] Setting up static identity map for 0x8220 - 0x8258
[    0.067811] devtmpfs: initialized
[    0.083783] VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
[    0.084268] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.084378] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[    0.127092] pinctrl core: initialized pinctrl subsystem
[    0.129535] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.134406] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[    0.142234] audit: initializing netlink subsys (disabled)
[    0.143981] thermal_sys: Registered thermal governor 'step_wise'
[    0.145036] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
[    0.145154] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.145493] Serial: AMBA PL011 UART driver
[    0.151112] audit: type=2000 audit(0.140:1): state=initialized audit_enabled=0 res=1
[    0.160187] bcm2835-mbox 2000b880.mailbox: mailbox enabled
[    0.191113] raspberrypi-firmware soc:firmware: Attached to firmware from 2022-03-24T13:20:54, variant start
[    0.201153] raspberrypi-firmware soc:firmware: Firmware hash is e5a963efa66a1974127860b42e913d2374139ff5
[    0.262032] Kprobes globally optimized
[    0.272466] bcm2835-dma 20007000.dma: DMA legacy API manager, dmachans=0x1
[    0.276096] SCSI subsystem initialized
[    0.276738] usbcore: registered new interface driver usbfs
[    0.276920] usbcore: registered new interface driver hub
[    0.277084] usbcore: registered new device driver usb
[    0.277674] usb_phy_generic phy: supply vcc not found, using dummy regulator
[    0.278596] pps_core: LinuxPPS API ver. 1 registered
[    0.278672] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.278771] PTP clock support registered
[    0.281877] clocksource: Switched to clocksource timer
[    0.370365] VFS: Disk quotas dquot_6.6.0
[    0.370608] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.370926] FS-Cache: Loaded
[    0.371393] CacheFiles: Loaded
[    0.372730] simple-framebuffer 1eaa9000.framebuffer: framebuffer at 0x1eaa9000, 0x151800 bytes
[    0.372839] simple-framebuffer 1eaa9000.framebuffer: format=a8r8g8b8, mode=720x480x32, linelength=2880
[    2.316040] Console: switching to colour frame buffer device 90x30
[    2.325233] simple-framebuffer 1eaa9000.framebuffer: fb0: simplefb registered!
[    2.350708] NET: Registered PF_INET protocol family
[    2.354867] IP idents hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    2.360331] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[    2.367949] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    2.371976] TCP bind hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    2.375979] TCP: Hash tables configured (established 4096 bind 4096)
[    2.380172] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[    2.384369] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[    2.388971] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    2.394705] RPC: Registered named UNIX socket transport module.
[    2.398827] RPC: Registered udp transport module.
[    2.402805] RPC: Registered tcp transport module.
[    2.406660] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    2.412559] armv6-pmu arm-pmu: hw perfevents: no irqs for PMU, sampling events not supported
[    2.420478] hw perfevents: enabled with armv6_1176 PMU driver, 3 counters available
[    2.429866] Initialise system trusted keyrings
[    2.434734] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[    2.454069] zbud: loaded
[    2.461621] FS-Cache: Netfs 'nfs' registered for caching
[    2.467344] NFS: Registering the id_resolver key type
[    2.471447] Key type id_resolver registered
[    2.475469] Key type id_legacy registered
[    2.479543] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    2.483449] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    2.489597] Key type asymmetric registered
[    2.493540] Asymmetric key parser 'x509' registered
[    2.497458] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 247)
[    2.501169] io scheduler mq-deadline registered
[    2.504848] io scheduler kyber registered
[    2.524068] bcm2835-rng 20104000.rng: hwrng registered
[    2.528560] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000 mem_size:0x20000000(512 MiB)
[    2.538148] gpiomem-bcm2835 20200000.gpiomem: Initialised: Registers at 0x20200000
[    2.566824] brd: module loaded
[    2.585348] loop: module loaded
[    2.590544] Loading iSCSI transport class v2.0-870.
[    2.597691] usbcore: registered new interface driver smsc95xx
[    2.601558] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    3.334020] Core Release: 2.80a
[    3.337668] Setting default values for core params
[    3.341198] Finished setting default values for core params
[    3.545225] Using Buffer DMA mode
[    3.548723] Periodic Transfer Interrupt Enhancement - disabled
[    3.552244] Multiprocessor Interrupt Enhancement - disabled
[    3.555760] OTG VER PARAM: 0, OTG VER FLAG: 0
[    3.559326] Dedicated Tx FIFOs mode

[    3.564631] WARN::dwc_otg_hcd_init:1074: FIQ DMA bounce buffers: virt = cbd04000 dma = 0x8bd04000 len=9024
[    3.575023] FIQ FSM acceleration enabled for :
               Non-periodic Split Transactions
               Periodic Split Transactions
               High-Speed Isochronous Endpoints
               Interrupt/Control Split Transaction hack enabled
[    3.591752] dwc_otg: Microframe scheduler enabled

[    3.592119] WARN::hcd_init_fiq:457: FIQ on core 0

[    3.598562] WARN::hcd_init_fiq:458: FIQ ASM at c0685988 length 36

[    3.604610] WARN::hcd_init_fiq:497: MPHI regs_base at dc810000
[    3.610870] dwc_otg 20980000.usb: DWC OTG Controller
[    3.614171] dwc_otg 20980000.usb: new USB bus registered, assigned bus number 1
[    3.617505] dwc_otg 20980000.usb: irq 56, io mem 0x00000000
[    3.620707] Init: Port Power? op_state=1
[    3.623880] Init: Power Port (0)
[    3.627538] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.15
[    3.633926] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    3.637264] usb usb1: Product: DWC OTG Controller
[    3.640556] usb usb1: Manufacturer: Linux 5.15.32+ dwc_otg_hcd
[    3.643942] usb usb1: SerialNumber: 20980000.usb
[    3.648695] hub 1-0:1.0: USB hub found
[    3.652208] hub 1-0:1.0: 1 port detected
[    3.656876] dwc_otg: FIQ enabled
[    3.656917] dwc_otg: NAK holdoff enabled
[    3.656934] dwc_otg: FIQ split-transaction FSM enabled
[    3.656969] Module dwc_common_port init
[    3.657671] usbcore: registered new interface driver usb-storage
[    3.661498] mousedev: PS/2 mouse device common for all mice
[    3.669132] sdhci: Secure Digital Host Controller Interface driver
[    3.672648] sdhci: Copyright(c) Pierre Ossman
[    3.676899] sdhci-pltfm: SDHCI platform and OF driver helper
[    3.681762] ledtrig-cpu: registered to indicate activity on CPUs
[    3.686524] hid: raw HID events driver (C) Jiri Kosina
[    3.690276] usbcore: registered new interface driver usbhid
[    3.693802] usbhid: USB HID core driver
[    3.705200] Initializing XFRM netlink socket
[    3.709139] NET: Registered PF_PACKET protocol family
[    3.712860] Key type dns_resolver registered
[    3.717207] registered taskstats version 1
[    3.720496] Loading compiled-in X.509 certificates
[    3.742539] uart-pl011 20201000.serial: cts_event_workaround enabled
[    3.746175] 20201000.serial: ttyAMA0 at MMIO 0x20201000 (irq = 81, base_baud = 0) is a PL011 rev2
[    3.757468] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    3.761772] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[    3.768052] mmc-bcm2835 20300000.mmcnr: mmc_debug:0 mmc_debug2:0
[    3.771535] mmc-bcm2835 20300000.mmcnr: DMA channel allocated
[    3.803125] sdhost: log_buf @ (ptrval) (8bd03000)
[    3.855698] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    3.883185] of_cfs_init
[    3.887392] of_cfs_init: OK
[    3.893814] Waiting for root device PARTUUID=fb77dacb-02...
[    3.963217] mmc0: host does not support reading read-only switch, assuming write-enable
[    3.969841] mmc0: new high speed SDHC card at address aaaa
[    3.975484] mmcblk0: mmc0:aaaa SU32G 29.7 GiB 
[    3.985296]  mmcblk0: p1 p2
[    3.990746] mmcblk0: mmc0:aaaa SU32G 29.7 GiB
[    4.021138] mmc1: new high speed SDIO card at address 0001
[    4.025652] EXT4-fs (mmcblk0p2): INFO: recovery required on readonly filesystem
[    4.029180] EXT4-fs (mmcblk0p2): write access will be enabled during recovery
[    4.645008] EXT4-fs (mmcblk0p2): recovery complete
[    4.652774] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none.
[    4.659908] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    4.672891] devtmpfs: mounted
[    4.683522] Freeing unused kernel image (initmem) memory: 436K
[    4.687220] Kernel memory protection not selected by kernel config.
[    4.690800] Run /sbin/init as init process
[    4.694317]   with arguments:
[    4.694341]     /sbin/init
[    4.694360]   with environment:
[    4.694373]     HOME=/
[    4.694388]     TERM=linux
[    5.343914] systemd[1]: System time before build time, advancing clock.
[    5.519817] NET: Registered PF_INET6 protocol family
[    5.526214] Segment Routing with IPv6
[    5.529914] In-situ OAM (IOAM) with IPv6
[    5.645623] systemd[1]: systemd 247.3-7+rpi1 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=unified)
[    5.658634] systemd[1]: Detected architecture arm.
[    5.697216] systemd[1]: Set hostname to <WimPiZeroCamera.WimsWorld>.
[    8.823552] systemd[1]: Queued start job for default target Multi-User System.
[    8.832343] random: systemd: uninitialized urandom read (16 bytes read)
[    8.845466] systemd[1]: Created slice system-getty.slice.
[    8.855414] random: systemd: uninitialized urandom read (16 bytes read)
[    8.862590] systemd[1]: Created slice system-modprobe.slice.
[    8.871824] random: systemd: uninitialized urandom read (16 bytes read)
[    8.879006] systemd[1]: Created slice system-systemd\x2dfsck.slice.
[    8.890763] systemd[1]: Created slice User and Session Slice.
[    8.901199] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.
[    8.911716] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[    8.924537] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[    8.939726] systemd[1]: Reached target Local Encrypted Volumes.
[    8.950927] systemd[1]: Reached target Paths.
[    8.961450] systemd[1]: Reached target Slices.
[    8.971718] systemd[1]: Reached target Swap.
[    8.992662] systemd[1]: Listening on Syslog Socket.
[    9.004199] systemd[1]: Listening on fsck to fsckd communication Socket.
[    9.014989] systemd[1]: Listening on initctl Compatibility Named Pipe.
[    9.027787] systemd[1]: Listening on Journal Audit Socket.
[    9.039590] systemd[1]: Listening on Journal Socket (/dev/log).
[    9.051807] systemd[1]: Listening on Journal Socket.
[    9.064158] systemd[1]: Listening on udev Control Socket.
[    9.075266] systemd[1]: Listening on udev Kernel Socket.
[    9.086732] systemd[1]: Condition check resulted in Huge Pages File System being skipped.
[    9.105301] systemd[1]: Mounting POSIX Message Queue File System...
[    9.142938] systemd[1]: Mounting RPC Pipe File System...
[    9.196885] systemd[1]: Mounting Kernel Debug File System...
[    9.263061] systemd[1]: Mounting Kernel Trace File System...
[    9.283089] systemd[1]: Condition check resulted in Kernel Module supporting RPCSEC_GSS being skipped.
[    9.326171] systemd[1]: Starting Restore / save the current clock...
[    9.375407] systemd[1]: Starting Set the console keyboard layout...
[    9.444206] systemd[1]: Starting Create list of static device nodes for the current kernel...
[    9.573546] systemd[1]: Starting Load Kernel Module configfs...
[    9.644045] systemd[1]: Starting Load Kernel Module drm...
[    9.715011] systemd[1]: Starting Load Kernel Module fuse...
[    9.772720] systemd[1]: Condition check resulted in Set Up Additional Binary Formats being skipped.
[    9.883008] systemd[1]: Starting File System Check on Root Device...
[    9.959381] fuse: init (API version 7.34)
[   10.056397] systemd[1]: Starting Journal Service...
[   10.173562] systemd[1]: Starting Load Kernel Modules...
[   10.293577] systemd[1]: Starting Coldplug All udev Devices...
[   10.497717] systemd[1]: Mounted POSIX Message Queue File System.
[   10.568086] systemd[1]: Mounted RPC Pipe File System.
[   10.656644] systemd[1]: Mounted Kernel Debug File System.
[   10.735604] systemd[1]: Mounted Kernel Trace File System.
[   10.825311] systemd[1]: Finished Restore / save the current clock.
[   10.894803] systemd[1]: Finished Create list of static device nodes for the current kernel.
[   10.961170] systemd[1]: modprobe@configfs.service: Succeeded.
[   11.025586] systemd[1]: Finished Load Kernel Module configfs.
[   11.079411] systemd[1]: modprobe@drm.service: Succeeded.
[   11.132309] systemd[1]: Finished Load Kernel Module drm.
[   11.185670] systemd[1]: modprobe@fuse.service: Succeeded.
[   11.242902] systemd[1]: Finished Load Kernel Module fuse.
[   11.312343] systemd[1]: Finished Load Kernel Modules.
[   11.428197] systemd[1]: Mounting FUSE Control File System...
[   11.602844] systemd[1]: Mounting Kernel Configuration File System...
[   11.723998] systemd[1]: Started File System Check Daemon to report status.
[   11.863618] systemd[1]: Starting Apply Kernel Variables...
[   12.002325] systemd[1]: Finished File System Check on Root Device.
[   12.076580] systemd[1]: Mounted FUSE Control File System.
[   12.137696] systemd[1]: Mounted Kernel Configuration File System.
[   12.283330] systemd[1]: Starting Remount Root and Kernel File Systems...
[   12.454112] systemd[1]: Finished Apply Kernel Variables.
[   12.531005] systemd[1]: Started Journal Service.
[   13.322293] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null). Quota mode: none.
[   13.886004] systemd-journald[100]: Received client request to flush runtime journal.
[   13.928907] systemd-journald[100]: File /var/log/journal/68fa56d97f7c4ad18b377cc5780ee614/system.journal corrupted or uncleanly shut down, renaming and replacing.
[   18.180305] mc: Linux media interface: v0.10
[   18.288049] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[   18.290893] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[   18.290953] [vc_sm_connected_init]: start
[   18.343502] [vc_sm_connected_init]: installed successfully
[   18.492369] videodev: Linux video capture interface: v2.00
[   18.606837] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[   18.610017] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[   18.622220] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[   18.648452] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[   18.651155] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[   18.707824] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[   18.723636] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[   18.726664] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[   18.736682] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[   18.738200] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[   18.738293] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[   18.738336] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[   18.738374] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[   18.740160] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[   18.758906] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[   18.782242] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video20
[   18.803152] bcm2835_audio bcm2835_audio: there is not valid maps for state default
[   18.806862] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video21
[   18.809409] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video22
[   18.823238] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video23
[   18.823323] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[   18.823374] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[   18.823412] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[   18.823447] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[   18.825769] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[   18.840766] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[   18.840912] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[   18.871541] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[   18.871647] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[   18.907048] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[   18.907151] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[   18.924107] bcm2835-codec bcm2835-codec: Device registered as /dev/video18
[   18.924213] bcm2835-codec bcm2835-codec: Loaded V4L2 image_fx
[   18.947826] bcm2835-codec bcm2835-codec: Device registered as /dev/video31
[   18.947931] bcm2835-codec bcm2835-codec: Loaded V4L2 encode_image
[   19.858213] i2c i2c-11: Added multiplexed i2c bus 0
[   19.859223] i2c 10-0036: Fixing up cyclic dependency with 20801000.csi
[   19.860015] i2c i2c-11: Added multiplexed i2c bus 10
[   21.188839] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[   21.706164] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[   21.750115] cfg80211: loaded regulatory.db is malformed or signature is missing/invalid
[   22.412389] brcmfmac: F1 signature read @0x18000000=0x1541a9a6
[   22.561652] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[   22.563589] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43430-sdio.raspberrypi,model-zero-w.bin failed with error -2
[   22.572818] usbcore: registered new interface driver brcmfmac
[   22.885833] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[   22.886140] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43430-sdio for chip BCM43430/1
[   22.899684] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Jul 19 2021 03:24:18 version 7.45.98 (TOB) (56df937 CY) FWID 01-8e14b897
[   23.403642] checking generic (1eaa9000 151800) vs hw (0 ffffffff)
[   23.403700] fb0: switching to vc4 from simple
[   23.460836] Console: switching to colour dummy device 80x30
[   23.502302] vc4-drm soc:gpu: bound 20400000.hvs (ops vc4_hvs_ops [vc4])
[   23.572366] Registered IR keymap rc-cec
[   23.572797] rc rc0: vc4 as /devices/platform/soc/20902000.hdmi/rc/rc0
[   23.573285] input: vc4 as /devices/platform/soc/20902000.hdmi/rc/rc0/input0
[   28.080722] 8021q: 802.1Q VLAN Support v1.8
[   29.503575] uart-pl011 20201000.serial: no DMA platform data
[   29.815882] Adding 102396k swap on /var/swap.  Priority:-2 extents:4 across:249856k SSFS
[   30.952146] random: crng init done
[   30.952182] random: 7 urandom warning(s) missed due to ratelimiting
[   33.878808] Bluetooth: Core ver 2.22
[   33.878983] NET: Registered PF_BLUETOOTH protocol family
[   33.879004] Bluetooth: HCI device and connection manager initialized
[   33.879041] Bluetooth: HCI socket layer initialized
[   33.879065] Bluetooth: L2CAP socket layer initialized
[   33.879109] Bluetooth: SCO socket layer initialized
[   33.898769] Bluetooth: HCI UART driver ver 2.3
[   33.898816] Bluetooth: HCI UART protocol H4 registered
[   33.898969] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   33.899327] Bluetooth: HCI UART protocol Broadcom registered
[   34.402009] cam-dummy-reg: disabling
[   34.922194] vc4-drm soc:gpu: bound 20400000.hvs (ops vc4_hvs_ops [vc4])
[   34.942692] Registered IR keymap rc-cec
[   34.942995] rc rc0: vc4 as /devices/platform/soc/20902000.hdmi/rc/rc0
[   34.943342] input: vc4 as /devices/platform/soc/20902000.hdmi/rc/rc0/input1
[   34.951397] vc4-drm soc:gpu: bound 20902000.hdmi (ops vc4_hdmi_ops [vc4])
[   34.962416] vc4-drm soc:gpu: bound 20004000.txp (ops vc4_txp_ops [vc4])
[   34.963176] vc4-drm soc:gpu: bound 20206000.pixelvalve (ops vc4_crtc_ops [vc4])
[   34.963844] vc4-drm soc:gpu: bound 20207000.pixelvalve (ops vc4_crtc_ops [vc4])
[   34.964501] vc4-drm soc:gpu: bound 20807000.pixelvalve (ops vc4_crtc_ops [vc4])
[   34.965047] vc4-drm soc:gpu: bound 20c00000.v3d (ops vc4_v3d_ops [vc4])
[   35.004689] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on minor 0
[   35.005276] vc4-drm soc:gpu: [drm] Cannot find any crtc or sizes
[   36.267635] ov5647 10-0036: Consider updating driver ov5647 to match on endpoints
[   37.037078] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   37.037123] Bluetooth: BNEP filters: protocol multicast
[   37.037157] Bluetooth: BNEP socket layer initialized
[   37.216575] NET: Registered PF_ALG protocol family
[   39.103893] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
[   40.789395] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   42.261353] ICMPv6: process `dhcpcd' is using deprecated sysctl (syscall) net.ipv6.neigh.wlan0.retrans_time - use net.ipv6.neigh.wlan0.retrans_time_ms instead
[   45.282398] vc4-drm soc:gpu: [drm] Cannot find any crtc or sizes
[   86.203912] 8<--- cut here ---
[   86.203998] Unable to handle kernel paging request at virtual address bfa0dc9c
[   86.204036] pgd = 4ed01598
[   86.204067] [bfa0dc9c] *pgd=00000000
[   86.204113] Internal error: Oops: 80000005 [#1] ARM
[   86.204142] Modules linked in: cmac algif_hash aes_arm aes_generic ecb algif_skcipher af_alg bnep ov5647 snd_soc_hdmi_codec hci_uart btbcm bluetooth ecdh_generic ecc libaes 8021q garp stp llc vc4 brcmfmac cec brcmutil sha256_generic libsha256 drm_kms_helper cfg80211 snd_soc_core snd_compress snd_pcm_dmaengine syscopyarea rfkill sysfillrect i2c_mux_pinctrl sysimgblt raspberrypi_hwmon fb_sys_fops i2c_mux bcm2835_unicam v4l2_dv_timings v4l2_fwnode v4l2_async snd_bcm2835(C) bcm2835_codec(C) i2c_bcm2835 bcm2835_v4l2(C) v4l2_mem2mem bcm2835_isp(C) bcm2835_mmal_vchiq(C) snd_pcm videobuf2_vmalloc videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 snd_timer videobuf2_common snd vc_sm_cma(C) videodev mc uio_pdrv_genirq fixed uio fuse drm drm_panel_orientation_quirks backlight ip_tables x_tables ipv6
[   86.204627] CPU: 0 PID: 704 Comm: libcamera-vid Tainted: G         C        5.15.32+ #1538
[   86.204667] Hardware name: BCM2835
[   86.204687] PC is at 0xbfa0dc9c
[   86.204718] LR is at video_usercopy+0x4e8/0x5a8 [videodev]
[   86.205310] pc : [<bfa0dc9c>]    lr : [<bf1d1c90>]    psr: 60000013
[   86.205338] sp : c2d2de10  ip : c2d2de10  fp : c2d2deec
[   86.205362] r10: c0c1f028  r9 : 00000000  r8 : 00000000
[   86.205386] r7 : c2d2de3c  r6 : 00000000  r5 : c044560f  r4 : c050560f
[   86.205411] r3 : 00000000  r2 : bf1f3a40  r1 : 0a121acf  r0 : c399c2e8
[   86.205437] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[   86.205467] Control: 00c5387d  Table: 059d0008  DAC: 00000055
[   86.205490] Register r0 information: slab kmalloc-8k start c399c000 pointer offset 744 size 8192
[   86.205564] Register r1 information: non-paged memory
[   86.205597] Register r2 information: 58-page vmalloc region starting at 0xbf1c9000 allocated at load_module+0xa74/0x25f8
[   86.205667] Register r3 information: NULL pointer
[   86.205696] Register r4 information: non-slab/vmalloc memory
[   86.205727] Register r5 information: non-slab/vmalloc memory
[   86.205755] Register r6 information: NULL pointer
[   86.205780] Register r7 information: non-slab/vmalloc memory
[   86.205809] Register r8 information: NULL pointer
[   86.205834] Register r9 information: NULL pointer
[   86.205862] Register r10 information: non-slab/vmalloc memory
[   86.205896] Register r11 information: non-slab/vmalloc memory
[   86.205924] Register r12 information: non-slab/vmalloc memory
[   86.205952] Process libcamera-vid (pid: 704, stack limit = 0x5546931d)
[   86.205993] Stack: (0xc2d2de10 to 0xc2d2e000)
[   86.206027] de00:                                     c2d2de3b c1b70ea0 c2d2de5c 00000000
[   86.206068] de20: 00000000 00000000 00000000 00000000 c3b2ed20 b58bc074 00c9c038 00000003
[   86.206104] de40: 00000002 00278d00 00004002 00000001 00000000 00000056 00000000 000180b5
[   86.206140] de60: 00000000 00000000 00000000 00000000 00000000 00000000 00000004 0000001d
[   86.206178] de80: 00278d00 00000000 00000000 c2d2de98 c0046c80 c000b100 c13b6014 c1b70ea0
[   86.206216] dea0: c0c2b2c0 c1888ea0 00000000 c41df8c0 c2d2dedc c2d2dec0 c0013798 0a121acf
[   86.206253] dec0: 00000000 bf1d1d50 c3b2ed21 00000000 c3b2ed20 c0c1f028 b58bc074 0000000e
[   86.206292] dee0: c2d2defc c2d2def0 bf1d1d6c bf1d17b4 c2d2df14 c2d2df00 bf1c9148 bf1d1d5c
[   86.206330] df00: c044560f c3b2ed21 c2d2dfa4 c2d2df18 c021fda0 bf1c9108 00000000 c0c1f028
[   86.206369] df20: c0008ff0 00c5387d c2d2df6c c2d2df38 c0014720 c001377c 00000000 00000000
[   86.206406] df40: 00000000 00000000 c0c9c038 60000010 c0008ff0 00c5387d 00000000 c0009104
[   86.206444] df60: c2d2df94 c2d2df70 c00f8f20 c00fa1fc b6968a5c 0a121acf ffffffff b58bc074
[   86.206481] df80: b4f11558 b4f0ba30 00000036 c00083e4 c2d2c000 00000000 00000000 c2d2dfa8
[   86.206518] dfa0: c0008260 c021fc98 b58bc074 b4f11558 0000000e c044560f b58bc074 b6dfb788
[   86.206555] dfc0: b58bc074 b4f11558 b4f0ba30 00000036 0bde9f08 00000014 b6ad9124 01167c88
[   86.206595] dfe0: b6aabe94 b58bc04c b6a354a0 b6bcb1ac 60000010 0000000e 00000000 00000000
[   86.206625] Backtrace: 
[   86.206653] [<bf1d17a8>] (video_usercopy [videodev]) from [<bf1d1d6c>] (video_ioctl2+0x1c/0x24 [videodev])
[   86.207763]  r10:0000000e r9:b58bc074 r8:c0c1f028 r7:c3b2ed20 r6:00000000 r5:c3b2ed21
[   86.207800]  r4:bf1d1d50
[   86.207820] [<bf1d1d50>] (video_ioctl2 [videodev]) from [<bf1c9148>] (v4l2_ioctl+0x4c/0x64 [videodev])
[   86.208594] [<bf1c90fc>] (v4l2_ioctl [videodev]) from [<c021fda0>] (sys_ioctl+0x114/0x9b0)
[   86.209024]  r5:c3b2ed21 r4:c044560f
[   86.209047] [<c021fc8c>] (sys_ioctl) from [<c0008260>] (ret_fast_syscall+0x0/0x1c)
[   86.209094] Exception stack(0xc2d2dfa8 to 0xc2d2dff0)
[   86.209128] dfa0:                   b58bc074 b4f11558 0000000e c044560f b58bc074 b6dfb788
[   86.209167] dfc0: b58bc074 b4f11558 b4f0ba30 00000036 0bde9f08 00000014 b6ad9124 01167c88
[   86.209202] dfe0: b6aabe94 b58bc04c b6a354a0 b6bcb1ac
[   86.209233]  r10:00000000 r9:c2d2c000 r8:c00083e4 r7:00000036 r6:b4f0ba30 r5:b4f11558
[   86.209261]  r4:b58bc074
[   86.209294] Code: bad PC value
[   86.209325] ---[ end trace 573ed3b4c982bd9e ]---

Adding the verbose option gets some interesting information.

pi@WimPiZeroCamera:~ $ libcamera-vid --verbose --timeout 0 --nopreview --listen --output tcp://0.0.0.0:5000
Options:
    verbose: 1
    info_text:#%frame (%fps fps) exp %exp ag %ag dg %dg
    timeout: 0
    width: 640
    height: 480
    output: tcp://0.0.0.0:5000
    post_process_file: 
    rawfull: 0
    preview: none
    qt-preview: 0
    transform: identity
    roi: all
    metering: centre
    exposure: normal
    ev: 0
    awb: auto
    flush: false
    wrap: 0
    brightness: 0
    contrast: 1
    saturation: 1
    sharpness: 1
    framerate: 30
    denoise: auto
    viewfinder-width: 0
    viewfinder-height: 0
    tuning-file: (libcamera)
    lores-width: 0
    lores-height: 0
    mode: unspecified
    viewfinder-mode: unspecified
    bitrate: 0
    profile: 
    level:  
    intra: 0
    inline: 0
    save-pts: 
    codec: h264
    quality (for MJPEG): 50
    keypress: 0
    signal: 0
    initial: record
    split: 0
    segment: 0
    circular: 0
Waiting for client to connect...
Client connection accepted
Running without preview window
Opening camera...
[0:01:26.152722968] [676]  INFO Camera camera_manager.cpp:293 libcamera v0.0.0+3544-22656360
[0:01:26.265051532] [688] ERROR CameraSensor camera_sensor.cpp:591 'ov5647 10-0036': Camera sensor does not support test pattern modes.
[0:01:26.418635710] [688]  INFO RPI raspberrypi.cpp:1356 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media3 and ISP device /dev/media0
Acquired camera /base/soc/i2c0mux/i2c@1/ov5647@36
Configuring video...
[0:01:26.426674609] [676]  INFO Camera camera.cpp:1029 configuring streams: (0) 640x480-YUV420
[0:01:26.430277012] [688]  INFO RPI raspberrypi.cpp:760 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 640x480-SGBRG10_1X10 - Selected unicam format: 640x480-pGAA
Camera streams configured
Buffers allocated and mapped
Video setup complete
Opened H264Encoder on /dev/video11 as fd 25
Got 6 output buffers
Got 12 capture buffers
Codec streaming started
Requests created
Camera started!
Viewfinder frame 0
NetOutput: output buffer 0xb3463000 size 10770
Viewfinder frame 1
NetOutput: output buffer 0xb33e3000 size 5366
Viewfinder frame 2
NetOutput: output buffer 0xb3363000 size 5147
Viewfinder frame 3
NetOutput: output buffer 0xb32e3000 size 8520
Viewfinder frame 4
NetOutput: output buffer 0xb3263000 size 14873
Viewfinder frame 5
NetOutput: output buffer 0xb31e3000 size 17447
Viewfinder frame 6
NetOutput: output buffer 0xb3163000 size 17869
Viewfinder frame 7
NetOutput: output buffer 0xb30e3000 size 17804
Viewfinder frame 8
NetOutput: output buffer 0xb3063000 size 18022
Viewfinder frame 9
NetOutput: output buffer 0xb2fe3000 size 17997
Viewfinder frame 10
NetOutput: output buffer 0xb2f63000 size 17849
Viewfinder frame 11
NetOutput: output buffer 0xb2ee3000 size 17926
Viewfinder frame 12
NetOutput: output buffer 0xb3463000 size 18017
Viewfinder frame 13
NetOutput: output buffer 0xb33e3000 size 18010
Viewfinder frame 14
NetOutput: output buffer 0xb3363000 size 18047

Each time I try higher resolution, the pi program crashes, and sometimes it leaves the pi completely nonresponsive on the network, requiring a power cycle to recover it.

Google G Suite Reprieve

According to several articles, Google reversed course and allowed most people that had been using the service for a simple personal email domain to continue to do so.

I’m still quite happy that I moved to using google domains and its email forwarding feature. I believe my move is simpler to maintain in the long term, as long as google continues to allow email forwarding as part of their domains service.

DD-WRT Upgrade part two

The upgrade of DD-WRT that I performed this last Saturday brought the version from a 2019 release to a 2022 release. DD-WRT always recommends doing a factory reset of settings before and after flashing a new firmware. As far as I’ve been able to find out, DD-WRT doesn’t provide any way to back up the settings in any form other than a binary download that is not compatible between versions. This shortcoming makes upgrading a router with many customized settings a difficult process.

dd-wrt status screen

I performed the flash upgrade without resetting everything to defaults. It wasn’t until I was going to bed on Saturday night that I realized not all things were working properly. All of the ipv4 services appeared to be working properly. The ipv6 services were not working properly on my internal network clients.

I have a Microsoft Windows Server 2016 Essentials machine running several services including file sharing on my internal network. I also have my Windows 10 desktop, and several Raspberry Pi machines. Some of the Pi machines access the file shares on the server for both reading and writing.

I’ve found that when ipv6 is not allocating global addresses for the windows server and clients, file sharing doesn’t work properly. This is an issue I don’t understand, and don’t want to change the default operation of the windows server or windows client machines, which might create more long term maintenance headaches.

Among the customizations I have set in the router:

  • Router Name
  • Domain Name
  • Local IP (v4) address is 192.168.0.1 instead of 192.168.1.1
  • close to 35 DHCP reservations for machines that run on my internal network.
  • IPv6 enabled and configured for DHCPv6 with Prefix Delegation
  • DDNS service configured as in previous post.
  • Wireless SSID
  • Wireless Password
  • SSH access to the router with rsa keys entered for allowed machines.

I figured out that the primary settings for DHCP and DNS resolution are run using dnsmasq, and the configuration file can be viewed by looking at /tmp/dnsmasq.conf in the ssh console. All of the dns reservations are listed in the form of:

dhcp-host=b0:39:56:78:83:b0,GS108Tv2,192.168.0.123,1440m
dhcp-host=28:c6:8e:09:30:cb,GS108Tv2-LR,192.168.0.125,1440m
dhcp-host=04:a1:51:b0:a6:9a,GS108Tv2-OW,192.168.0.124,1440m

Copying all of them out of the console as one entry and adding them to the Additional Dnsmasq Options field was much easier than pasting MAC addresses, Hostnames, and IP addresses into separate field for each entry.

After adding them via the web interface here, they look exactly like the entries created in the static leases section of the interface. I was hoping that the system would parse them and display them in the static leases section, but it doesn’t seem to do that.

My SSH terminal program is configured to send a series of commands to the console each time I connect which reminds me of the current setup as well as how to examine it after a long time when I’ve not worked on the device.

  • date ; uptime
  • route -A inet
  • route -A inet6
  • ip6tables -vnL
  • cat /tmp/dnsmasq.conf
  • cat /tmp/dhcp6c.conf
  • cat /tmp/radvd.conf
  • ifconfig

I’m currently not dumping the iptables (v4) output simply because there are a large number of rules that don’t get used which takes up a lot of extra space scrolling by.

I’ve compared the ipv4 and ipv6 routes from when ipv6 was not working, and they are identical.

root@Netgear-R7000:~# route -A inet
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         br1-mballard-v1 0.0.0.0         UG    0      0        0 vlan2
24.35.91.128    *               255.255.255.192 U     0      0        0 vlan2
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
192.168.0.0     *               255.255.255.0   U     0      0        0 br0
root@Netgear-R7000:~# route -A inet6
Kernel IPv6 routing table
Destination                                 Next Hop                                Flags Metric Ref    Use Iface
2604:4080:1304::/64                         ::                                      UA    256    0        0 vlan2   
2604:4080:1304:8010::/60                    ::                                      U     256    0        0 br0     
fe80::/64                                   ::                                      U     256    0        0 eth0    
fe80::/64                                   ::                                      U     256    0        0 vlan1   
fe80::/64                                   ::                                      U     256    0        0 eth1    
fe80::/64                                   ::                                      U     256    0        0 eth2    
fe80::/64                                   ::                                      U     256    1       23 br0     
fe80::/64                                   ::                                      U     256    0        0 vlan2   
::/0                                        fe80::22c:c8ff:fe42:24bf                UGDA  1024   2      302 vlan2   
::/0                                        ::                                      U     2048   2       38 vlan2   
::/0                                        ::                                      !n    -1     1      372 lo      
::1/128                                     ::                                      Un    0      3       15 lo      
2604:4080:1304::/128                        ::                                      Un    0      1        0 lo      
2604:4080:1304:0:b27f:b9ff:fe83:6590/128    ::                                      Un    0      3       75 lo      
2604:4080:1304:8010::/128                   ::                                      Un    0      1        0 lo      
2604:4080:1304:8010:b27f:b9ff:fe83:6591/128 ::                                      Un    0      3       64 lo      
fe80::/128                                  ::                                      Un    0      1        0 lo      
fe80::/128                                  ::                                      Un    0      1        0 lo      
fe80::/128                                  ::                                      Un    0      1        0 lo      
fe80::/128                                  ::                                      Un    0      1        0 lo      
fe80::/128                                  ::                                      Un    0      1        0 lo      
fe80::/128                                  ::                                      Un    0      1        0 lo      
fe80::b27f:b9ff:fe83:658f/128               ::                                      Un    0      1        0 lo      
fe80::b27f:b9ff:fe83:658f/128               ::                                      Un    0      1        0 lo      
fe80::b27f:b9ff:fe83:6590/128               ::                                      Un    0      3       61 lo      
fe80::b27f:b9ff:fe83:6591/128               ::                                      Un    0      1        0 lo      
fe80::b27f:b9ff:fe83:6591/128               ::                                      Un    0      3       24 lo      
fe80::b27f:b9ff:fe83:659e/128               ::                                      Un    0      1        0 lo      
ff00::/8                                    ::                                      U     256    0        0 eth0    
ff00::/8                                    ::                                      U     256    0        0 vlan1   
ff00::/8                                    ::                                      U     256    0        0 eth1    
ff00::/8                                    ::                                      U     256    0        0 eth2    
ff00::/8                                    ::                                      U     256    2      580 br0     
ff00::/8                                    ::                                      U     256    2       12 vlan2   
::/0                                        ::                                      !n    -1     1      372 lo      

I’ve looked at the ip6tables, and it also appears identical, beyond the counters.

root@Netgear-R7000:~# ip6tables -vnL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
   12  2289 ACCEPT     all      *      *       ::/0                 ::/0                 state RELATED,ESTABLISHED
    5   376 ACCEPT     icmpv6    *      *       ::/0                 ::/0                
    0     0 ACCEPT     all      *      *       fe80::/64            ::/0                
    0     0 ACCEPT     all      br0    *       ::/0                 ::/0                
    0     0 ACCEPT     all      *      *       ::/0                 ::/0                

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 ACCEPT     all      *      *       ::/0                 ::/0                 state RELATED,ESTABLISHED
    0     0 ACCEPT     all      *      vlan2   ::/0                 ::/0                
    0     0 ACCEPT     icmpv6    *      *       ::/0                 ::/0                 ipv6-icmptype 128 limit: avg 2/sec burst 5
    0     0 ACCEPT     all      *      *       ::/0                 ::/0                

Chain OUTPUT (policy ACCEPT 31 packets, 4287 bytes)
 pkts bytes target     prot opt in     out     source               destination         

I’d tried disabling Radvd on the IPv6 configuration gui and adding “enable-ra” to the Additional Dnsmasq Options, but that didn’t fix my problems. The current configuration has matching radv.conf files to the non working version.

root@Netgear-R7000:~# cat /tmp/radvd.conf
interface br0
{
 IgnoreIfMissing on;
 AdvSendAdvert on;
 MinRtrAdvInterval 3;
 MaxRtrAdvInterval 10;
 AdvHomeAgentFlag off;
 AdvManagedFlag off;
 AdvOtherConfigFlag on;
 AdvLinkMTU 1452;
 prefix 2604:4080:1304:8010::/64 
 {
  AdvOnLink on;
  AdvAutonomous on;
  AdvValidLifetime 30;
  AdvPreferredLifetime 20;
 };
 RDNSS 2607:f060:2::1 2607:f060:2:1::1{};
};

I spent a lot of time reading up on IPv6 and reminding myself of things I’d known in the past and forgotten. https://blog.dorianbolivar.com/2018/09/going-full-ipv6-with-dd-wrt.html?lr=1 is a well written post with links to more sources that I found especially helpful as it was written specifically using DD-WRT and IPv6. My only issue is that it was written nearly four years ago and may not have the same options in the DD-WRT gui as are currently available.

One of the items I added to the Additional Dnsmasq Options was a couple of host entries so that dnsmasq would resolve IPv6 addresses for my windows machines. It seems to speed up the IPv6 name discovery of my windows server while still pointing default DNS resolution at the router.

host-record entries

My conclusion is that I don’t understand what was different in the non-functioning setup I had with holdovers from the older version of DD-WRT, and going through the pain of re-installing from factory fresh configuration after each upgrade is worth the trouble. I’m still not satisfied with the best way of retrieving all of the configuration data into a text file that I can later run a difference test to see what’s changed, or needs to be changed.