gotchas

thursday, 11 august 2022

a random collection of code fragments used to solve various *nix installation problems encountered over time, after upgrades, etc.

I have been meaning to keep a journal of little fixes but, up until now, never have had the discipline to do so. That’s because most of these little fixes are that: little. Either a quick command line action or an enhancement to a script. They seem trivial at the time of resolution but often required pulling up a manpage or a little digging to resolve.

My analogue memory is porous, as is evidenced by the fact that I am certain there are plenty of anecdotal gems but can remember naught. So, without further adieu, time to start recording these maintenance forays as I (re)stumble across them..

warning

a word of warning: some gotchas may be dated (read, as in, no longer relevant or work with the latest release of software). i have not made any effort to update notes for tools i no longer use. The same can be said for much of the colophon content.

404

when the Archlinux repository databases do not match the actual packages residing on the servers, pacman errors out with..

error: failed retrieving file '<package>.pkg.tar.xz' from <url> : The requested URL returned error: 404

This can result from having a stale dated pacman database installed which can be updated with..

pacman -Syy

While infrequent, it is also not uncommon for..

pacman -Syu

to fail because, while the database may be up to date, the packages themselves have not yet finished being updated on the servers. Patience is a virtue. Try again later.

authentication errors

google has a nasty habit of turning off access by third party applications. It is a measure intended to prevent account breaches, something that plagues the internet ever increasingly. It is a double edged sword and can cause disruptions to legitimate server setups.

When authentication connection errors suddenly appear on unchanged setups, the first thing to check is whether google has disabled the account’s “less secure app access” option. Turn ON “Allow less secure apps”.

btrfs

RAID 10 scrubs sometimes report space cache does not match inode errors.

To correct, unmount the RAID and run for each drive in the RAID..

sudo btrfs check /dev/sd<device>

Then, mount and rerun scrub of RAID.

calibre

by default, calibre creates device folders by author_sort by title (sort) and authors. From the ereader device UI, it is of little consequence as the sorting—by author surname and title (ignoring leading “A” and “The”)—does not affect the book author and title listing itself.

A strict alphabetical naming convention can be imposed on the side loaded files by changing the Preferences -> Tweaks to..

title_series_sorting = 'strictly_alphabetic' save_template_title_series_sorting = 'strictly_alphabetic'

The first tweak merely applies the same strict alphabetical order to the calibre UI.

Pro-tip: for the Kobo ereader, configure the following plugin KoboUtilities -> Driver -> KoboTouchExended template..

books/{authors}/{title} - {authors}

to place all side loaded kepubs in the books (any path name) folder for a less cluttered root folder—makes locating the fonts (for adding custom fonts) and .kobo folder (for applying kobopatches) much easier.

chrome

css float:right does not render in the “Gravity Well” custom TT-RSS theme. Current fix is to disable

Enable LayoutNG

in chrome://flags.

cups remote

to access a printer on the local network, from the cups browser http://localhost:631 add an ipps printer referencing..

ipps://ip-address-or-hostname/printers/name

where, name is the cups name given the printer on the hostname computer.

Continue configuring the printer with the appropriate drivers. This new printer may be assigned the same printer name so that its printer destination value remains the same for lp commands on either computer.

curl

allows you to pull down the URL content of a website which is useful for scraping information. If nothing appears to be downloaded, most likely, the webpage has been relocated. This can be verified with..

curl -silent -v http://..

which will list the message “.. Moved Permanently”.

To have curl follow the link to the webpage’s new location..

curl -silent -L http://..

dash

shell is my scripting shell of choice. I used to write bash and zsh scripts for their syntactical richness but now script in dash because of that. Without all of the syntactical shortcuts, dash runs circles around bash and zsh. Its usage for window management was the reason for switching back to this streamlined shell.

Aside from the POSIX language restrictions, using eval to simulate the occasional array, printf for enhanced echo commands, and enclosing variables within double quotes for tests (to handle embedded Spaces) are the most common differences. As an added benefit, POSIX conformity ensures platform portability and keeps your shell scripting skills honed.

dbus

does not inherit the DISPLAY environment on window manager startup. This will cause daemon notifications such as that issued from udiskie to fail. For Arch Linux, in .xinitrc source..

. /etc/X11/xinit/xinitrc.d/50-systemd-user.sh

fish

shell is a non-POSIX interactive shell which has been my daily terminal driver despite the fact that I code all shell scripts for POSIX compliant dash. A benign startup test index error message occurred after a recent update which curiously affected only one computer! This was ultimately caused by a file which had an errant keybind function reference whose cause remains unknown. Its recurrence was cleared by..

rm $HOME/.config/fish/fishd.(hostname)

