Walt Stoneburner's Ramblings

Currating Chaos

PlayDate imageLoad() Issue

 •  • playdate, lua

Using Panic's PlayDate Simulator Version 2.3.1 (165008) and Nova v11.8 (Build 573039) on a macOS Sonoma 14.2.1 (23C71), following the Inside PlayDate v2.3.1 SDK documentation, Section 6.16 Display for playdate.display.loadImage(), with this source:

1
playdate.display.loadImage("images/foobar")

I get this error message:

1
2
3
4
main.lua:31: loaded file properties don't match framebuffer's
stack traceback:
[C]: in field 'loadImage'
main.lua:31: in function <main.lua:24>

Panic recognizes it is a known bug introduced in May 2021 while trying to make font stoarage more efficient.

Solution

An ugly work around -- don't do this -- is to pad the image out to 416x240 pixels.

The correct workaround, and possibly long term fix, is:

1
playdate.graphics.image.new("images/foobar"):draw(0,0)

The images is loaded with image.new as a Lua object, and the draw method is invoked with the upper left screen coordinates.

Unfortunately, this isn't as fast as decompressing the image right into the framebuffer.

Panic's PlayDate handheld gaming console

Listing User Logins

 •  • linux

There's a helpful little comand called last that will show the historical logins of your Linux system's users.

Turns out, there's some additional flags you can add that will make it show a lot nicer output:

last -a -F -w -x

This has the advantage of showing if you have different ways of accesing the system, like mosh, this is called out as well.

Additionally, there's another command that's useful called lastlog that shows each user on your system and the last time that account has authenticated (if they have at all).

lastlog

iOS Deleting Undeleteable Photos

 •  • solved, iOS, Phone, iPhone, Photos

For years I've had a problem with Apple's OS X iPhoto and macOS Photos.

At one point, I had imported my photos but didn't indicate I wanted them deleted after the fact, a choice that takes a safety-first stance.

However, this left me in a weird state. Apple would not Import those photos again to the same library because they already existed, and as such they could not be deleted on import. The Photos app provides little in the way of managing your devices.

For whatever reason, even the Photo app on iOS itself would refuse to delete the images. In fact, I could select them, delete them, the thumbnail would disappear, but then when I flipped to another app (or another view within Photos), when I came back the files were there.

An aside for an unsolved problem that a reader may have the answer to: I can do a Select All on the phone with a small number of photos are presented, but I can't figure out how to do it all the time when there's a large number (several thousand while looking at my library, not an album), although I can select and drag ...but with that many it can take minutes to select everything. Anyhow know how to do a Select All of the photos on iOS? Please write me.

As for the delete operation. It wasn't that they ended up in the trash and needed manual deletion or a 30 day wait. It simply didn't work. Sometimes nothing would happen, sometimes the icons would disappear, although refreshing the view they'd all come back.

It's worth noting, I don't sync my photos to iCloud, so they're not reappeaing that way either.

To recap, the only thing on my phone at this point in the problem are the already backed up photos that I want deleted, they are local to the device but they won't go away and I'm not factory resetting.

SOLVED

Connect the phone to the desktop via USB and use the Image Capture software. At the time of this writing, I'm using macOS Monterey v12.6.

When you select your iPhone, you'll get a list of images. Here's where things get weird — likely a bug in Apple's UI Framework.

If you select all the photos with Command-A (which happens instantly), and in my case I had about 8,300+, and delete them, Image Capture will show you them being deleted, but if you exit and get back in, they'll be back.

If, however, you select and delete them 400 – 500 hundred at a time, then the deletion seems to stick. This requires selecting and using Shift-Click with the mouse. The good news is the less photos you have in your library, the faster the deletion operation happens.

It's almost as if the UI will let you select as many as you want, but the code that traverses a sequence of selected items within a collection of things can only process less than a thousand. Any more than that and it fails the operation but still removes the item from the list.

Unable to Restore from Rescuezilla (LVM)

 •  • rescuezilla, howto

I ran into a problem using Rescuezilla when trying to restore a succesful clone image back on top of the drive it came from (using v2.3.1).

