Monday, September 7, 2026

[solved] cups stops printing PDF's after update

Suspect CUPS PDF filter issue; all other filetypes print. Could be corruption, deprecation, permissions, who knows. Happened after a system update. Error seems specifically the "cfFilterPDFToPDF" or, sometimes written as "cfFilterpdftopdf", CUPS filter.

CUPS has three filters when printing, and it appears to be the first one, the cfFilterpdftopdf. The other two filters, downstream of "cfFilterpdftopdf" exited with no errors.

tldr

The particular PDF, a rebate offer, was a locked PDF with restrictions not to print. Thus, it did not print, and I assumed other PDF's also did not print.

the usual toolbox

http://localhost:631 CUPS admin page
$ lpinfo -v info on all connected printers
# lpstat -o all print jobs
# cancel -a cancel all print jobs
# systemctl [enable/disable/start/stop/restart] cups.service
# lpadmin -p BrotherZ -E -v usb:/dev/bus/usb/lp0 -m brother_HLL2315.ppd add a printer and name it, eg. "BrotherZ"
# lpadmin -x Brother remove a printer by its installed name, eg. "Brother"
/var/log/cups/error_log CUPS error log location
/usr/share/cups/model/foo.ppd CUPS ppd file location

log error 01

Seems to be a PDF filter error
# tail -n 30 -f /var/log/cups/error_log
Set job-printer-state-message to "cfFilterChain: pdftopdf (PID xxxx) stopped with status 1", current level=ERROR
PID xxxx (/usr/lib/cups/filter/universal) stopped with status 1.
Need to add the new cups-pdf. A full CUPS install is now:
# pacman -S cups, cups-filters, libcupsfilters, cups-pdf

log error 02

After installing the PDF filter above and a "systemctl restart cups.service", we still seem to have a universal filter error, that's possibly permission-related.
# tail -n 30 -f /var/log/cups/error_log
printer-state-message="universal filter failed."
This failure is really generic though. We'd like more info, but didn't get any.

Tuesday, June 9, 2026

power outage catch-22

Throughout my lifetime, unexpected power outages would lead Arch to do a disk check during repowering. Following this, a reboot would lead to a customary level 3 login.

The latest way Linux denies a person access to their own system is via systemd. Unless a person has pre-configured and installed (via mkinitcpio) an elaborate etc/systemd/system/rescue.service and/or etc/systemd/system/emergency.service, systemd locks root and withholds error information. Locked root, minus error information, produces perhaps the worst imaginable Catch-22. Initially, a person believes it's easy to fix. It looks normal:

You are in emergency mode. After logging in, type "journalctl -xb" to view system logs, "systemctl reboot" to reboot, or "exit" to continue bootup.

"No problem", one thinks, "this is an easy fix via the emergency command line in a (VGA) console." Wrong. Because next...

Cannot open access to console, the root account is locked. See sulogin(8) man page for more details
Thus we can't enter commands, unlike typical emergency mode. What is the solution?

The disk must be fsck'd. Trial and error took days until I recalled fsck might be needed.

At the bottom of this post, solutions from Reddit, Archwiki, StackExchange, etc, are given, in case they inform someone else. I found them all to be useless and misleading. All involved chrooting and then, eg mkinitcpio, fstab updates, and even grub reinstallation. Some of these may work if a person can run "fsck" at the emergency command line. But this was never suggested.

some other horrible requirements

A VGA cable, a monitor with a VGA connection, a box/laptop with an unlocked system, and an expendable USB. If no internet connection, a saved arch iso somewhere. You need a VGA cable and monitor if your box doesn't have native HDMI on its graphic card. This is because emergency mode only has initramfs, with a limited set of commands -- it doesn't include HDMI handshaking.

1. setting-up for the unlock

  • Connect the VGA stuff to the locked system, if your system doesn't have native HDMI
  • Power it up and exit into BIOS, typically "F2". Otherwise, F2, pause a second, then F10, pause, F2, F10 etc.
  • Inside BIOS, change the boot order to USB first, and save/apply the change.
  • Exit BIOS, and power down the locked system.

2. create boot USB

  • On an unlocked system (yes you will need that too) download an Arch ISO and verify its checksum. Having an old saved arch ISO avoids the download.
  • Insert a USB stick into the unlocked system, and find its /dev designator.
    $ lsblk
    Let's say this one is /dev/sda, for our purposes here.
  • Wipe the USB file system
    # wipefs --all /dev/sda
  • Burn the ISO onto the bootable USB. Be certain it has completed burning before removing it.
    # dd bs=4M if=[hardpath/isoname.iso] of=/dev/sda conv=fsync oflag=direct status=progress

3. unlocking root

  • insert the install USB in the locked system and power it up
  • once linux loads from the USB, you'll be running a root prompt. You can find the disk designator for the locked disk drive using lsblk, then just fsck it. Let's say ours was sda.
# lsblk
# fsck /dev/sda
[answer "y" to any repair requests]
# exit
  • power-down the locked system and remove the USB
  • power up the locked system
The system should boot normally now. If desired, re-enter BIOS and remove the USB boot option.

partial fixes and related (useless)

linux command appends

Requires accessing the linux kernel load line during GRUB's install. Pick one of the linux kernels in the GRUB menu, and use the "e" key. This brings us to the kernel parameters, which we will need to edit. After adding the suffix (see below), "F10" to load the kernel with the added parameters.

partial fix 01

This stack exchange post provided me with a kernel parameter which successfully got me as far as the emergency access prompt.
SYSTEMD_SULOGIN_FORCE=1 init=/sbin/sulogin
The solution is only partial, because necessary commands to unlock root eg, passwd, mkinitcpio, nano, etc, were not available at this prompt. This emergency prompt was running entirely within initramfs.

At reboot I was right back where I started, at a locked console, unless as noted at top, I had a configured emergency.service already installed into systemd.

creation of emergency.service

helpful, but not a fix

Linuxconfig.org. Setting kernel boot parameters.

nope 1

Kali solution. Well documented kernel parameter addition. GRUB ignores.
single init=/bin/bash

nope 2

Well documented kernel parameter addition. GRUB ignores.
break
# mount -rw /dev/sda1 /mnt
# genfstab -p /mnt >> /mnt/etc/fstab
# arch-chroot /mnt
# passwd
# mkinitcpio -p linux
# grub-mkconfig -o /boot/grub/grub.cfg
# grub-install /dev/sda [no partition]
# exit

Monday, April 20, 2026

home devices and related

One way to view requirements for a network is by functional groups, connections, and security levels.

groups, connections, security/safety

  • guests: LAN parties, family, push devices (weather smart mirror). internet, multiple WAP's, loose firewall, exception reports
  • office active: browsing, file sharing, editing, backup. expandable CAT-5, internet firewalled strongest security and devices limited by physical ID
  • office archive: SSD's or HDD array. No internet or OS. Photos, scans, texts, docs, receipts, tax, possible some cloud
  • media playback: PON or GPON. No internet, OS update server by USB tethered phone. One or two terminals with one server to many displays and speakers.
  • security/safety: blend PON, CAT-6 PoE, possibly CAT-5. No internet, OS update server by USB tethered phone. Device ID only, cams, device logging, dedicated storage and backup.
  • smart home network: No internet, update server by USB tethered phone. CAT-5,6, or PON. Device ID only, some storage, database
  • expansion: possible home business dedicated

For OS, Linux is desirable in all of these, although some gaming devices will obviously not be partial. In all cases, we seek to minimize the the use of WiFi (data security) and internet access. For any outdoor nodes (security cams, sensors), we'd prefer fiber-optic (lightning surge, physical security).

sample vid (sample) sample, 2026.

Monday, March 16, 2026

Motorola PCS XT1541 (Moto G, 3rd Gen) -- usb-c to hdmi TV monitor?

Sitting on a couch, a person occasionally wants to mirror their Android phone to their (larger) TV display. We don't want WiFi, Bluetooth, or any other configuration garbage. We just want to plug the phone into an adapter (which charges our phone), and mirror the phone's screen to the TV while we continue to use the phone. Use our phone, see it on the TV, and the phone charges. Can this be done with an older XT1541 phone?

Not easily. Two main roadblocks:

  • not all phone usb-c ports have physical capacity to transmit video. USB-C 2.0 supposedly cannot. USB-C 3.1/2 supposedly can. The XT1541 unfortunately only has USB 2.0.
  • not all phones with 3.1 USB's have the Display Port (DP) alt-mode firmware to seamlessly screencast via the USB charging port. Motorola phones that had both were manufactured with Motorola's proprietary "Ready For" configuration. Ready For was short-lived, probably only 2017-2022, possibly due to DCMA overreach. Current Motorola phones lock screencasting to WiFi-only Google Chromecast (now "Google Streaming").

XT1541 is a mixed bag

The 2022 XT1541 lies on middle ground. It was produced during Motorola's "Ready For" years, but did not receive a 3.1 USB-C port or the DP alt-mode firmware. It can screencast nevertheless. The options (ethernet, wifi) are found in the settings icon circled below, or as described in this video.

