Author: Joar Jegleim

puppet 2.7.x complaining about “err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse YAML data for node”

You’ll probably find numerous links that tell you to delete

/var/lib/puppet/yaml/[fqdn].yaml

in puppetmaster, node or both.

None of those solved my problem.

Upgradeing to puppet-2.7.25 didn’t help either .

On my puppet client, in /var/lib/puppet deleting

rm -fr state/ lib/ facts/ client*

at least let me run puppet again, but next run gives that 400 error again …

note to self: get back to this post when I get time to further debugging this really annoying issue

tcpdump tip

As I was debugging an issue at work related to http headers being forwarded by haproxy I used a couple tcpdump commands that was great, storing here for future reference .

tcpdump -s 1024 -l -A | grep X-Forwarded-For

tcpdump -s 1024 -l -A src 192.168.9.56 or dst 192.168.9.56

First one will print lines containing X-Forwarded-For, second one let you filter on src and/or destination .
Note that tcpdump by default does not include 127.0.0.1 or ::1 ( lo ) .

Terminate PostgreSQL clients from the db you’re about to drop

For PostgreSQL 9.1 and below

SELECT pg_terminate_backend(pg_stat_activity.procpid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'TARGET_DB'
  AND procpid <> pg_backend_pid();

For PostgreSQL 9.2 and above

SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'TARGET_DB'
  AND pid <> pg_backend_pid();

Totally ripped from stackoverflow.com .

Kept here for my personal future reference .
If you stumble over this post please check the stackoverflow link above .

CentOS 7 dhcp + custom ‘search domain’

I’m running CentOS 7 on my workstation these days, like it a lot.
At work our dhcp setup dns search for the domain containing our windows hosts but the Unix and Linux hosts I work with are in an other domain.
In the network manager gui in gnome3 I can’t seem to figure out where to add this second search domain, so I’ve been adding it manually to resolv.conf after each boot …

Got tired of that so i added:

DOMAIN='myDomain.no'

in /etc/sysconfig/network-scripts/ifcfg-eno1 and did a

systemctl restart network.service

problem solved.

thnx superuser.com

UPDATE 30th october 2015:
This does not work at all at my workstation at my new job.
I’m not using NetworkManager any more, not sure if that’s the reason though.

By setting SEARCH in /etc/sysconfig/network instead things got a lot better:

# /etc/sysconfig/network
SEARCH='example.com sub.example.com'

View changelog for a package in Fedora/CentOS/Redhat

A really cool, and handy, feature of rpm is the ability to view the changelog for a package you’ve installed, or recently updated:

$ rpm -q --changelog gnome-shell | less

* Wed Apr 16 2014 Florian Müllner <fmuellner@redhat.com> - 3.8.4-32
- Improve vertical monitor layouts
  Resolves: rhbz#1096186

* Wed Mar 19 2014 Florian Müllner <fmuellner@redhat.com> - 3.8.4-31
- Fix some more background memory leaks
  Resolves: rhbz#1027192

* Wed Mar 12 2014 Ray Strode <rstrode@redhat.com> 3.8.4-30
- Fix automatic shield lifting when smartcard is inserted
  Resolves: #1063488

* Mon Mar 10 2014 Ray Strode <rstrode@redhat.com> 3.8.4-29
- Don't show user list if require smartcard is true
  Resolves: #1063390

Enable touchpad in gdm3 login prompt (Fedora 20)

Enabling tapping support in Gnome 3, I still don’t have support for that at the gdm 3 login prompt .

In /etc/X11/xorg.conf.d/50-synaptics.conf I got tapping support for my mousepad at the gdm3 login prompt by adding

Section "InputClass"
Identifier "touchpad catchall"
Driver "synaptics"
MatchIsTouchpad "on"
Option "TapButton1" "1"
Option "TapButton2" "2"
Option "TapButton3" "3"
EndSection

The file wasn’t there, so I created it.

Thnx jaisejames.wordpress.com

Fedora (20) enable tuned, save power

I noticed by switching to Fedora, from Ubuntu, my battery time got lower.
I suspect Fedora isn’t as laptop friendly out of the box as Ubuntu is .

Installing Tuned helped a lot on power consumption for my laptop:

$ sudo yum install tuned
$ sudo systemctl enable tuned.service
$ sudo systemctl start tuned.service
$ sudo tuned-adm active

There seem to be a debate whether powersave og balanced is the best option .

Nvidia brightness control fix

If you, like me, got an Nvidia graphics card in your laptop you may have problems with brightness control with recent Nvidia (proprietary) drivers .
First time I came over this is more than a year ago, back then I lost brightness control after upgrading from Nvidia 304.x to anything newer.
Since the working 304.x driver was available then, in my Ubuntu 13.04 (and later 13.10) I never sat down figuring it out.

I recently switched back to Fedora, and they’ve got the same problem.
In Fedora I was also unable to control brightness with the 304 driver as well, I suspect recent versions of the 304.[something above 100] also brake, or there is some combination of Linux kernel version, Nvidia driver version and mabye something else .

There are loads of posts regarding brightness control that brakes, and as far as I can see there are more than one type of problem, f.example I see a lot of fixes that seem to be related to Nvidia Optimus but those solutions doesn’t work for my Quadro 1000m .

Here’s what fixed it for me.

Download nvidiabl from https://github.com/guillaumezin/nvidiabl

$ unzip nvidiabl-master
$ cd nvidiabl-master
$ sudo yum install dkms
$ cd install/tarball/
$ sudo dkms ldtarball --archive=nvidiabl-0.87-source-only.dkms.tar.gz build install
$ sudo echo nvidiabl > /etc/modules-load.d/nvidiabl.conf

That last line will ensure the nvidiabl module is loaded upon booting Fedora .

Now you got a module that you can use a script to echo brightness values into some file in /sys, but you can take this a step further:

(open /etc/default/grub in your favorite editor and append to the GRUB_CMDLINE_LINUX line)
GRUB_CMDLINE_LINUX="[...] acpi_backlight=vendor [...]
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg

the acpi_backlight=vendor tells Linux to skip using acpi for brightness and that put nvidiabl in ‘charge’ as the only brightness control module under /sys/class/backlight/ , and in my Fedora 20 running Gnome 3 that magically made brightness control work as it’s supposed to again .

Note that I’ve also got this /etc/X11/xorg.conf

# RPM Fusion - nvidia-xorg.conf
#
Section "Device"
        Identifier  "Videocard0"
        Driver      "nvidia"
        Option "RegistryDwords" "EnableBrightnessControl=1"
        Option          "NoLogo"
EndSection

In my setup with the current nvidiabl module it kind of brakes after suspend / resume, some suspend / resume script fail to set /sys/class/backlight/nvidia_backlight/actual_brightnessto archlinux.org where I found out about acpi_backlight=vendor .

And I’ll paste some of the links I’ve been at regarding this problem, but there are numerous others that I don’t recall at the moment:

https://lists.fedoraproject.org/pipermail/power-management/2013-March/000092.html
https://devtalk.nvidia.com/default/topic/539462/-nvidia-319-12-brightness-controls-not-working-on-laptop-ubuntu-13-03-/?offset=23
https://forums.opensuse.org/showthread.php/494532-Brightness-doesn-t-change-on-openSUSE-13-1-Nvidia-quadro/page2