Penguin, small TECH.BARWICK.DE
Start
 

Recent posts

Categories

Archive

Syndication

 



Powered By

Info

So I have this big-ish Samsonite suitcase which many years ago suffered a partial failure of the telescopic handle, specifically the inner telescopic tube on one side would no longer slide out of the outer tube, so the whole assembly would only partially extend, like this:

Stuck telescopic handle on a Samsonite suitcase


Posted in Solutions | add a comment

Ran into an error like the following when trying to build etcd as a CentOS 7 package:

go: github.com/prometheus/client_golang@v1.0.0 requires
	github.com/prometheus/common@v0.4.1 requires
	github.com/prometheus/procfs@v0.0.0-20181005140218-185b4288413d: invalid version: git fetch --unshallow -f origin in /root/go/pkg/mod/cache/vcs/0ab7c7bc964e6f4054247fed3ac8d636309918420efe8a7cabef12d9f9904311: exit status 128:
	fatal: git fetch-pack: expected shallow list

or sometimes this:

go: golang.org/x/crypto@v0.0.0-20200622213623-75b288015ac9 requires
	golang.org/x/net@v0.0.0-20190404232315-eb5bcb51f2a3 requires
	golang.org/x/crypto@v0.0.0-20190308221718-c2843e01d9a2: invalid version: git fetch --unshallow -f origin in /root/go/pkg/mod/cache/vcs/f72f7a6f267d2fe79b1e174efab21a591b07c84ef53364f65b8281fda7000b49: exit status 128:
	fatal: git fetch-pack: expected shallow list

The mysterious thing was, the build had previously completed without issue many times, and there were no obvious changes in any of the build elements involved.

This issue does resemble that described in golang GitHub issue #38373; the workaround suggested by the poster involves resolving version references in the go.mod file. However that did not seem feasible for this build, which indirectly pulls in a large number of golang modules from various git repositories, which would make tracking down any version reference issues a somewhat Herculean task.

It was however possible to resolve the error (as suggested in a comment on the issue) by upgrading the git package to a more recent one, as the default CentOS 7 version is a very dated 1.8.x (released in 2014 or earlier).

Recent git packages for CentOS 7 can be obtained from the Endpoint repository here: https://packages.endpoint.com/rhel/7/os/x86_64/.


Posted in Devel | add a comment

Monday, June 7, 2021   5:51 AM

ERROR: `fop' is missing on your system.

Ran into this error when trying to build the PostgreSQL documentation as a PDF file on CentOS 8:

$ make postgres-A4.pdf
/usr/bin/xmllint --path . --noout --valid postgres.sgml
/usr/bin/xsltproc --path . --stringparam pg.version '14beta1' --stringparam img.src.path './' --stringparam paper.type A4 -o postgres-A4.fo stylesheet-fo.xsl postgres.sgml
Making portrait pages on A4 paper (210mmx297mm)
/bin/sh ../../../config/missing fop -fo postgres-A4.fo -pdf postgres-A4.pdf
***
ERROR: `fop' is missing on your system.
***
make: *** [Makefile:178: postgres-A4.pdf] Error 1

As with many things, there doesn't appear to be a CentOS package for this (and given recent developments there might never be). However as fop is a Java-based tool, it's simple enough to install locally.

  1. Download the latest distribution from https://xmlgraphics.apache.org/fop/download.html
  2. create a directory (say ~/fop/)
  3. Extract the following files/directories from the downloard .tar.gz file to ~/fop/:
    1. fop
    2. build/
    3. lib/

Then ensure ~/fop/ is included in the PATH variable when performing any tasks where it is required.

Note: for the PostgreSQL documentation build, both the top-level source ./configure and make (in the doc/ directory) need to be run again so the build system detects the location of fop.

DISCLAIMER: there is probably a more elegant way of doing this, but the above sufficed for a quick workaround in the heat of the moment.


Posted in Devel | add a comment

Friday, January 29, 2021  12:28 AM

pandoc and "fd:4: hClose: resource vanished (Broken pipe)"

I was recently stumped by the following error emitted from deep within a build process:

fd:4: hClose: resource vanished (Broken pipe)

It turned out to be coming from an invocation of pandoc with the --filter option, where the filter script was failing due to missing package dependencies (an artefact of the python2python3 transition, aargh).


Posted in Devel | add a comment

Friday, March 6, 2020   8:42 AM

AspiegelBot

A rather voracious bot which announces itself as:

Mozilla/5.0 (compatible;AspiegelBot)