Note the phone's icon displays "Ethernet", which is part of a longer scrolling message, "No Wi-Fi or Ethernet connection". Ethernet can only occur via the USB-C port; can the XT1541's supposedly 'too slow' 480Mbs USB-C 2.0 handle screen mirroring? Easily. HD 1080p video requires 5-10Mbs, nowhere near 480Mbs. The supposed need for a USB-C 3.1 to transmit video is a myth.

Accordingly, we should have both wired (Ethernet) and WiFi screen-sharing solutions for the XT1541.

solutions

  1. WiFi, with or without Google Streaming $80. WiFi dongles such as Miracast or similar, run $40. They screen-mirror via home WiFi like Google Streaming, but don't require internet. Google Streaming requires the home WiFi network be internet-connected in order to screen mirror (creepy).
  2. Wired Ethernet. We'll at least need a USB-C to Ethernet adapter $15. Configuring the Ethernet for the phone mirroring remains unknown as I write this today, but it is the preferred longer term solution.
  3. A third option looks promising but is not workable. The hybrid Nyrius transmitter ($70), connects to the USB-C, however it requires that a phone have the DP alt-mode firmware. The XT1541 lacks Motorola "Ready For" firmware and thus lacks DP alt-mode.

Wired Ethernet is the safest long-term solution. Turn-on one's WiFi router, turn off its WiFi, and route the screen-mirroring through its physical ports.

Ethernet process/configuration

In progress. Configuration setups are currently being tested. WiFi screencasting allows the phone and TV to discover/detect each other as nearby devices, and then pass the video stream through the WiFi router.

But how can the phone and TV detect each other via wired Ethernet? This may require a dedicated app on the phone to detect the TV on the network, might depend on the TV's firmware, or some other. Not yet sure.

Monday, August 25, 2025

more latex table -- footnote tables

Link: https://texfaq.org/FAQ-footintab : explanatory

LaTeX headaches have no end. Footnote text in tables don't appear using \footnote. The footnote number appears where its placed in the table, but *no* number at the bottom of the page, nor its associated text. The text just disappears.

What worked: the footnotehyper package. It saves footnote texts in an environment and emits them at the end. Tabular usage might be...

\begin{savenotes}
\begin{tabular}

The footnotes appear after the enclosed environment ends, in this case after the table.

The simplest setup is supposedly the tablefootnote package. Maybe. Although it properly compiled and assigned a number, no footnote text was generated.

Thursday, August 7, 2025

STT - 2025

My last attempt at STT was in 2022. Limited success. Really could only do it from the mic, not to a file. Recently, I was looking at this blog, and realized there might be some updates that make it possible.

Thursday, July 17, 2025

2025 file issues

Attempting to backup the various media filetypes has become a nightmare, just the way WIPO-friendly attorneys want it. Even in 2025, lawsuits make it tedious AF to produce a format which plays across devices. For audio, Ye Olde MP3 is still king. For video, MP4's now contain so many different codecs that sometimes they will play, other times they do not. Typically an H264 encoding with AAC audio will still go on nearly anything.

First get a list of the installed applications, to see if any apps are necessary.

$ pacman -Qet

sample WEBM with OPUS audio

Suppose a standard download in 720p, no particular audio spec.

$ yt-dlp -S res:720 "https:foo"

So we now have this file "foo.webm", which is in a WEBM container, not an MP4 container, but we only want the audio. First we check it.

$ ffmpeg -i foo.webm
Input #0, matroska,webm, from 'foo.webm':
Metadata:
COMPATIBLE_BRANDS: iso6av01mp41
MAJOR_BRAND : dash
MINOR_VERSION : 0
ENCODER : Lavf61.7.100
Duration: 01:20:00.87, start: 0.000000, bitrate: 910 kb/s
Stream #0:0: Video: av1 (libdav1d) (Main), yuv420p(tv, bt709), 1280x720, SAR 1:1 DAR 16:9, 24 fps, 24 tbr, 1k tbn (default)
Metadata:
HANDLER_NAME : ISO Media file produced by Google Inc.
VENDOR_ID : [0][0][0][0]
DURATION : 01:20:00.834000000
Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
Metadata:
DURATION : 01:20:00.868000000

So the OPUS filetype is the audio. Thus, to avoid re-encoding unintentionally, we should just pull it out as an OPUS file without additional actions.

$ ffmpeg -i foo.webm -vn -acodec copy fooaudio.opus

We'd like to leave it an OPUS, but OPUS won't play on anything rolling. So, let's say 256Kb or 320Kb MP3 should do it. That's re-encode 1. We can use, eg Ocenaudio to edit the OPUS to whatever we need and save it as an MP3. I might want to touch it up further to change the speed with sox, which makes a second encode. I might turn up the volume a touch to make sure it overcomes that. Note the "C" is a capital.

$ sox -v 1.1 fooaudio.mp3 -C 320 fooaudio90.mp3 speed 0.90

Sunday, January 12, 2025

pdftk - some usefulness

Some people like to receive PDF's encrypted, so I had to find a way to do it. I think it's stupid, since it can be cracked anyway, but whatever. It's a PITA. pdftk has some options that helped. Out of the box, Evince stalled attempting to open pdftk encrypted files, whereas an Adobe Acrobat encrypted file would not.

works

The simplest usage seems to do the best. Basically an input, output (if I want to rename), and a password. Opens in Evince and on receivers' Adobe Acrobat.

# pacman -S pdftk
$ pdftk somefile.pdf output renamed.pdf userpw foo
Warning: Using a password on the command line interface can be insecure.
Use the keyword PROMPT to supply a password via standard input instead.

Sunday, September 15, 2024

geany cursor

Geany's cursor is a standard blinking line, however Geany automatically greys the paragraph being edited. Thus, the cursor becomes invisible in the paragraph being edited, ie Geany makes the cursor invisible precisely where it needs to be visible. This leads to repeated errors and inevitably to headaches, hair pulling and shouting. That is to say, to insanity.

I could find no setting in preferences addressing either: un-greying the paragraph being edited or highlighting the cursor. Thus my decades-reliable Geany editor became enigmatic and useless, and I didn't want alternative apps.

app build or app config?

There is a lot of information on cursor configuration, but is it build file configuration or configuration files for a user using the app? The difference is hard to determine, and slows down efforts to do either. In this case, I'm interested only in configuring an already-compiled running application.

solution

After several drinks to calm my nerves, I found this site and then went to /usr/share/geany/filedefs/filetypes.common (or less permanently to ~/.config/geany/geany.conf), to change the cursor, as directed in this post.

To make the cursor into a block, change the third argument (second to last) to "true", instead of "false". A small blinking block of that color -- all "f"'s for black, all "0"'s for white, or any hex color in between will result. Restart geany to experience the change.

# nano filetypes.common
# comment the original
# caret=caret
caret=0xffffff;0x0;false;false"
$ nano geany.conf
no idea

themes

Another avenue, though requires a download, is to change the color setup using themes.

~/.config/geany/colorschemes/

Let's not overlook this, Britain in the 50's, if feeling low about Geany or anything else. And of course, Charlie.

Monday, August 12, 2024

more key nightmares

Links: Arch - package signing

TLDR: in 2024, one's system, gpg keyservers, and Arch repositories all need to be *up*, properly configured, and current, to accomplish a standard Arch pacman Syu. Solutions given in decreasing order of intervention severity.

overview

"Key" conflicts or expiry during pacman updates have become the most consistent annoyance in Arch, (alongside PulseAudio, more Linux-wide). Eg, in 2024, waiting even two weeks between system updates likely will spawn an unrecoverable, unintuitive pacman key failure during pacman -Syu. What is happening?

Pacman used to just check a hash of the application package. NOW, Arch additionally checks hashed signature keys for each application's creator/repository uploader. The shift to increased verification led to use of an additional application: gpg. A further complication -- gpg stores and retrieves keys from a dedicated repository, a "keyserver", which is separate from the application repository. A yet further complication is that gpg deposits the latest keys into user's system, in /etc/pacman.d/gnupg and does not regularly update these.

pacman is still the update manager, but gpg is now a critical adjuvant app, and which must handshake its keys with pacman during each update, yet does not update its keys between pacman updates. Immense time can be lost navigating this setup; this post only has the bandwith to list solutions. Basically, if any pacman key failures, I first attempt to update the keys (pacman-key --refresh-keys) and then I go nuclear. I don't have days to waste.

Solutions in decreasing order intervention severity.


thermo-nuclear

# nano /etc/pacman.conf
# temporary key solution: add SigLevel never and
# comment-out default "Required"
SigLevel = Never
# SigLevel = Required DatabaseOptional

A regular pacman-Syu now works. After update success, and a reboot, we reset /etc/pacman.conf back to default "Required".