fontmatrix

if the font family list is corrupted—missing or unlisted fonts, including blank entries, showing deleted fonts, crashes when fonts are selected, etc.—purge the fontmatrix database and restart..

rm -rf $HOME/.Fontmatrix

Be patient.. it takes a moment for fontmatrix to rebuild its font database.

freetype2

to approximate infinality like font rendering, enable the following configurations..

sudo ln -s /etc/fonts/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d sudo ln -s /etc/fonts/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d

goyo

clears the statusline by default for a distraction free presentation of the page. Even if you set the statusline in a call to your own initialization function..

autocmd User GoyoEnter nested call <SID>GoyoEnter()

To prevent Goyo from overwriting your attempts to set a minimal statusline (why would you be using Goyo otherwise!), edit the plugin autoload/goyo.vim file..

function! s:hide_statusline() let &l:statusline = &statusline endfunction

group and passwd

systemd boot message: “Failed to start Verify integrity of password and group files”.

A package removal can orphan group and passwd file settings. Check and correct with..

sudo grpck sudo pwck

gtk pixbuf

the error message..

Gtk-WARNING **: ..: Could not load a pixbuf from icon theme. This may indicate that pixbuf loaders or the mime database could not be found.

may indicate /usr/share/icons/ permission or mime errors. But can also be an indicator of an incomplete icon set causing the current GTK application to throw the warning for a needed icon e.g. the Paper icons is missing the down arrow menu button (at the time of this reporting).

Installing a more complete icon set resolves the issue.

html

shell scripting allows for unquoted string (single word) assignments. A questionable practice.

This is fatal with HTML. Class and identifier names must be “quoted”. Or, like me, you will spend lots of head scratching time wondering why your CSS template doesn’t work!

infinality

freetype2 is slowly integrating the subpixel hinting of the infinality patches bringing it closer to the rendering provided by infinality. Switching back and forth between these font rendering packages, depending on the platform, can result in the replacement of an installed video card specific mesa library with the generic xorg mesa-libgl. This can cause the X desktop environment to appear broken with infinality—with conky graphics not displaying, fonts not appearing, text input not registering, etc.

The solution is to reinstall the necessary video card specific mesa library, such as nvidia-libgl. The caveat is to always pay attention to what libraries are replaced when switching back and forth between packages.

Note: deprecated, no longer supported in favour of freetype2.

inotify watches

if inotify watches become exhausted, applications such as pulseaudio can fail to load completely and Xorg can appear stalled (while waiting for subprocesses which are hampered by inotify resources). Messages in related logs and the systemd journal will identify that the inotify resources are exhausted.

To verify the current maximum number of inotify watches and set a new session limit..

cat /proc/sys/fs/inotify/max_user_watches sudo sysctl fs.inotify.max_user_watches=32768

To increase the value to a suitably large number..

echo fs.inotify.max_user_watches=32768 | sudo tee /etc/sysctl.d/99-sysctl.conf

on Archlinux..

echo fs.inotify.max_user_watches=32768 | sudo tee /usr/lib/sysctl.d/90-override.conf

lg g8x

not a linux issue but an Android device issue. My phone got laggy taking a second or more to respond to a screen gestures (typically, launching an app). A quick fix to recover some available RAM is to remove an LG tracking app. With Android developer options enabled, from Linux station..

adb devices # list devices adb shell # open session pm uninstall -k --user 0 com.lge.mlt

lightline

has useful colour schemes matching available vim color theme plugins, such as solarized. To get a bit more contrast with the light solarized theme command mode field, edit the plugin colorsheme/solarized_light.vim file..

let s:p.normal.left = [ [ s:base02, s:blue ], [ s:base3, s:base01 ] ] let s:p.insert.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ] let s:p.replace.left = [ [ s:base02, s:red ], [ s:base3, s:base01 ] ] let s:p.visual.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]

offlineimap

a recent openssl update (version 1.1.1) may cause subsequent SSL errors connecting to gmail.com due to SNI (Server Name Indication) and certificate authentication failure with TLS 1.3. Add to .offlineimaprc to force TLS 1.2..

ssl_version = tls1_2

pacman

the latest major upgrade to pacman 5.0 broke package-query which is a dependency of many Arch Linux package management utilities. The option for my package management workflow was to either wait for upstream to correct the problem or rebuild the packages to use the new libalpm library..

pacaur -S --rebuild cower pacaur -S --rebuild yaourt package-query

On rare occasions, a keyring update can hang on a deadly embrace with itself. This can be rectified with..

pacman -S archlinux-keyring

or failing that..

pacman-key --populate

before continuing with the remaining package updates.

pacaur

