six demon bag

Wind, fire, all that kind of thing!

2020-06-11

Installing Discourse on Devuan

Before deciding on setting up my Q&A site with Question2Answer I evaluated several programs, one of them being Discourse. And even though I ultimately decided against Discourse (because the setup was too complex and it doesn't have all the features I wanted) I don't want my experiences go to waste, so I'll publish them here.

See more ...

Posted 19:57 [permalink]

2020-06-02

Privacy-friendly Logging With Nginx

IP addresses are considered personal information, so your web server is not supposed to log them, at least not in a way that would allow tracing the address back to a person. The usual way to comply with this requirement is to mask part of the visitor's IP address, e.g. 192.168.23.42 → 192.168.23.0 (IPv4) or fd22:e03e:f88a:ea84::42 → fd22:e03e:: (IPv6).

See more ...

Posted 15:27 [permalink]

2020-03-23

Shell Patterns (3) - Structured Output

This is a short series describing some Bash constructs that I frequently use in my scripts.

On Linux (and many other operating systems) it's common to have regular and error output written to stdout and stderr respectively. In shell scripts you'd use the echo or printf commands for displaying messages, and redirect stdout to stderr for having the message displayed on stderr.

echo 'foo'       # output goes to stdout
echo 'bar' 1>&2  # output goes to stderr

There may be different levels of information that you want to separate from each other, though, like having additional debug output that you don't want to pollute stdout or stderr. For that you can use the file descriptors 3 through 9.

See more ...

Posted 15:22 [permalink]

2020-02-24

Shell Patterns (1) - Logging

This is a short series describing some Bash constructs that I frequently use in my scripts.

What do you do when you run fully automated scripts in the background, but still want to keep track of what they're doing and, more importantly, when something goes wrong? The answer is, of course, you log what the script is doing (or is about to do).

There are two commonly used ways of implementing logging in Bash scripts:

Personally, I prefer the latter, since it allows not only for managing log files independently of the process creating the log output, but also for filtering log data and/or forwarding it to a central loghost.

See more ...

Posted 20:47 [permalink]

2017-09-29

LXD upgrade fails on Ubuntu 16.04 without Systemd

Recently I tried to install LXD (Canonical's container manager) from backports on a Ubuntu 16.04 system (running without Systemd). The version shipping with the system (2.0) doesn't suffice, because I need the new storage API that was introduced with LXD 2.15. However, upgrading to the backports package failed post-install:

invoke-rc.d: initscript lxd, action "start" failed.
dpkg: error processing package lxd (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
 lxd
E: Sub-process /usr/bin/dpkg returned an error code (1)

Which was weird, since the upgrade had worked for me before.

See more ...

Posted 13:57 [permalink]

2016-09-01

Forwarding JVM Garbage Collector Logs

Recently I was tasked with forwarding logs to a central log server - in this case JVM garbage collector logs from Solr instances. Normally not a big deal. Configure log rotation (to avoid filling the disk), then have rsyslog read the active log file via an imfile input.

Sounds simple, right? Until you realize that JVM log rotation marks the active log with the extension .current and rotates that extension instead of actually rotating the logs.

See more ...

Posted 23:23 [permalink]

2015-06-14

Querying DB2 Backups in TSM Fails with Return Code 106

On one of my servers a query for DB2 backups in TSM (db2adutl query full db DBNAME) failed with the following error:

Error: Initialize environment failed with TSM return code 106

As per dsmrc.h return code 106 indicates a permission problem:

#define DSM_RC_ACCESS_DENIED       106 /* denied due to improper permission */

which was weird, since the user in question is a member of the DB2ADMNS group that is supposed to have all required permissions.

See more ...

Posted 23:39 [permalink]

2015-03-12

Repairing a Suspect msdb Database

Sometimes a situation arises where an SQL Server instance comes back up with a database tagged as "suspect". Apparently there is a number of possible causes for this, like transaction log corruption, insufficient memory or disk space, or unexpected shutdowns due to hardware or power failure. In our case the reason was probably a hardware failure, since the database resides on an iSCSI volume, and we were making changes to our iSCSI network. And to make things a little bit more interesting, our msdb database just had to be among the affected databases.

See more ...

Posted 19:07 [permalink]

2014-06-07

Translate VBA to VBScript

Since I'm seeing lots of questions like "how can I do FOO in Excel/Word/... with VBScript" I thought I'd post some guidelines on how to approach this kind of task.

In general, VBA and VBScript are quite similar, so most of the time you're better off recording a VBA macro and translate that to VBScript than writing the whole thing in VBScript from the get go. There are some notable differences between the two languages, though, which you need to observe when translating VBA to VBScript.

See more ...

Posted 15:26 [permalink]

2014-03-26

Cleanup of DB2 Backups Fails with Return Code 136

Recently I encountered a rather weird problem with the cleanup of backups of some of our DB2 databases. The database backups are done via TSM by running the following command:

db2 "backup db DBNAME online use tsm"

Cleanup of obsolete backups is done by running the following commands via a scheduled task.

db2adutl delete full older than TIMESTAMP db DBNAME without prompting
db2adutl delete logs between S0000000.LOG and S(xxxxxxx-1).LOG db DBNAME without prompting
db2 "connect to DBNAME"
db2 "prune history DATE and delete"
db2 "prune logfile prior to Sxxxxxxx.LOG"
db2 "connect reset"

Sxxxxxxx.LOG is the oldest log of the oldest backup to be kept, which is extracted from the output of db2adutl query full db DBNAME. S(xxxxxxx-1).LOG is that log number minus one.

Although this setup had been working for several years without problems and no changes were made to the system, the log cleanup step suddenly started to fail for some databases while it still worked fine for the others.

See more ...

Posted 21:10 [permalink]

2013-03-12

TSM BA Client 6.4 on Debian

Although IBM doesn't officially support its TSM client on Linux distributions other than SLES and RHEL the client works quite nicely on Debian. With version 6.4 you need at least the following 4 packages on AMD64 systems:

  • TIVsm-BA
  • TIVsm-API64
  • gskcrypt64
  • gskssl64

See more ...

Posted 00:46 [permalink]

2011-03-13

A Logger Class for VBScript

I got tired of having to re-implement logging routines for my VBScripts on a regular basis, so I wrote a logger class that serves as an abstraction layer for logging to interactive console/desktop, files or eventlog. Now I just instantiate a new logger, define the logging facilities (default is console/desktop for interactive, eventlog for non-interactive execution), and can log away with the same set of methods, regardless of log target. See API documentation for details.

See more ...

Posted 22:10 [permalink]

2008-10-13

How to Beat Windows Software into Submission

A great deal of Windows software requires to be run with administrative or at least power user privileges for no good reason. That's a Bad Thing™, because it enables any user to compromise the system. Most of this software can, however, be talked into running with a normal user's privileges. The problem is usually that the program attempts to write temporary data, configuration data and other stuff like that to places a normal user can't write to. In this article I will describe the procedure I usually apply when having to deal with reluctant software.

See more ...

Posted 11:27 [permalink]

2005-02-27

Multiboot

Dual-booting Windows 9x and Windows 2000
(Windows 2000 installed first)

Let's say you would like to install Windows 9x and Windows 2000 on the same computer and make the system dual-boot. What would be the right order to install the operating systems?

Microsoft suggests to install Windows 9x first and Windows 2000 afterwards. Although this is the easy way I suggest not to do so. The procedure will install the bootloader on the Windows 9x partition where it cannot be protected by NTFS ACLs (the FAT filesystems do not support permissions). Maybe you have heard that installing Windows 9x first was the only possibility to dual-boot Windows 9x and 2000. Rest assured that's nothing but an urban legend. It is possible, although not as simple as the other way.

See more ...

Posted 12:49 [permalink]