The error I got was "failed to shutdown Logical Volume Manager (LVM)" with the only additional qualification that umount had an error. Why or what to do next wasn't addressed.

In looking at a forum thread on the matter, it suggested that perhaps this error message wasn't correct due to a bug in Filezilla (though I was using a version beyond the one specificed with the known problem).

It wasn't clear how to 'shutdown the LVM' myself, or what that actually meant. LVM stands for Logical Volume Manager, which can pool devices, make resizable volumes, handle data encryption, taking snapshots, etc.

Here was my solution that worked for me.

What I suspect is going on is that the destination is actually a logical volume exposed by LVM, and so this management process is still likely happening at the time you're trying to do a restore.

Using GParted, repartition the destination drive, leaving the device unformatted, and then do the clone to restore.

Part of me twitches, because this is indeed a destructive operation (then again, so is doing a restore); the hope being if a restore won't start, you at least have the old contents around. Not by this method you won't. Unless you take an additional backup of the data you're about to stomp on.

pfSense Host Overrides are Not Resolving

 •  • solved, pfSense, firewall, dns

I use pfSense for a firewall, and more recently pfSense+ simply because that's what came on the new Netgate 5100.

pfSense also provides several DNS options: DNS Resolver (unbound), bind, and DNS Forwarder. I use the DNS Resolver.

One of the cool features is Host Overrides. This allows one to get pfSense to give back DNS responses that override the typical DNS response; that could be to block certain services, set up testing domains and hosts, or provide local DNS resolution for machines you don't want publically resolved.

For me, a few years ago this stopped working, and I sat on the problem until I had some significant time to dig into it. The full details are on Netgate's forum. This is worth the read if you are facing similar problems and wish to troubleshoot.

The symptoms were that dig and nslookup commands were working just fine for external hosts, but when I tried to look up any of my Host Overrides, I didn't get back an answer (instead, I got missing host or missing domain).