and comes from a wide range of AWS IP addresses (non-exhaustive list below). It seems to be quite new and as of the time of writing there don't seem to be any meaningful search results, other than a handful of links to website statistics pages.

  • 114.119.160.18
  • 114.119.160.31
  • 114.119.160.43
  • 114.119.160.50
  • 114.119.160.56
  • 114.119.160.87
  • 114.119.160.101
  • 114.119.160.106
  • 114.119.160.141
  • 114.119.160.144
  • 114.119.160.150
  • 114.119.160.167
  • 114.119.160.171
  • 114.119.160.189
  • 114.119.160.200
  • 114.119.160.217
  • 114.119.160.224
  • 114.119.160.245
  • 114.119.161.4
  • 114.119.161.19
  • 114.119.161.43
  • 114.119.161.51
  • 114.119.161.55
  • 114.119.161.76
  • 114.119.161.82
  • 114.119.161.83
  • 114.119.161.113
  • 114.119.161.114
  • 114.119.161.116
  • 114.119.161.121
  • 114.119.161.132
  • 114.119.161.134
  • 114.119.161.150
  • 114.119.161.167
  • 114.119.161.183
  • 114.119.161.227
  • 114.119.161.251
  • 114.119.162.2
  • 114.119.162.19
  • 114.119.162.34
  • 114.119.162.40
  • 114.119.162.44
  • 114.119.162.56
  • 114.119.162.57
  • 114.119.162.64
  • 114.119.162.66
  • 114.119.162.91
  • 114.119.162.133
  • 114.119.162.165
  • 114.119.162.195
  • 114.119.162.200
  • 114.119.162.206
  • 114.119.162.207
  • 114.119.162.212
  • 114.119.162.224
  • 114.119.162.249
  • 114.119.162.250
  • 114.119.163.3
  • 114.119.163.13
  • 114.119.163.16
  • 114.119.163.20
  • 114.119.163.56
  • 114.119.163.63
  • 114.119.163.81
  • 114.119.163.86
  • 114.119.163.108
  • 114.119.163.117
  • 114.119.163.121
  • 114.119.163.123
  • 114.119.163.142
  • 114.119.163.147
  • 114.119.163.161
  • 114.119.163.173
  • 114.119.163.183
  • 114.119.163.197
  • 114.119.163.239
  • 114.119.164.1
  • 114.119.164.3
  • 114.119.164.7
  • 114.119.164.33
  • 114.119.164.46
  • 114.119.164.47
  • 114.119.164.71
  • 114.119.164.81
  • 114.119.164.85
  • 114.119.164.108
  • 114.119.164.115
  • 114.119.164.118
  • 114.119.164.132
  • 114.119.164.155
  • 114.119.164.166
  • 114.119.164.183
  • 114.119.164.196
  • 114.119.164.206
  • 114.119.164.207
  • 114.119.164.213
  • 114.119.164.233
  • 114.119.164.253
  • 114.119.165.6
  • 114.119.165.15
  • 114.119.165.23
  • 114.119.165.28
  • 114.119.165.41
  • 114.119.165.42
  • 114.119.165.52
  • 114.119.165.59
  • 114.119.165.83
  • 114.119.165.108
  • 114.119.165.115
  • 114.119.165.120
  • 114.119.165.122
  • 114.119.165.125
  • 114.119.165.127
  • 114.119.165.148
  • 114.119.165.168
  • 114.119.165.169
  • 114.119.165.175
  • 114.119.165.199
  • 114.119.165.213
  • 114.119.165.227
  • 114.119.165.229
  • 114.119.165.230
  • 114.119.166.1
  • 114.119.166.58
  • 114.119.166.79
  • 114.119.166.105
  • 114.119.166.107
  • 114.119.166.156
  • 114.119.166.231
  • 114.119.166.239
  • 114.119.166.240
  • 114.119.166.241
  • 114.119.167.13
  • 114.119.167.38
  • 114.119.167.45
  • 114.119.167.48
  • 114.119.167.56
  • 114.119.167.62
  • 114.119.167.96
  • 114.119.167.109
  • 114.119.167.130
  • 114.119.167.139
  • 114.119.167.154
  • 114.119.167.161
  • 114.119.167.181
  • 114.119.167.209
  • 114.119.167.215
  • 114.119.167.241
  • 114.119.167.248


Friday, January 24, 2020   6:07 AM

Making GPG pinentry work over SSH

When logged into a server via SSH, usually any attempt to decrypt a file with GPG results in an unhelpful error message like:

gpg: cancelled by user
... gpg: decryption failed: No secret key

with no attempt made to ask for a password.

Fix for this is simply to execute: export GPG_TTY=`tty`,

Note that if pinentry-program in ~/.gnupg/gpg-agent.conf is set to /usr/bin/pinentry-gtk, and this is an alias for /usr/bin/pinentry-gtk-2, set pinentry-program to the latter (/usr/bin/pinentry-gtk-2), which appears to change the behaviour (pinentry-gtk-2 should be able to automatically detect whether to execute in GUI or text mode, whereas the original pinentry-gtk is GUI-only.

See also "Forcing GPG passphrase input in the terminal".


Posted in Linux | add a comment

My email client suddenly became unable to log in to my Gmail account with the error message:

Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure)

However I was logged in via my web browser on two different devices, and even when providing the email client with definitively the correct password, the above error recurred.

The provided link wasn't very helpful.


Posted in email | add a comment

Tuesday, September 24, 2019  11:12 PM

Yum and "Thread died in Berkeley DB library" errors

I started getting intermittent sets of error messages like this:

error: rpmdb: BDB0113 Thread/process 26154/140393252489024 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm

when deploying changes to a bunch of AWS EC2 instances.

The error messages are misleading as (in this case at least) the RPM database is not corrupted; the underlying issue was this:


[67897.740241] Out of memory: Kill process 28759 (yum) score 330 or sacrifice child
[67905.749492] yum invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0

i.e. simply a lack of memory (the instances were just too small).


Posted in Linux | add a comment

The Prometheus PostgreSQL storage adapter does not seem amenable to being executed directly from a systemd service file.

As a workaround I created a wrapper script like this (adjust parameters as required):

#!/bin/bash

# Wrapper to launch prometheus-postgresql-adapter, as calling
# it directly from the systemd service file doesn't seem to work.
#
# Disclaimer: there is probably a better way of doing this.

nohup /usr/local/bin/prometheus-postgresql-adapter \
-pg-host=... \
-pg-port=... \
-pg-database="..." \
-pg-user="..." \
>> /var/log/prometheus-postgresql-storage-adapter/prometheus-pg-adapter.log 2>&1

and a service file like this:

[Unit]
Description=Prometheus PostgreSQL Storage Adapter
Documentation=https://github.com/timescale/prometheus-postgresql-adapter
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=prometheus
Group=prometheus
ExecStart=/usr/local/bin/prometheus-postgresql-adapter-wrapper
Restart=on-failure

[Install]
WantedBy=multi-user.target

which works fine (YMMV of course).

There may of course be a more elegant way of solving this issue, if so feel free to share.


Posted in Linux | add a comment

Tuesday, August 27, 2019  10:25 PM

The unicode() function and Python3

Recently I had to work with some Python code which needs to be compatible with both the hopefully-soon-to-be-finally-deprecated Python 2.7 and recent 3.x versions.

String handling can be a tricky issue, particularly if the string in question needs to be cast to a Unicode object. Take the following example:

#!/usr/bin/env python

import ipaddress

addresses = list(ipaddress.ip_network(unicode('192.168.1.0/24')));

for address in addresses:
    print(address)

This does of course fail in Python 3.x with an error like:

Traceback (most recent call last):
  File "./python.py", line 5, in 
    addresses = list(ipaddress.ip_network(unicode('192.168.1.0/24')));
NameError: name 'unicode' is not defined

Remove the unicode() wrapper and it fails in Python 2.x with:

ipaddress.AddressValueError: '192.168.1.0/24' does not appear to be an IPv4 or IPv6 network. Did you pass in a bytes (str in Python 2) instead of a unicode object?

The solution is to use the "six" compatibility layer and add the following directive, which reassigns unicode() to a mutually compatible function:

#!/usr/bin/env python

import ipaddress

from six import u as unicode

addresses = list(ipaddress.ip_network(unicode('192.168.1.0/24')));

for address in addresses:
    print(address)

Note that the "six" compatibility layer may need to be installed separately, in RedHat et al via the packages python2x-six and python3x-six respectively.

Useful links


Posted in Devel | add a comment

Tuesday, January 10, 2017   3:25 AM

TLS key negotiation failed to occur within 60 seconds

Spent a lot of time working out why openvpn wouldn't connect from a Vagrant virtual machine (running Ubuntu 14.04 LTS):

Tue Jan 10 02:51:25 2017 Control Channel Authentication: tls-auth using INLINE static key file
Tue Jan 10 02:51:25 2017 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Tue Jan 10 02:51:25 2017 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication
Tue Jan 10 02:51:25 2017 Socket Buffers: R=[212992->200000] S=[212992->200000]
Tue Jan 10 02:51:25 2017 UDPv4 link local: [undef]
Tue Jan 10 02:51:25 2017 UDPv4 link remote: [AF_INET]xxx.xxx.xxx.xxx:1194
Tue Jan 10 02:51:25 2017 TLS: Initial packet from [AF_INET]xxx.xxx.xxx.xxx::1194, sid=92749f62 ced33a12
Tue Jan 10 02:52:25 2017 TLS Error: TLS key negotiation failed to occur within 60 seconds (check your network connectivity)
Tue Jan 10 02:52:25 2017 TLS Error: TLS handshake failed
Tue Jan 10 02:52:25 2017 SIGUSR1[soft,tls-error] received, process restarting
Tue Jan 10 02:52:25 2017 Restart pause, 2 second(s)

Turns out the openvpn version (2.3.2) is outdated; 2.3.4 or later is needed.


Posted in Solutions | add a comment

Monday, May 30, 2016  11:54 AM

Forcing GPG passphrase input in the terminal

One annoyance when entering GPG passphrases in terminal applications on many systems is that a seperate GUI window pops up. To enable passphrase entry in the comfort of your own terminal, set the following line in .gnupg/gpg-agent.conf

pinentry-program /usr/bin/pinentry-tty

or in some older distributions (e.g. CentOS 7):

pinentry-program /usr/bin/pinentry-curses

The running agent's settings can be reconfigured with:

gpg-connect-agent reloadagent /bye

See also "Making GPG pinentry work over SSH".


Posted in Linux | add a comment