bc-bd.org

Not a blog

Debian Jessie, Systemd and LVM Mount Failure

Is your Debian Jessie dropping you into an emergency shell on boot due to LVM mount problems? Check that your /etc/udev/rules.d/70-persistent-net.rules is valid. Also look at ip l to see if you have no interface called rename[0-9].

Raspbian, Icinga2 and Illegal Instruction

While installing icinga2 from debmon.org on a Raspberry Pi 1 running Raspbian I was getting:

Job for icinga2.service failed. See 'systemctl status icinga2.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript icinga2, action "start" failed.
Jan 26 15:16:01 pi1 prepare-dirs[3995]: Could not fetch RunAsUser variable.  Error ''. Exiting.

When running the icinga2 binary directly I got

Illegal instruction

Turns out Raspbian’s armhf is not quite armhf. Luckily I had a Raspberry Pi 2 available and with the help of rpi23-gen-image I could create a Jessie image and install icinga2.

Grub-mount Eating All the RAM

While updating from Debian wheezy to jessie, one installation hung with grub-mount using all RAM and SWAP until it got OOM killed. Disabling the grub os prober part helped.

Roundcube, Connection to Storage Server Failed

Using imaps and getting:

Could not connect to ssl://localhost:993: Unknown reason in
/usr/share/roundcube/program/lib/Roundcube/rcube_imap.php

check that your configured servername matches the certificate’s cn.

Hiera, Puppet and Invalid Yaml Files

If you are running into this error:

Error: Could not run: undefined method `[]' for false:FalseClass

one of your yaml files in hiera is invalid, maybe empty.

Windows 7 SP 1 Not Updating

Windows 7 SP 1 fresh installed and not updating? svchost stuck at 100% CPU? PC-WELT-Fix Windows Update not helping? WSUS Offline Update not working?

This HOWTO from skanthak worked for me:

[...] Download at least the last cumulative (security) update package for Internet
Explorer 8, 3124275 alias MS16-001, and the latest (security) update package for
the Windows Update Client, currently (September 20, 2016) 3161647; the latter is
available only as part of the "July 2016" (optional) update rollup package
3172605. [...]

Firefox, Flash, HTML5 and Sound via HDMI Subdevice

# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: HDMI [HDA Intel HDMI], device 3: HDMI 0 [HDMI 0]
  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: ALC671 Analog [ALC671 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

/etc/asound.conf

pcm.dmixer {
    type dmix
    ipc_key 1024
    ipc_key_add_uid false
    ipc_perm 0660
    slave {
        pcm "hw:0,7"
        rate 48000
        channels 2
        period_time 0
        period_size 1024
        buffer_time 0
        buffer_size 4096
    }
}

pcm.!default {
    type plug
    slave.pcm "dmixer"
}

Wget, Gems, Puppetserver Proxies and Authentication

When using wget with a proxy that requires authentication, special characters need to be URI encoded, e.g. # becomes %23. Using for example pa##word:

https_proxy='http://username:pa%23%23word@proxy:8080' wget https://google.com

On top of that when using gem the colon seperator between the username and pasword needs to be escaped, e.g. \::

http_proxy='http://username\:pa%23%23word@proxy:8080' gem fetch hiera-eyaml

Also note, gem will use the http_proxy environemt variable even if it is connecting to a https:// url.

But when using gem from a puppetlabs installation, e.g. /opt/puppetlabs/puppet/bin/gem, you must not escape the colon, but use HTTP_PROXY.

When installing gems into puppetserver 4, pass -p to gem install:

puppetserver gem install -p http://username\:pa%23%23word@proxy:8080 hiera-eyaml

Puppet Here

Tired of typing puppet://$server/module/$module/...? Here to the rescue:

module Puppet::Parser::Functions
    newfunction(:here, :type => :rvalue) do |args|
        "puppet://%s/modules/%s/%s" % [ lookupvar('servername'), lookupvar('module_name'), args[0] ]
    end
end

Put it in $module/lib/puppet/parser/functions/here.rb, use with:

file {
    ensure => ...
    ...
    source => here('foo.txt');
}

Raspberry Pi PXE Boot With Uboot and Root on NFS

Following this RPi U-Boot Howto.

I setup a cross compile chroot to build u-boot for my Raspberry 1:

sudo debootstrap sid sid
sudo chroot sid
dpkg --add-architecture armhf
apt-get update
apt install git-core gcc-arm-linux-gnueabi
cd /tmp
git clone git://git.denx.de/u-boot.git
cd u-boot
export CROSS_COMPILE=arm-linux-gnueabi-
make rpi_defconfig
make -j5 -s

Download the latest Jessie Lite Image and wrote it to my SDCARD (/dev/sdb in my case):

cd /tmp

wget https://downloads.raspberrypi.org/raspbian_lite_latest -O raspbian_lite_latest.zip
unzip raspbian_lite_latest.zip
dd if=2016-05-27-raspbian-jessie-lite.img of=/dev/sdb bs=1M

Setup NFS root, copy the Kernel to the tftproot and install u-boot:

cd /tmp
mkdir pi

mount /dev/sdb2 pi
mount /dev/sdb1 pi/boot

mkdir  /var/lib/tftpboot/pi
cp pi/boot/kernel.img /var/lib/tftpboot/pi/zImage
cp pi/boot/*.dtb /var/lib/tftpboot/pi/

mv pi/boot/kernel.img{,.old}
cp /tmp/sid/tmp/u-boot/uboot.bin pi/kernel.img

cp -a pi /mnt

umount pi/boot
umount pi

Setup NFS export:

/mnt/pi         10.0.0.1(rw,no_root_squash,async,no_subtree_check)

Configure dhcp:

host pi1 {
    hardware ethernet TH:AT:IS:MY:MA:C0;
    fixed-address 10.0.0.1;
    filename "/pi/boot.scr.uimg";
    option root-path "/mnt/pi";
}

Create the boot script that actually loads and boots the kernel /var/lib/tftpboot/pi/boot.scr:

setenv fdtfile /pi/bcm2708-rpi-b.dtb
setenv tftpblocksize 1024

usb start
tftp ${kernel_addr_r} /pi/zImage
tftp ${fdt_addr_r} ${fdtfile}

setenv bootargs earlyprintk console=ttyAMA0 console=tty1 ip=dhcp root=/dev/nfs rootwait smsc95xx.macaddr=TH:AT:IS:MY:MA:C0

bootz ${kernel_addr_r} - ${fdt_addr_r}

I needed to set my MAC as it would generate a new one on every boot.

Convert boot script to something u-boot can handle:

cd /var/lib/tftpboot/pi
mkimage -A arm -O linux -T script -C none -n boot.scr -d boot.scr boot.scr.uimg

Boot the Pi, interrupt u-boot and setup it’s environment:

setenv bootcmd 'dhcp; source ${fileaddr}'
saveenv
reset

I havn’t found a way to set config.txt options though.