can be fooled into thinking a development git-latest package needs updating even though the –devel flag is not enabled. It is actually a cower related issue which can be identified with..

cower -u

There is not much that can be done with the offending package other than –ignore‘ing it until a new github release of the package is available.

pango

controls Gvim’s double width UTF-8 font rendering of glyphs on the statusline. pango-1.44.x breaks this and rendering of vertical extenders. Until fixed, downgrade to pango-1.42.x.

passenger

major ruby 2.x language updates will break the nginx passenger application—namely, this website. Updating the ruby environment requires updating the ruby gems, including passenger, and rebuilding the nginx server and passenger client with..

gem update $[HOME/.gem/ruby/2.x.0/gems/passenger-x.x.x/bin/passenger-config](http://thedarnedestthing.com/HOME/.gem/ruby/2.x.0/gems/passenger-x.x.x/bin/passenger-config) compile-agent $HOME/.gem/ruby/2.x.0/gems/passenger-x.x.x/bin/passenger-install-nginx-module

Update the nginx.conf passenger root reference with..

passenger_root ~/.gem/ruby/2.x.0/gems/passenger-x.x.x;

qt

themes are defined in the .config/Trolltech.conf file. If this file is removed, QT will regenerate it.

However, if the file is regenerated, the QT application Amphetype will not recognized any Gtk theme changes. Restoring the original file from backups solves the problem. So..

Do not delete this file, unless you are running a QT desktop environment(?)—possibly a limitation of window manager environments.

raspberry pi

media playback can suffer from audio stuttering over NFS. To solve this, adjust the buffering in /etc/fstab..

luna:/net /net nfs4 rw,noatime,rsize=32768,wsize=32768,nolock,_netdev 0 0

sed

allows modifying file content with the –in-place flag. However, if the file referenced is symlinked, the symbolic link will be broken and a file by that name created. To update the linked file instead..

sed -i --follow-symlinks ..

vim

some plugins and colorscheme themes alter the statusline fillchars resulting in the expected Space characters of the statusline being filled with a non-blank character such as a Caret or Period. Yuck!

To set spaces on the statusline, add to the fillchars..

set fillchars+=stl:\ ,stlnc:\ "

Note: a Space character follows each Backslash character. The DoubleQuote is simply a comment insertion to highlight the trailing blank.

A more reliable method, in case multiple specifications are defined in the string for the same character, is to explicitly redefine (reset) the fillchars with..

set fillchars=stl:\ ,stlnc:\ "

or remove the conflicting specification with (for example)..

set fillchars-=stl:.

vimscript

user defined commands which accept an argument and allow a bar ‘|’ separator, must escape the bar, e.g…

command! -nargs=? -bar WaitFor call <SID>waitFor(<f-args>) autocmd ui VimEnter,VimResized,FocusGained * WaitFor | Background command! RedrawGui silent! ToggleGui | WaitFor 50m \| ToggleGui

Setting the syntax for an ftdetect’ed file setting its filetype cannot be easily done within ftplugin due to vim’s runtime Syntax autocmd which overrides any attempt to set the syntax—the source of years of head scratching and overly complex workarounds. A generic fix is possible for common filetypes within the .vimrc configuration file, post ftplugin..

autocmd Syntax <buffer> execute 'set syntax=' . &filetype

vimwiki

in order to be able to use the Tab key for snipmate expansion, remap vimwiki’s use of the key for tables in the plugin ftplugin/vimwiki.vim file..

if g:vimwiki_table_mappings inoremap vimwiki#tbl#kbd_tab()\ inoremap vimwiki#tbl#kbd_shift_tab()\ endif

void

ran into on an attempted system update..

Transaction aborted due to unresolved shlibs.

Resolved with

sudo xbps-remove void-repo-nonfree sudo xbps-install void-repo-nonfree sudo xbps-remove -Oo # beware.. this removes /var/cache/xbps packages sudo xbps-install -Su

xorg

the message upon exiting a X11 session (stopping X)..

X server lost bad font path element.. Directory does not exist or has wrong permissions

is a benign warning and most likely results from user fonts in $HOME/.fonts. This warning can be corrected with..

cd $HOME mkfontdir mkfontscale

Similarly, the message..

couldn't access control socket: /run/user/1000/keyring/control: No such file or directory

is a benign gnome-keyring-daemon warning and can be corrected with..

sudo sed -i '$asession optional pam_gnome_keyring.so auto_start \ auth optional pam_gnome_keyring.so' /etd/pam.d/login sudo sed -i '$apassword optional pam_gnome_keyring.so' /etc/pam.d/passwd

After making these changes, restart the X server.

»»  chorded bigrams

comment ?