We've accomplished the update, but now we find that the problem with keys still exists. That is, we still can't, eg., run pacman-key --populate, without the same error messages and Catch-22 with 'pacman-key --init' that we experienced earlier:

# pacman-key --populate
==> ERROR: There is no secret key available to sign with.
==> Use 'pacman-key --init' to generate a default secret key.
# pacman-key --refresh
gpg: error reading key: No public key

The Catch 22 is that we're driven to run 'pacman-key --init', but 'pacman-key --init' fails 100% of the time, stating we have no public key, LOL. "I can't make what you need since you don't already have it".  In 2024, I don't know a way to circumvent this keys issue without significant time-wasting alternatives. I just give it a key.

# gpg --gen-key --homedir /home/USER/.gnupg --passphrase "PASSWORD" --pinentry-mode loopback
gpg: WARNING: unsafe ownership on homedir '/home/foo/.gnupg'
GnuPG needs to construct a user ID to identify your key.
Real name:

After all of this, we'll get some success message...

gpg: /home/foo/.gnupg/trustdb.gpg: trustdb created
gpg: directory '/home/foo/.gnupg/openpgp-revocs.d' created
gpg: revocation certificate stored as '/home/foo/.gnupg/openpgp-revocs.d/BFA0F3753DA6EA552E08958F06E36EA3F9E270C0.rev'
public and secret key created and signed.
...after which...
# pacman-key --init
# pacman-key --populate

...work normally. Now we can do regular pacman updates with regular keyring checks. We have to repeat the laborious process however, typically when it's been a few weeks or longer between updates.

nuclear

stackexchange wisdom
# gpgconf --kill gpg-agent
# rm -r /etc/pacman.d/gnupg
# rm -r /root/.gnupg
# rm -r /home/foo/.gnupg
# rm -r /etc/pacman.d/gnupg
# rm -r /root/.gnupg
...after which
# pacman-key --init

light cure

A typical usual cure...

# pacman -Sy archlinux-keyring -
...after which try the stronger
# pacman-key --refresh-keys

catch-22 circular fail

Notice 100% gpg reliance.

# pacman-key --populate
gpg: problem with fast path key listing: No such file or directory - ignored
==> ERROR: There is no secret key available to sign with.
==> Use 'pacman-key --init' to generate a default secret key.
# pacman-key --init
gpg: problem with fast path key listing: No such file or directory - ignored
==> Generating pacman master key. This may take some time.
gpg: Generating pacman keyring master key...
gpg: agent_genkey failed: No such file or directory
gpg: key generation failed: No such file or directory
gpg: Done
==> Updating trust database...
gpg: no need for a trustdb check

directly into gpg: gpgconf

# gpgconf --list-components
gpg:OpenPGP:/usr/bin/gpg
gpgsm:S/MIME:/usr/bin/gpgsm
keyboxd:Public Keys:/usr/lib/gnupg/keyboxd
gpg-agent:Private Keys:/usr/bin/gpg-agent
scdaemon:Smartcards:/usr/lib/gnupg/scdaemon
tpm2daemon:TPM:/usr/lib/gnupg/tpm2daemon
dirmngr:Network:/usr/bin/dirmngr
pinentry:Passphrase Entry:/usr/bin/pinentry
# gpgconf --kill gpg-agent

Friday, June 28, 2024

audio -- DisplayPort

This a post for people who have a DisplayPort connection with functional video, but non-functioning audio from a connected monitor. The situation can be hardware or configuration, or a blend.

short overview

DisplayPort is HDMI quality video, a significant step-up from VGA, but without an audio channel. The output jack is a special shape, so we need an inexpensive adapter cable DisplayPort <--> HDMI. We then connect the HDMI end to any monitor's HDMI port.

DisplayPort does not have an audio channel. So we have to run sound separately using a 3.5mm output cable to connect sound to our monitor. However, even with a separate 3.5mm audio cable plugged in, users can experience the same "no audio" problems they do with an HDMI cable.

I've done other posts on HDMI cable ELD handshake for HDMI audio, and the steps are the same with DisplayPort. I'm repeating the steps here in a dedicated DisplayPort post, since it might be easier to Google search for those suffering through DisplayPort configuration.


helpful commands

Before anything else, a few helpful commands to hopefully avoid rebooting once configured. PulseAudio is killed and restarted with...

$ pulseaudio -k or --kill
$ pulseaudio -D

ALSA usually will reread alsa.conf and restart without a reboot:

# systemctl restart alsa-restore.service

most likely explanation - monitor limitation

Some monitors can't detect true HDMI apart from DisplayPort, since the cable connection is HDMI on the monitor end. The monitor assumes audio is incoming via the HDMI cable per usual. These types of monitors disable the 3.5mm audio input to prevent duplication. There's no way to achieve monitor sound in this circumstance. Users must test their computer's 3.5mm audio output with a set of speakers.

However, the scenario above is horribly underdocumented. Many people go crazy attempting to make the monitor produce sound from the connected 3.5mm input. Even more deceptively, these monitors usually have no 3.5mm audio problems as long as the video input is a VGA cable.

less likely -- ELD problems

Once we obtain ELD-related numbers, my easiest solution for ensuring ELD handshake is via /usr/share/alsa/alsa.conf customization. Updates to ALSA will overwrite our customization, but we can always repeat the steps if we encounter audio problems again.

I like info on how the computer is naming cards and so on, in case I have a long troubleshoot, but the most important step is using grep to verify ELD. Skip to that step below if desired.

Verify DisplayPort is connected to the HDMI port on the video monitor and receiving video. Next, how is the system ordering its analog PCH chip and HDMI digital chip? Simplest check:

$ cat /proc/asound/modules
0 snd_hda_intel
1 snd_hda_intel

... but in this case, we need more. We're only able to tell both chip 0 and 1 were manufactured by intel. So we...

$ cat /proc/asound/cards
0 [HDMI ]: HDA-Intel - HDA Intel HDMI
HDA Intel HDMI at 0xf7c32000 irq 39
1 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0xf7c30000 irq 40

...ok the digital card is card 0 and the analog is card 1.