I had a Transparent Zone Type, DNSSEC enabled, and Forwarding Mode enabled (and being disabled didn't help either). Turns out, none of this mattered. Tests with the DNS Resolution Behavior to even ignore remote DNS servers didn't change the symptoms. Nothing on pfSense seemed to explain it, not ACLs, not other resolvers, not pfblocker, not other packages.

Even weirder was if I used ssh to get onto the pfSense box itself, doing the same DNS lookups there caused it to properly honor the Host Overrides. It was acting as if pfSense was ignoring Host Overrides for downstream devices. Acting, it turns out, was the key word.

The solution started to sort itself out when using pfSense's Diagnostic / Packet Capture against port 53. When I'd do digs against my Host Overrides, I'd see no traffic! When I'd do a dig against google, I'd see a response ...but not for google!

Something was performing DNS Over HTTPS. Several somethings, actually. Firewalla Gold was configured to do it, as were my browser settings; all for security reasons.

When DNS Over HTTPS is turned on, the DNS request is forward via HTTPS outside the network, where it's resolve externally — and not at pfSense's DNS Resolver, hence why the Host Override wasn't working and why there was no port traffic to pfSense's DNS.

The Solution was to simply turn off DNS Over HTTPS, and suddenly the DNS requests went to pfSense's Resolver, which happily answered the Host Overrides, and all was well.

The better approach appears to be DNS Over TLS and to let pfSense do it, not an upstream device.

Netgate SG-4860 Bricked

 •  • solved, pfSense, firewall, netgate

This afternoon while updating my Netgate SG-4860 pfSense firewall from version 2.5.2 to 2.6.0, a process that's seamless and takes mere moments to upgrade and reboot, the GUI web console reported that the firewall was not coming back from its soft reboot.

When I went to check on the firewall, it was off. That was highly unusual.

When I unplugged it and plugged it back in, the status light turned red, the web interface wouldn't load, and the device powered itself back off. I couldn't ssh nor ping the device.

At that point, I went to the USB serial console to figure out what was happening. Details of how to do this are readily available at Netgate's Website.

Typically, one grabs a Mini-USB to USB-A cable, be sure to get a real cable (it has a thick cord) and not one for charging devices (it has a thin cord), and a USB Bridge to UART driver. Here are several:

Some of the newer Netgate modles have UARTs that require the full UART capabilities. On a side note, many of these drivers take an unusually long time to install (so much so, you'll think they've hung) on Apple or Microsoft systems. Most modern Linux kernels come with a driver already, so nothing need be installed on that platform unless you are using a much older kernel.

At that point, when a powered up Netgate device is connected to your computer via the USB cable, a device called /dev/cu.SLAB_USBtoUART or /dev/cu.usbserial will appear. (The "cu" means "calling unit", such as the old days of connecting to a phone modem.) You'll want to connect to the serial port with the settings of N,8,1 and a default baudrate of 115200, using no hardware handshakes (RTS/CTS), nor software flow control (^S/^Q). While you could use minicom, it turns out that you can also use screen and specify the baudrate:

$ screen /dev/cu.usbserial 115200

You may have to press enter to wake the pfSense terminal console. And, if you're using screen Control-A d will disconnect.

In my case, I got nothing. No text console. The device was dead.

In reality, the device was bricked.

This reddit thread by pfn0nsense outlines the problem perfectly:

I have a SG-4860 that has been running great for 3+ years, but has recently turned into a brick. The status light is solid red on power up, but eventually just turns off. I am unable to see any output via the USB console port. As far as I can tell this happened out of the blue, not during a reboot or any sort of update or power cycle.

And, ProperToday8 had an answer no one likes to hear -- it's an honest-to-God known hardware problem.

You have fallen victim to the Intel Atom C2000 SoC flaw. Google it.

The Intel Atom C2000 bug has been killing products from a variety of different manufactures, at least since 2017.

Cisco explains it in a support advisory entitles Clock Signal Component Issue.

In some units, we have seen the clock signal component degrade over time. Although the Cisco products with this component are currently performing normally, we expect product failures to increase over the years, beginning after the unit has been in operation for approximately 18 months. Once the component has failed, the system will stop functioning, will not boot, and is not recoverable. This component is also used by other companies.

Other folks have been reporting it:

Netgate, aware of the issue, commits to repairing or replacing the unit if you're still under warranty. If you're not under warranty, you could be looking at a replacement cost upwards of $500 including a $75 diagnostic fee.

More than likely if you are leaning in that direction by being out of warranty, you might as well purchase a new unit. If you reach out to them, they may comp you an extra year on the replacement unit.

For those that are curious, I did try factory reseting the device, downloading the original firmware and attempting to install it via USB stick, but alas -- the device can't read its boot ROM to get that far.

So the "solution" is to decomission the device, plan on it never coming back, and replacing it with a newer, faster, better model. Netgate has many appliances.
pfSense recommends some too.

Should some brilliant electrical engineer out there happen to know how to take a screw driver and a soldering iron to the unit and correct the problem with some replacement component, please reach out to me. I don't intend on disposing the unit for a while. Extra bonus points if the unit can be repurposed to a general computer or the parts salvaged.

Strange Preference Files

 •  • MacOS

Ran into a mystery today. Inside my ~/Library/Preferences directory were two files that had short names, unidentifable, cryptic names that contained obscure Unicode.

$ cd ~/Library/Preferences
$ ls -l | tail -n 2  This shows two strange files
-rw-rw-r--@  1 root  admin     240 Oct 13  2020 …hgdlkf
-rw-rw-r--@  1 wls   staff     240 Dec 19  2020 …^?fiilh

When doing a search, this article seems to indicate that the hdglkf file was MAMP PRO's doing. I certainly hope that is not the case, I love those folks.

The files are 240 bytes each, containing binary. Maybe it's a license or some piece of saved state... but it certainly isn't following the Apple filenaming conventions for this directory.

A little closer inspection shows the filenames are really mangled. This is not discorruption, it's obfucation.

$ ls -1 *dlk* *iilh | od -a -t x1

Binary Characters in the Filenames

 .   .   .  h   g   d   l   k   f   .   .      
e2  80  a6  68  67  64  6c  6b  66  c2  a0

 .   .   .  del f   i   i   l   h
e2  80  a6  7f  66  69  69  6c  68

The Unicode e2 80 a6 (U+2026) is the HORIZONTAL ELLIPSIS. The Unicode c2 a0 (U+00A0) is the NO-BREAK SPACE.

The Finder has a problem showing these files.

With GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18), the only way I can even type these files is with wildcarding like this:

$ ls -l@e *hgdlkf* *fiilh

Due to trailing Unicode, this won't catch the first:

$ ls -1 *hgdlkf  # Remember, there's a hidden no-break space

The com.apple.FinderInfo 32, which appears in the directory listing makes the file(s) not visible from Finder. One fixes that with:

$ xattr -d com.apple.FinderInfo *fiilh

For now I've moved both files to a holding file outside of Preferences to assess the fall out.

For what it's worth, MAMP PRO still seems to start, acknowledge I'm registered, and shows all my resources.

Apple's Pages: Layout Break

 •  • Pages, Apple, solved

Let's say you're working in Apple's Pages and you really want to create a multi-column section of text inside some other block of text.

In other word processors, you'd insert a section break (without a page break), something with two or more columns, and then again a section break (without a page break). You're aiming for something like this:

Two Columns Embedded in Text using Pages

And while Apple's documentation for Pages implies it's possible, comparing the invisibles to the menu items, you'd find a glaring omission in the application's menu.

Layout Break Does Not Appear in the Meny

In fact, no where in the Pages User Guide for Mac does it tell you how to do that.

Back in the days of iWork, it used to be possible engage in a little dance where you'd insert a section break, twiddle columns, and then delete the part that caused the page break. It was ugly, but it worked. But not in Pages.

Solution

Say you have a column of text. Select a block in the middle of it. Then, making sure you're on the Layout Tab, change the Columns.

Select, Layout, and Columns

The trick is that you have to alter the column count while you have the content selected. If it's not selected, it won't work.

What was that BaseSystem.dmg popup?

 •  • macOS, mystery

Every once in a rare while, for a split second, a dialog box will appear on my Mac saying that it's opening BaseSystem.dmg, and then the dialog automatically vanishes. The system itself is working fine, but there's no explanation of why this happened, what it's doing, or if it's a security risk.

Empirical evidence suggests they appear shortly after doing a system update or security patch, at other times it may appear after a Time Machine backup completes.

Turns out, this file does exist on Apple’s Time Machine volume(s). (Below /0/ may be /1/ on your system.)

/Volumes/YourTimeMachineVolumeName/Backups.backupdb/.RecoverySets/0/com.apple.recovery.boot/BaseSystem.dmg

The .RecoverySets directory contains boot information, EFI, and a lot of kernel material. It has that “if you need to reinstall on a blank system using just a TimeMachine volume alone, you can” feel to it.

You’ll also find it in places like:

/Applications/Install macOS Catalina.app/Contents/SharedSupport/BaseSystem.dmg

If you locate the disk image file, mount it, and look inside …it is indeed all the minimal stuff needed to reinstall the operating system.

Why macOS would need to open and mount this is unclear, perhaps it’s pulling or checking a resource from it. But it doesn’t appear to be a need for concern, other than it’s an annoyance if you’re trying to give a presentation or watch something full screen.

VueJS Hoisting HTML Elements

 •  • solved, VueJS, HTML

When using a VueJS template and trying to inject a component inside of a table, such as a tr, the rendered component is hoisted outside of the parent element.

This problem has bitten me repeatedly, again and again.

You write this:

<table>
    <my-component v-for=...>
</table>

And it renders like this:

<tr>...<tr>
<table>
</table>

In a nutshell, there are DOM Parsing Caveats and elements like table have restrictions on what elements can appear inside them. (FYI: ul, ol, select have this issue as well).

The solution is to use VueJS's is attribute:

<table>
  <tr is="my-component" v-for=...>
</table>

This causes the template parsing to be happy, as table (or even a nested tbody) will be getting a "true" tr element, but its content will be rendered by the named component.


UPDATE: In VueJS 3 the v-is tag now evaluates as a Javascript expression! This means you need to pass it a string, as in <tr v-is="'my-component'">. See workarounds.