But we still don't which device on the card has handshaked. For that, aplay goes deeper and gives each device number on the cards.

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA Intel HDMI], device 3: HDMI 0 [E622VLE]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: HDMI [HDA Intel HDMI], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 0: ALC3220 Analog [ALC3220 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0

But I prefer to verify ELD is handshaking with device 3.

$ grep eld_valid /proc/asound/card0/eld*
/proc/asound/card0/eld#0.0:eld_valid 0
/proc/asound/card0/eld#0.1:eld_valid 0
/proc/asound/card0/eld#0.2:eld_valid 0
/proc/asound/card0/eld#0.3:eld_valid 1
/proc/asound/card0/eld#0.4:eld_valid 0
/proc/asound/card0/eld#0.5:eld_valid 0

With hw 0,3 confirmed, I carve this in stone in my /usr/share/alsa/alsa.conf file.

# nano /usr/share/alsa/alsa.conf
defaults.pcm.subdevice 3 # -1 is default

step 2 - restart and test

The easiest for me is to reboot, but others may want to restart alsa. Am I getting sound? If so, then I should also be able to normally test the connection this way.

$ aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav

There are other sounds, I just use Front_Center out of habit I suppose

Monday, June 10, 2024

Inexpensive appliances

GE Hotpoint RGB526DETBB black oven

2013 manf -- approx $600 :: 2025 replace -- $1,200

Two similar models exist; RGB526 and JGBS30. It appears these were first manufactured in 2013, and were likely c. $600. In 2024 dollars, that's about $800. However, to *replace* the oven in 2024, with a similar feature stove/oven, would run $1,100 easily. Probably more. It's worthy of maintaining the original, if possible.

quirks

Important maintenance and repair documents are printed on paper and placed in an envelope attached to rear of appliance. This includes wiring diagram for igniter

This site has spec and user manual PDF's.


Forty-six inches high and not self-cleaning. The igniter is the rectangular Norton igniter. The thermostat must not touch the oven wall. Note this after cleaning. Also any flame adjustments.

gas connection $150

Expensive because best accomplished by a plumber to avoid house fire. Current code requires that the flex hose be orange, like the old LP lines.

cleaning

If a person has time, the easiest way is baking soda, overnight wait and remove with a spatula. Video:

baking soda and vinegar (8:28) Mr Gizmo, 2021. spray bottle for white vinegar (possibly dilute), non-scratch spatula, non-scratch rags, rubber gloves, baking soda paste. Overnight wait, follow-on with vinegar spray (activate and remove residue), wipe down with non-scratch rags.

Located here:

Also note that the oven door is removeable (more easily than it can be re-attached) to help the cleaning.

This post contains some additional tips and products.

exhausting the fumes

Electrolux/Frigidaire FFTR1814LW4
18 cu ft, top freezer


Links: manf's page :: commercial page w/specs :: parts site

2010 manf -- approx $? :: 2025 replace -- $750

quirks

lower door handle breaks, $70 part. Reinforce it somehow out of the box.

Friday, May 24, 2024

real webdev

Honestly, we're needing to look at groupings of information knowledge. It's not just masters in statistics and math and database development, it's connecting these to an interface (web, phone), and then securing them.

We can also look at our own life in terms of a database, the way various government agencies probably do. If we view ourselves and other citizens as entities, attributes, and relationships. In the case of events or incidents, each one one of these might be an entity, eg a car accident, which is a singular event.

formal

Masters in statistics, math, computer science, just to get into other classes.

Is discrete math the intersection of statistics and maths?

database

terminologies, relational, normalization,

database normalization (28:34) Decomplexify, 2022. simple examples and repairs on 1-5nf in RDBMS. columns (attributes), rows (entities). Design normalization can protect against things that cannot be logically true like two dates of birth. Eliminates data that disagrees with itself, and as a side benefit, redundant data.10:20 2nf deletion, update & insertion anomalies. 3nf 17:30 transitive dependency. 19:00 golden rule of boyce-codd.
relational terminology (8:48)Neso Academy, 2022. terminlogy for RDBMS.

sets of information

cobol, php (and whatever replaces it -- can it be done with python?)

Monday, March 25, 2024

color correction video

Most videos need some sort of color correction. Not even sure why. The two main ffmpeg filters are colorbalance and colorchannelmixer.

Don't forget the basic splitting and recombining commands.

colorbalance

The easiest. 9 inputs, no alpha. 3 for each color (RGB). Within each color are (similar to GiMP) shadows, midtones, highlights. So... not too bad. The opposite of Red is Cyan, opposite Green is Magenta, and opposite Blue is Yellow. You can call a thing directly, but I always do all 9.

Zero does nothing. So any of these would do nothing. I like to be in the habit of using quotes, since quotes are used with multiple filters.

$ ffmpeg -i foo.mp4 -vf colorbalance=0:0:0:0:0:0:0:0:0 unchanged.mp4

$ ffmpeg -i foo.mp4 -vf "colorbalance=0:0:0:0:0:0:0:0:0" unchanged.mp4

$ ffmpeg -i foo.mp4 -filter_complex "colorbalance=0:0:0:0:0:0:0:0:0" unchanged.mp4

$ ffmpeg -i foo.mp4 -vf colorbalance=rs=0 unchanged.mp4

The last one illustrates what's in each of the 9 positions. We can call them by RGB name or position... rs:gs:bs:rm:gm:bm:rh:gh:bh: or positions 1-9. A common one on crappy online downloads is blown out red and blue which requires both a color correction call and a saturation call.

process

The settings are very sensitive, typically a person will make changes less than 0.1. Take a screenshot from the video, open GiMP and correct it till you get it right in GiMP, then just mimic the settings in colorbalance.

A typical, fairly strong, correction might be...

$ ffmpeg -i foo.mp4 -vf colorbalance=0:0:0:-.1:0:-.1:0:0:0 rednblue.mp4

....or even less...

$ ffmpeg -i foo.mp4 -vf colorbalance=0:0:0:-0.05:0:0:0:0:0 redmild.mp4

I could have done this last one with...

$ ffmpeg -i foo.mp4 -vf colorbalance=rm=-0.05 redmild.mp4

time-saving

GiMP with a screenshot. Otherwise, start with reds, go to blues, then greens. Getting the reds correct is key, then blues to give a little yellow, and then finally will need to remove some green

gamma

About the time the colors are right, it might be too dark. That's common. I lighten it back up.

$ ffmpeg -i foo.mp4 -vf "colorbalance=-0.03:-0.05:-0.1:-0.05:-0.05:-0.1:0:0:0","eq=gamma=1.2:saturation=0.9" correct.mp4

Once I had a very minimal one...

$ ffmpeg -i foo.mp4 -vf "colorbalance=0:0:-0.03:0:0:-0.05:0:0:0","eq=gamma=1.2:saturation=0.9" correct.mp4

Tuesday, January 30, 2024

2017 Latitude 3379 I5-6200U install

Part 1 basic install: working CLI

1. overview standard install, except touchscreen configuration
2. modify bios OS loads into device from USB. BIOS will not allow that unless UEFI disabled and legacy ROM enabled. Reactivate UEFI after installation, if desired.
3. prep disk UEFI and GPT clearing. Used MBR to avoid GRUB errors.
4. installation various basic configurations

customize: /etc/systemd/system/rc-local.service

Part 2 GUI and tweaks

5. X86 installtweaks to processor specific, other configuration, icewm
6. touchscreenspecial software and configuration

customize: ~/.xprofile, ~/.xinitrc, ~/.icewm/startup


A person likes to have a touchscreen with their music library near the bed: the SO can select whatever music she's looking for.

These old 2-in-1, 2.3GHz i5's will do the trick. Can be found for about $125 (2024) online or about $160 delivered. A person *might* want to upgrade the basic 8Gb DDR4 2133MHz SDRAM (60 pin) to 32Gb, and 128Gb Liteon CV3-8D128-11 (SATA 1) to a Liteon CV3-8D512-11 (SATA 1). The 512Gb M2 ($70) and 32GB RAM ($60) would make the system fully configured for a $300 total. But this isn't necessary to play the movies and music our SO wants to select with her fingertips. $160 does the trick. Put the library on the hard drive and run a 3.5mm connector to a decent speaker system. She might complain, but it's better than nothing.

If a person just wants to do earbuds in bed, the inexpensive Mijiaer/Langsdom JM26 3.5mm earbuds are comfortable, and also good for a hands-free in a vehicle if cut-off one bud.

Touchscreen is an ELAN 283.2mm x 176mm.

1. nothing special... except

The install mostly is the same as a 2020 install into a non-touchscreen Latitude e7270. There are some package updates since that time, and touchscreen-specific packages. I shifted to the XFS file system from EXT2, learned how to add XFS partition labels, but the swap partition remained the annoying UUID. I used a USB tethered phone for the install -- no internet/dhcpcd issues.

The touchscreen. First touchscreen install is time-consuming for enabling right and double click. Ie, kernel recognizes finger touches "out of the box" --using xf86-input-evdev -- but didn't translate these into application functions. The only reasonable answer appeared to be Touchégg to configure touchscreen effects.

2. bios security adjustments :: 15 mins

To install from the USB, we have to disable UEFI and make the device friendly to an inserted USB.

  1. Enter BIOS
  2. Secure Boot -> Secure Boot Enable: Disable, Apply
  3. Security -> PTT (Platform Trust Technology) Security: Uncheck "PTT On", Apply
    NB: No need to check "Clear", but if a person does check it, the warning: "Data encrypted with keys stored in the TPM will be lost. Are you sure you want to clear all keys from the TPM?" I don't know if it's good/irrelevant to delete these keys.
  4. General -> Advanced Boot Options: check "Enable Legacy Option ROMS". I also uncheck "Enable UEFI Network Stack" in case it causes Network over-security issues, even beyond PAM and other ridiculous 'safety' issues.
  5. General -> Boot Sequence: check "Legacy"

After all this, the boot order menu becomes available. Users can then promote "USB" to the top of the menu, and install the OS from the USB. I put the M2 SATA SSD second so that after install, I can remove the USB and it will boot from the SSD.

3. GRUB/disk prep :: 15 mins

Currently (2024) GRUB still seems finnicky when using a GPT ("globally unique identifier partition table") disk. So, in addition to eliminating EFI, I convert all GPT to MBR. This requires three applications: cfdisk (delete all partions), gdisk (to detect GPT and revert to MBR) and fdisk ("fdisk -t" to create an MBR. 0x04.)
  1. # fdisk -l determine the drive name, eg /dev/nvme1
  2. # cfdisk /dev/sda, delete all partitions, which eliminates EFI. Write this partitionless drive and exit
  3. # gdisk /dev/sda note whether GPT is present and MBR protected. Mine notes both and that "using GPT". I selected "x" for "expert command", then "z" to zap the entire GPT structure, which was confirmed. Then it asked if I want to "Blank out MBR"?, to which I replied "yes". When i then retried # gdisk /dev/sda, all (MBR, BSD, APM, and GPT) were not present. This is correct, but "x,z,y" again to be sure.
  4. # cfdisk /dev/sda, select DOS label, and proceed. The main is a linux (83) sda1 and a linux swap (82) sda2,

The only real question is whether to make multiple partitions for different parts of the OS. For this example, I've put them all in a single partition.

4. base CLI (runlevel 2) configuration :: 20 mins

# mkswap /dev/sda1
# swapon /dev/sda1
# free -m [check swap is on]
# mkfs.xfs /dev/sda1
# xfs_admin -L "labelname" /dev/sda1 [optional]
# mount -rw -t xfs /dev/sda1 /mnt
# mkdir /mnt/etc
# genfstab -p /mnt >> /mnt/etc/fstab
# pacstrap /mnt base base-devel linux linux-firmware
# arch-chroot /mnt
# ln -s /usr/share/zoneinfo/US/[zone] /etc/localtime
# mkinitcpio -p linux
# passwd
# pacman -Syu grub dhcpcd xf86-input-evdev
# mkdir /boot/grub
# grub-mkconfig -o /boot/grub/grub.cfg
# grub-install /dev/sda [no partition]
# exit
# reboot

if oversights or mistakes

Let's say I forget to # pacman dhcpcd after pacstrap, and now I'm booting straight off the drive. It's extremely difficult to setup even a wired connection, let alone WiFi with just the tools in # So go back to arch-chroot and install from there.
# mount -rw -t xfs /dev/sda1 /mnt
# arch-chroot /mnt
# pacman -Syu dhcpcd wireless-tools ntp nano xf86-input-evdev [this last for the touchscreen]
# exit
# reboot
Similarly, you want to pull window manager menus and so on prior to starting X the first time...
$ mkdir media
# mount -rw -t ext2 /dev/sda1 /media
$ cd media
[do whatever operations]
# umount /dev/sda1

locale :: 0 mins

I don't set a locale, but here's some information if interested.

useradd :: 5 mins

User 500, name "foo", home directory of "foo", using bash shell.
# useradd -G wheel,lp,audio -u 500 -s /bin/bash -m foo

aur access - yay :: 20 mins/200Mb of other files

AUR access was simple during the yaourt years, but the archlinuxfr repo isn't around since 2023. The best now is yay, albeit built on the 300Mb slug "go" dependency.

To build and install they do it through fakeroot, which ejects if sudoers is not configured.

# nano /etc/sudoers
foo ALL=(ALL) ALL

Then retrieve, compile, and install

# pacman -S git go wget
$ git clone https://aur.archlinux.org/yay.git
$ cd yay
$ makepkg -si
$ yay --version [verifies installed OK]

limit journalctl size :: 5 mins

Systemd will log GB's and GB's of data if left unresetricted.
# nano /etc/systemd/journald.conf
SystemMaxUse=200K

5. X install :: 20 mins

Dells have Intel integrated graphics 945GM; the correct xf86 driver is the Intel VA driver.

# pacman -S xf86-video-intel
This driver now uses DRI3 as the default Direct Rendering
Infrastructure. You can try falling back to DRI2 if you run
into trouble. To do so, save a file with the following
content as /etc/X11/xorg.conf.d/20-intel.conf :
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "DRI" "2" # DRI3 is now default
#Option "AccelMethod" "sna" # default
#Option "AccelMethod" "uxa" # fallback
EndSection
# pacman -S xorg-server xorg-apps xorg-xinit xorg-xrandr
If you scroll down this Arch page discussing Xorg, we can see that we'll want the mesa for Open GL and lib32-mesa for older apps. Also, Intel chips, as we know (scroll down to about item 13), do not support VDPAU, viz:
"Intel Embedded Graphics Drivers do not support VDPAU. VDPAU stands for video decode and presentation API for UNIX*. VDPAU is an open source library and API originally designed by NVIDIA that provides an interface to support hardware-accelerated video decode."
... and so Intel sez libVA is correct. More specific to Arch, there's additional information in their video acceleration page, if you like to read. The only problem with the VA-API is it can't decode MP4 and FLASH containers, but it does all other common formats, and all codecs, including H264 and the new VP8 and 9. I just use MKV and AVI containers and set the VLC codec to VA (instead of its default VDPAU). In spite of inefficiencies on the Intel hardware, some may wish to overlay VDPAU functionality onto their Intel chip, which is an installation beyond this post. If a person does that, any mistakes will defeat X working properly -- no harm, just revert to runlevel 2 and reconfigure until Xorg is working well. FYI, one of the tweaks I've seen for VIDPAU overlaid onto VA, is adding "export VDPAU_DRIVER=r600"in one's ~/.xinitrc file. Anyway, back to pure libVA...
# pacman -S libva libva-intel-driver libva-utils libva-mesa-driver
... then check the install with "$ vainfo".

window manager :: 10 mins

On an old system, I don't waste memory with display managers, instead I login and "startx" from runlevel 2. I like Ice Window Manager, a light interface with simple text configuration, wallpaper, and menu files (look inside ~/.icewm ). Efficient on older systems: perhaps 150M usage after logging-in, connecting to network, and starting X. In Arch, the template files are inside /usr/share/icewm/, including the themes. See the main Arch file.
# pacman -S icewm
$ cp /etc/X11/xinit/xinitrc .xinitrc
$ nano .xinitrc
exec dbus-launch icewm-session
$ startx
I also looked here to get the names of additional drivers, for example to solve the pesky touchpad problem. I couldn't stop the Dell touchpad with synclient TouchPadOff=1 until I # pacman -S xf86-input-synaptics.

QT or Gtk

I used to stick with one or the other to keep a smaller install and shorter update. Nowadays both seem necessary. I prefer GTK (except gvfs), but VLC requires QT. QT is about 400MB, and typically pulls in PyQT, whereas GTK3 is a slick 100MB. But since I'm a fan of VLC ... QT became my baseline API.
# pacman -S qt4
However, you're going to see that udiskie (to avoid gvfs) brings in about 80MB of shit, including basic Gtk.

sound

I avoid PulseAudio as much as I can. See my post from 2016. ALSA is now built-in, so that all that's required is alsamixer in order to control the sound levels (unmute, etc)
# pacman -S alsa-utils
Done.

rc.local

A consolidated place for random startup shit too lazy to configure individually. It's like an initrc in X, but for runlevel 3.
# nano /etc/rc.local
#!/bin/bash
wpa_supplicant etc
dhcpd etc
exit 0
# systemctl enable rc-local.service should make it happen next boot, but you also have to create the service file before enabling it.
# nano /etc/systemd/system/rc-local.service

# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

6. touchscreen issues

This is really the crux of it. I'd never had a touchscreen and it looked like some of it was system dependent, and with mutual solutions.

When the keyboard is still flipped-out, Shift + F10 emulates R click on mouse. Of course there's no keyboard once we go to touchscreen. The Arch Touchscreen Wiki has some relevant touchscreen info.

Management *may* be possible with synclient, but Touchégg seems to be the best app for managing touchscreen actions. The system runs in two parts, a daemon that gathers clicks, and a client that says what to do with them. The first part, the daemon, is simple enough.

# pacman -S touchegg
# systemctl enable touchegg.service
# systemctl start touchegg

The client spawns connection errors if the daemon is overlooked.

Once the daemon is running, a person runs the client. Eureka, we can use an old skool .config/touchegg/touchegg.conf file to configure the client. There's Touché, a GUI, for this, but I prefer ye olde conf file so as to be portable across installs, and to be sure. It's a basic XML format. The developer's configuration page.

Sunday, January 7, 2024

ffmpeg - concatenation and edits

See also this post.

you are entering HELL if you want to join a few video clips

WHAT SHOULD BE THE SIMPLEST COMMAND IN LINUX VIDEO EDITING CAN ACTUALLY BARELY BE ACCOMPLISHED. MUCH WORSE THAN M3U ANNOYANCES. NO CLI OR GUI. MELT USUALLY FAILS WITH C LIBRARY DEFICITS. HAVE TO USE FFMPEG.

MUST CREATE A TEXT FILE WITH THE WORD "FILE" AND A HARD PATH FOR EVERY FILE TO BE JOINED IF THEY ARE NOT IN THE SAME DIRECTORY, PLACING THEM IN CONCATENATION ORDER. WANT TO TOY WITH ORDER? MAKE ANOTHER ENTIRE FILE. HOURS AND HOURS AND HOURS OF EXTRA WORK.

EVEN WORSE EVERY SINGLE VARIABLE INSIDE EVERY FILE MUST MATCH: BITRATE, PIXEL SIZE, ASPECT, CLOCK, EVERYTHING, MUST MATCH OR EVEN THIS POS METHOD WILL FAIL, WHICH IT MOST OFTEN DOES.

file '/home/foo/file1.mp4'
file '/home/foo/file2.mp4'
file '/home/foo/file3.mp4'

It's that bad. In fact the only thing this process is good for -- whenever it actually works -- is a person knows that each clip independently was fully prepped. So in case I wanted to edit them in some other order -- which happens a LOT for most ppl -- the clips might successfully bond in the new order.

The best results come from combine files with least number of renders. The best way to do this is to do your edits so you end up with a similar tbn, bitrate, and pixel size. There are other problems sometimes with fast concatenations, but the sign that all the edits are done right is that it only takes a list text file and a simple...

$ ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4

Even if you cut these clips from a single larger file without recompiling -- ie, we *know* the DTS and PTS are correct -- you will get shitloads of DTS ("Decoding Time Stamp") errors. The system is absolute SHIT. To avoid the DTS erros, a person would have to re-render *every single clip* BEFORE joining them with an absolute clock, eg.

$ ffmpeg -i clip2.mp4 -video_track_timescale 90000 clip2timed.mp4

...before joining the clips. Can you farking imagine?

best edit process

At least check the edits after done, prior to concatenate, to see they have a reasonably close tbn. Like if you snip off the first 10 seconds of a vid, you definitely don't want to render the vid. But if a check in ffmpeg -i shows a weird tbn, then you have to, or at least try again. eg defaults, 15232, or 11488. I usually use 15232, because I remember it. Phones typically run 90000. And if I have to do a render, I also get some other action done

$ ffmpeg -i messy.mp4 -video_track_timescale 11488 -vf "eq=gamma=1.1:saturation=0.9" output.mp4

Saturday, December 2, 2023

media backup - checklist

I have 2.5 other posts on this backup, so nothing in-depth is covered here. The steps I can recall and a few tips. A repeat at the top of the challenges.

The Challenges

It's likely not a mistake that there's a laborious manual process instead of a simple software solution for the common need of backing-up media. I smell entertainment attorneys.

  • every backed-up CD becomes a folder of MP3's. To recreate playing a CD, a person would have to sit at their computer and click each MP3 file in CD sequence, or else make the entire CD into a single large file.
  • M3U files play MP3 files in sequence, eg in the same sequence as the CD. A large catch (also probably DRM-related) is that M3U files must contain hard links -- a complete system specific path -- to media files for the M3U to function. Thus, any portable, relative link solution is prevented. Further, entering hard links into M3U's must be done manually, and these long links increase the chance for fatigue and entry errors.
  • Most browsers disable (probably due to industry pressures) M3U files from opening, and will only download the M3U without playing these laboriously entered MRL links

NB Time: if a person has the real estate, the industry has made it easier to simply leave media on the shelf and pull it off when a person wants to listen. Backing-up a 100 CD collection takes about 75 hrs (4500 mins), ie, about 2 work weeks. It's worth it, of course, if there's any attachment to the collection.

NB Hard Links: an HTML interface will provide access similar to the original physical disks, with a 'forever and in a small space' fillip. However, the first job is to find a browser that will open links to M3U's. This is probably a moving litigation target, but currently Falkon opens them, albeit with an additional confirmation step in each instance.

NB M3U's: these carry a lot of information, in addition to links. Additional listens over the years allow a person to flesh comments on every track, as much as they want, without affecting playback, or being displayed. They are a private mini-blog for the listener to add info, times, additional versions, or to make new M3U mixes, etc. Protect at all costs.


configure (possibly 1 work day)

  • partition(s) for external backup disk, probably using XFS these days (2023), and a micro usb.
  • fstab is a PITA. It has to be modified to mount the drive you've got the media on, in order for the hard links in M3U's to work. However, a modified fstab will cause boot to fail into maintenance mode if I boot/reboot the system without that drive (I usually specify /dev/sdd for the USB drive) connected.
    So at boot, return fstab to default. After boot, remodify fstab with the dev and run "mount -a". Anyway, that's how f'ed up these WIPO organizations have made having a media drive.
  • Touchscreen and a 3.5mm connector(speakers) + usbc (backed up external)
  • consider file structure: music,images, m3u's, booklets art, video versions, slower versions (for mixes, etc).
  • configure XDG for xdg-open to open M3U's with preferred player
  • review/establish ~/.config/abcde.conf and verify an operational CDDB. The CDDB saves at *least* 5 mins per disk. In lieu, must enter all track names and artists, etc.

backing up (30mins per CD)

  • abcde the shit to 320kb
    $ abcde -d /dev/sr0 -o mp3:"-b 320" -c ~/.config/abcde.conf
  • while abcde, scan (xsane) cover art and booklet to 200 or 300 dpi, square as possible
  • create PDF of booklet/insert (convert jpgs), and save front for easytag and HTML thumbnails
  • << above 3 should be done simultaneously, aiming for 15 mins per disk >>
  • easytag the files and clean their names, attach cover jpg/png.
  • create m3u's for each disk (geany, gedit, whatever)
  • << above 2 roughly 15 mins per disk >>

post-processing (15 mins per CD)

  • download a browser that will not block M3U's, eg Falkon.
  • start building your HTML page
  • enter each file's relevant info into the schema
  • create 100x100 thumbnails for faster webpage loading
    $ mogrify -format png -path /home/foo/thumbs -thumbnail 100x100 *.jpg

tips

  • keep MP3 file names short, since they have to be hand entered into the M3U. Longer names can be in the ID3 tag, and/or M3U file. Both the ID3 info, and especially the M3U file, can accept additional information later, at one's leisure.
  • typos waste a lot of time and break links. Cut and paste whenever possible for accuracy.
  • leave the HTML interface file continually open in the same text editor as for the M3U's. Geany is an example. There are continual modifications and touch-ups to the HTML page, even as I open and close various M3U's. And a lot of copying and pasting from the M3U's into the HTML file.
  • Geany has a search and replace function. When creating the M3U for a CD, a person can copy an existing M3U into the folder of the CD they are working on, and use it for a template. Just rename it for the current CD, and then use the search and replace function to update the all the links inside the M3U with a single click. A person can then start editing the song names without having to do all the hard link information again. Saves time.
  • run the scanner every so often without anything and look at result to see if glass needs cleaning
  • make an M3U template else continually waste 5 mins eliminating prior entries from the one copied over. Every CD will need an M3U to play all of its songs.
  • This is good software cuz it has melt included for combining MP4's

Monday, November 27, 2023

xdg mime, usb mounts

If we have to jettison our physical CD's and DVD's in the name of space, we unfortunately must back them up first. At that point, we lose the convenience of...

  1. easy playback (pull the CD/DVD off the shelf, put it in a player, and press 'play')
  2. in lieu of pressing 'play' in a player, how do we play an entire set of MP3's from a CD with a single click?
  3. global selection is lost (how do we easily observe our entire collection of CD's/DVD's, as we used to on on a shelf?)
  4. the portability of a bookshelf CD player is gone, and we now require a device with an interface to select and play the music

solution

Turns-out that 1, 2, and 4 are related questions. We can create an M3U for each CD (not a trivial task), then create an HTML page with hyperlinks to the M3U's. So when we click the HTML link from our browser, the M3U is opened by the default application (eg. VLC) which plays the CD's MP3's in the order they used to be on the CD.

This fundamentally solves problems 1 and 2. And since HTML pages open on nearly any device with a web browser, we have a good start on solving problem 4.

To solve problem 3, perhaps we can also eventually add thumbnails -- a thumbnail for each CD -- to our HTML page, and then embed an M3U link into the thumbnail: see a thumbnail for a CD, click the thumbnail. Since we can place infinite thumbnails on an HTML page, we can likely see our entire collection on a single webpage. At that point, we'd only need to consider what device and speakers to connect, the hardware.

This is a fairly simple schema, and attainable, but it's a significant investment of work: we must create an intuitive HTML page, and multiple M3U's. The CD's song order and file locations cannot be determined by the application (eg, VLC) without an M3U, so an individual M3U must be created for each CD, and for any mixes.

nested additional problem

We want to open our HTML file in a browser to click on a link to the CD's M3U. However links to M3U's have no default application and thus do not natively work when clicked in browsers. So now our job is two-fold.

  • We must create functional M3U files
  • We must configure our browser or OS to make hyperlinks to M3U's click-to-play. That is, we must associate an application with the HTML link. The OS uses XDG to manage these associations.

xdg 'desktop' files

The XDG system is a script which connects file types and applications. Suppose our browser is Chromium and we click on a website link to a PDF. Chromium makes a call to the XDG system (xdg-open). If we've registered an app for our PDF fileswith XDG, the application (eg. Evince) opens the PDF.

It's a chain, so if we haven't registered a default for PDF's in XDG, Chromium's call to XDG produces no information. In these circumstances, Chromium simply downloads the PDF. XDG itself has its own files and file types with which it makes these connections. We'll configure XDG to connect the M3U to VLC, the same way it connects a PDF to Evince.

This seems simple, but later we will find out that Chromium refuses to open M3U's even when XDG is properly configured for it. See "troubleshooting" further down the page.

m3u xdg registration

Our clickable schema depends on M3U's being played from the browser. However, XDG does not typically have a default application for M3U's. Until we configure one, browsers that contact XDG get no information. As noted above, browsers typically just download the M3U file. In order for the browser to process a click on an M3U hyperlink (without downloading), we must create an association between M3U's and an application. XDG manages this.

add a file type (arch) scroll down to xdg-open and perl-mime-types. Perl mime types is straightforward, and this worked IME. informative arch page. see also their additional page.
add a file type (stack) add an existing file type.
add a file type (stack) the most thorough description. Includes syntax for any file type.
add a file type (superuser) another method, slightly more superficial, for existing file types. Create a desktop file then add to mimeapps.list or run xdg-register.
add a file type (askubuntu) have an existing file type and need to associate it with an application.
list of associations (unix exchange) how to get a list of default file apps.

configure m3u

Verify M3U is already defined within the XDG system.

$ xdg-mime query filetype foo.m3u
m3u: audio/x-mpegurl

...or...

# pacman -S perl-mime-types [incl mimetype]
$ mimetype foo.m3u
m3u: audio/x-mpegurl

...then, to associate it to vlc, or whatever player....

$ mimeopen -d foo.m3u

...verify that (in this example) vlc was associated with it...

$ xdg-mime query default audio/x-mpegurl
vlc.desktop
# update-desktop-database
# update-mime-database

...or...

$ update-mime-database ~/.local/share/mime

verify file opens natively via xdg

$ xdg-open foo.m3u

it should open with vlc.

thumbnails

We need thumnails of CD insert/booklet art for our omnibus music page. Imagemagick is our friend for processing an entire directory of photos to provide us with thumgnails. NB: not sure which of its commands is destructive or additive resize, mogrify, or convert.

$ mogrify -format gif -path /home/foo/thumbs -thumbnail 100x100 *.jpg

troubleshooting

1. M3U access through browser

Install a browser such as Falkon which respects XDG settings for M3U's


Chromium will not open an M3U. Probably a DMCA protection, since M3U's can be built to do streaming, not simply play local files the way I use them. Priority (top of foodchain) is supposed to be the ~/.config/mimeapps.list, but Chromium does not honor any XDG M3U settings or files.

IME, the simplest, fastest solution to this Chromium problem is to install a browser such as Falkon, which respects xdg-open settings. For our music schema to work, we need a browser to open our HTML files.

$ cat .config/mimeapps.list
[Added Associations]
application/pdf=org.gnome.Evince.desktop;
image/jpeg=geeqie.desktop;
text/plain=org.gnome.gedit.desktop;
image/png=geeqie.desktop;
image/gif=vlc.desktop;geeqie.desktop;
video/mp4=xplayer.desktop;
video/mpeg=xplayer.desktop;
application/octet-stream=org.gnome.gedit.desktop;

[Default Applications]
application/pdf=org.gnome.Evince.desktop
image/jpeg=geeqie.desktop
text/plain=org.gnome.gedit.desktop
image/png=geeqie.desktop
image/gif=geeqie.desktop
video/mp4=xplayer.desktop
video/mpeg=xplayer.desktop
audio/x-mpegurl=vlc.desktop;

2. browser path requirements lead to permanent mount point naming

Create a mountpoint and identical /etc/fstab entry. Put it on all devices that need access to USB external drive. All links in our music setup will use these links.


Seems impossible but, when a browser opens an HTML page, the links to M3U's cannot be just the file, eg. "foo.m3u", even if the M3U is in the same folder with the HTML file. We're not used to this. HTML files easily display photos in the same directory or in a subfolder such as 'images'. But for the M3U to open, it must be called with the complete path to the file starting from its mount point eg, "/run/media/[USER]/[LABEL]/music/foo.m3u".

This poses a problem for the user. Each computer has a different username, and the "run" mountpoint is temporary. Gvfs or fusermount inserts the USER and partition LABEL when it mounts the drive, eg, /run/media/[USER]/[LABEL]/. But we can't change the HTML links to our 100+ M3U files every time we mount the USB back-up drive in a different system.

To pass the environmental variable of '$USER' into our URL is also not easy due to security problems with URL's on non-local systems that connect to internet. I tried USER, $USER, %USER%, 'USER', '$USER', '%USER%', `USER`, `$USER`, and `%USER%`. None worked.

To obtain USER, we simply whoami or a larger list of environmental variables with printenv. To determine LABEL, we can of course use 'lsblk', or the more complete...

$ lsblk -o name,mountpoint,label,size,uuid

The next level is a udev rule or fstab configuration that I would place on any machine I use with the backup drive. But GVFS is extremely powerful and udev, fstab, etc may only unreliably/unpredictably override GVFS.

I decided to try an fstab addition since this post (scroll down) made it seem the simplest solution. If I had done the udev rule, the persistent naming setup would have been from kernel detection.

In either case, we basically want to override gvfs when the UUID or LABEL of the backup USB is detected. Unfortunately, we will never be sure GVFS might be fickle on some system and disallow being overriden by /etc/fstab. But we must attempt it, otherwise we cannot use HTML and a browser to manage the media collection. The process is from this post.

  1. Create a permanent mount point. "run/media" is a temporary file system used by GVFS. I decided to create /mnt/[label], where 'label' is the label of the partition. In this case...
    # mkdir -p /mnt/bigdata
  2. update /etc/fstab, then do systemctl daemon-reload
    # nano /etc/fstab
    # UUID=ba60a72e-0db3-4a5f-bea5-c3be0e04cda1 LABEL=bigdata
    UUID=ba60a72e-0db3-4a5f-bea5-c3be0e04cda1 /mnt/bigdata xfs rw,auto,user 0 0
    # systemctl daemon reload
    # mount -a
  3. With the "mount all", the device should load and at that directory with proper permissions. We can verify...
    $ cat /etc/mtab
    /dev/sdd1 /mnt/bigdata xfs rw,nosuid,nodev,noexec,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
    ...and of course try a test write and erase to the drive to verify user permissions.
  4. Now whenever we create a hyperlink in our music oversight HTML file, we can use a persisting, cross-platform, link. Eg, for the M3U, we might have an address of /mnt/bigdata/foo.m3u in the link. If we connect to any other systems, 1) create /mnt/bigdata, and 2) modify their fstab. All links to music and M3U's in our HTML page should then work.
  5. The USB drive will *not* appear in our temporary drive list in our file manager. We'll have to navigate to /mnt/bigdata to see or edit the drive's contents.

Saturday, November 25, 2023

crucial x6 (Micron - 0634:5602)

This is a $199 (early 2023)/$150 (late 2023) 4TB USBA (3.2) <-->USBC (Android) external SSD drive. We're capped at about 800MB of data transfer, but being external obviates annoying NVMe (PCI only) issues. With SSD's, only writing, not reading, decreases their lifespan. I'm thinking of these in terms of 10 year lifespans.

$ lsusb
Bus 003 Device 009: ID 0634:5602 Micron Technology, Inc. CT4000X6SSD9
$ lsblk
sdc 8:32 0 3.6T 0 disk
├─sdc1 8:33 0 128M 0 part
└─sdc2 8:34 0 3.6T 0 part /run/media/foo/Crucial X6
$ cat /etc/mtab
/dev/sdc2 /run/media/foo/Crucial\040X6 exfat rw,nosuid,nodev,relatime,uid=0500,gid=0500,fmask=0022,dmask=0022,iocharset=utf8,errors=remount-ro 0 0

FS considerations

The X6 comes with an extended FAT (exfat) 3.6TB partion and thus syncs to MSoft devices with an added file management area "System Volume Information" of about 128Mb. Should we keep the exfat? Extended FAT has an upper recommended partion limit of 512Tb, so the drive is well-within it's useful partition size, and it's also compatible with Apple devices. YMMV but, in my systems, I prefer zero MSoft either in applications, file systems, or anything else.

A person might next consider formatting to ext2. I've found it reliable for more than a decade. However 2038 is the final time-stamp date available for ext2 files -- ext2 was released in 1993 -- so ext2 is unfortunately nearing some expiration considerations.

Luckily, any FS we want will do fine: external drives don't need to boot, and we only need a single partition to store data. BtrFS supposedly has flexible inode size (so can manage smaller and larger files side by side), but Oracle was involved in its development. Currently, I believe xfs is worth a try, in absence of ext2. Xfs is the default on RedHat systems so it has active development. As for ext4, this Reddit post compares ext4 and xfs. We may also want to soon consider zfs, since it's gaining momentum with large stakeholders.

XFS

Pretty sure xfs will not natively mount in a Windows or iOS systems and has the option of encryption, but it also has a drawback: appropriates journaling space. RedHat has info, of course, and the Arch guide is also good. XFS.org also has its own FAQ.

# umount /dev/sdc
# gparted /dev/sdc [eliminate present stuff, add xfs partition]
# mkfs.xfs -L "bigdrive" /dev/sdc1
# xfs_repair /dev/sdc1
# chown 0500:0100 /run/media/foo/bigdrive

The reason for the xfs_repair is to verify it formatted successfully.

The reason for the chown: for some reason, gvfs mounts xfs as root:root (0:0) instead of the standard user:group setup. Since gvfs mounts other USB drives to group 100, I chown-ed the drive to UID:group, that is to 0500:0100. Can also chown to 0500:0500 if desired, that is user:user (supposing, eg one's UID were 500).

I only had to chown it once and gvfs subsequently auto-mounted the drive with the correct permissions.

If stripe and strip parameter warnings appear, read this and ignore them. That's for RAIDs.

Monday, November 20, 2023

media back-up

This post deals with audio CD's and DVD video -- I have no BluRay media. And it's sort of a worst-case scenario, one where a person can't physically save their media. I've learned an immense amount because it looks like an straighforward project, but it's not. I've written another blog post covering most of the remainder of it.


I recently cleared-out my storage area. I hadn't been in there in 17 years. A few boxes of CD's and DVD's were part of the contents, and the memories of the times when I purchased the media surged in an instant. They welled-up so quickly and powerfully that I choked-up. How had I become so weak and disfigured? Uncomfortable insights.

In spite of such anguish, a person is unlikely to trash the media. It's natural for a person to honor their history. At some point, I want to light a cigar, take a keepsake media disc off a shelf, and put it in a player for a rewatch/relisten.

If no home with a shelf, then very small storage areas can still be rented for what we used to pay for large ones. Ie, rent for what used to be an 8x10', might now rent a 4x4'. A 4x4 can hold a few CD's and a few papers, etc. Maybe $45.

Minus a millionaire's floorplan or an affordable storage area, a person realizes their options are down to one: back the media up, probably in some mediocre fashion/bitrate without cover art, and probably without individual tracks or chapters. Is it even worth it at all? As in every other post on this blog, the answer is "it's entirely up to you", and "the info here pertains to Linux". I found it was worth it for some discs, and others I just threw away. It's about 20 mins per CD, and about X mins per DVD.


TLDR

audio: 20 mins per CD

  • abcde to backup the files and to import online CDDB data for ID3 tags. Verify the fetching CDDB URL inside abcde.conf
  • Easytag (or some ppl prefer picard) to clean up ID3 tags.
  • Sometimes groups of MP3's will require renaming. Gprename can hasten this.
  • Cover art files do not always download and will not be the complete inner notes. While abcde is working, scan the inner liner at 200-300 dpi as close as possible to a square (1:1) crop
  • Later, can make thumbnails for the HTML oversight page.
$ abcde -d /dev/sr0 -o mp3:"-b 320" -c ~/.config/abcde.conf

dvd: handbrake to backup the files.


playback note

See my post, which suggests an HTML/M3U file solution. Some may wish to install LibreELEC and Kodi in an old laptop to work as a "CD player". All of the engineered "media manager" products are bullsh*t IMO -- more concerned with phoning home your collection than any other task. A simple HTML page works much faster, and more reliably and configurably.

If we formatted our external back-up drive with XFS, then it will not work with a Windows or Mac device. So we will at least need some device to access the files. And a 3.5mm jack in the device, to move the audio to a computer speaker system or some headphones. Alternatively, we could design some static web pages and make thumbnails of of the CD covers with built-in links to playlists or which open the folders and play the contents. The specs for m3u's are here.

Although I run icewm, my MIME settings are handled by xdg. So it will play an MP3 link, but download an M3U link.

$ xdg-settings get default-web-browser
chromium.desktop

Applications work as .desktop files. Not sure.

audio 90-100Mb per CD

Time and discwise, a CD like Fleetwood Mac's Rumours, about 40 mins long, takes about 12 min to rip and transcode at 320k. The 320K bitrate leads to a 90Mb folder of files, or roughly 2.3Mb per minute (at 320Kb). I find 90Mb per CD unproblematic at today's drive prices.

Quality wise, I prefer a full 320Kb MP3, esp if the music is nuanced with flanging or orchestration. IMO, 192K can be OK, but 128K is definitely not OK unless just a speech or some such.

Probably abcde is still the easiest attack on a stack of backup CD's. We need some way to save id3 information, and probably edit it (eg, easytag). Installing abcde will also pull-in python-eyed3. I installed glyph out of an abundance of caution for photo embedding.

$ yay -S abcde id3 python-eyed3
# pacman -S glyph id3v2

audio - abcde use and config

Abcde has an old school text conf file. Get the skeleton from /etc and copy it to wherever to edit it, eg ~/.config, then do edits like the CDDB URL and save. Next, adjust the URL where abcde finds ID3 information to populate the files.

$ cp /etc/abcde.conf ~/.config/abcde.conf
$ nano ~/.config/abcde.org
CDDBURL="gnudb.gnudb.org/~cddb/cddb.cgi"

When executing, the config file is called with the "c" flag and path.

$ abcde -c "~/.config/abcde.conf"

Abcde does not rip directly to MP3; it rips the entire CD to WAV's (10 mins), then converts each WAV to whatever number of other formats we want. From rip to conversion to one other format is about 12 mins per CD. Native MP3 conversion bit rate is 128k. Of course, if a person simply wants the WAV's, then use the defaults, eg $ abcde -d /dev/sr0.

For this project I'm likely to to specify MP3's at 320kb, though a person can specify what they like (or leave off the ':"-b 320"' for 128k).

$ abcde -d /dev/sr0 -o mp3:"-b 320"

audio - ID3 info

ID3 is no longer reliably being developed and there are different versions which might conflict. Of the versions, I consider ID3v2 compatible with nearly any player and therefor a reliable ID3 format for my MP3 files. ID3v2 is also supposedly the ID3 version EasyTag apparently uses. So after first tagging some MP3 files with EasyTag, I verified the ID3 version by installing id3v2. Then I ran its utility in a terminal, $ id3v2 -l [name].mp3, to verify my ID3 tags were version 2, ie, ID3v2.

$ id3v2 -l 02.Dreams.mp3
id3v2 tag info for 02.Dreams.mp3:
TIT2 (Title/songname/content description): Dreams
TPE1 (Lead performer(s)/Soloist(s)): Fleetwood Mac
TALB (Album/Movie/Show title): Rumours
TYER (Year): 1977
TRCK (Track number/Position in set): 02/11
TCON (Content type): Rock (17)
02.Dreams.mp3: No ID3v1 tag

Even with a functional CDDB URL in our ~/.config/abcde.conf , we often need to do the ID3 and art manually.

# pacman -S easytag
$ yay -S gprename

audio - ID3 art

It appears EasyTag only recognizes photos if gdk-pixbuf2 is installed.

# pacman -S gdk-pixbuf2

I arrange the scanner (xsane) for 300dpi, and preview the image close to a square. The resulting scan I then then scale. Get the WxH to about 1400x1400. This makes about a 500Kb file to add to each music file in that folder, so if 10 files in the CD, it adds 5MB to the entire folder. The 1K x 1K pic will display pretty sharp if running the file in VLC. Not sure other players. If I have an internal booklet in the CD, I scan it all and make a PDF to put in the folder.

Adding the art: put the image in the directory with the MP3's, open EasyTag in that directory, selecting all the files I want to receive that image (typically cover image). Then I go to the right and select "images" tab, add the pic with the "+" icon, and saving it to the files. A person will figure it out fast.

Removing art is fickle. I can do it in EasyTag, but it seems to stay in the VLC cache so I can never be sure. A sure way is to 1) Delete the directory for VLC album art: ~/.cache/vlc/ and, 2) go nuclear via "cd"ing into the music files directory and then...

$ id3v2 -r "APIC" *.mp3

audio - manual tasks

If I find old directories full of WAV's, like CD's I made back when, or whatever, I can batch convert the WAV's into 320k cbr MP3's.

$ for f in *.wav ; do lame -b 320 $f ; done

If I find a track that I want to slow it down (I don't mind pitch) and put a 0.8 speed version in the CD directory, perhaps to use with mixes, then...

$ sox foo.mp3 -C 320 foo8.mp3 speed 0.8

If I want to combine all the tracks in the CD into a blob, so I can play easily when driving or whatever...

$ sox foo1.mp3 foo2.mp3 foo3.mp3 output.mp3

There's a lot more about sox here.

Then I can get the art for it online or design something. Either way, put it in the folder with the files and add the art and info via EasyTag.

dvd 1.3G each

dvd - art

Use at least 300x300 ppi and some similar dimension. Give it the same name as the film file, but a JPG extension. When company arrives, they can easily peruse a collection with a file manager, or by browsing the photos in something like Geeqie.

dvd - content

Most movies (1.7 hrs) are 1.1GB (480P) and about 20 mins to back-up, assuming a person continues their other computer tasks throughout the encode. Episodes of TV shows are typically. If I have a higher-res recent DVD, I use the Fast(not Super-Fast)720p setting in Handbrake. It's 2 passes. Otherwise I used 480p Fast. run Fast The HandBrake software install (see picture below) is about 80Mb.

The rip is two parts, extraction and transcoding, and DVD structure is described here.


First, don't forget the obvious...

# pacman -S libdvdcss libdvdread libdvdnav

...since literally *none* of the players will do anything but spawn errors without explanation if these are lacking.

One fairly simple Arch solution is HandBrake.

# pacman -S handbrake

To execute, ghb which, along with icon, a person can find with ye olde...

$ pacman -Ql handbrake

...and there are flags of course, not sure where to locate.

I start HandBrake from a terminal (again, "ghb") even though it's a GUI. This is because the CSS keys take a minute or two to propagate and I can't see when they're finished within the application. Once I see the keys have propagated, I can return to GUI selection options.

dvd - storage

Probably need to think about file structure. At least like "movies, bbc, adultswim, sitcoms, detective". Or some such. Then include the scan of the cover art with the file