Configure apcupsd on CentOS

Apcupsd is a powerful daemon that can be used to manage APC UPS, add epel repositories and run: $ yum install apcupsd To configure apcupsd edit the following file: cat /etc/apcupsd/apcupsd.conf" --- ## apcupsd.conf v1.1 ## # # for apcupsd release 3.14.14 (31 May 2016) - redhat # # "apcupsd" POSIX config file # # Note that the apcupsd daemon must be restarted in order for changes to # this configuration file to become active. …

Posted on

APC UPS and HP server gen8 not restarting automatically when power goes back online after shutdown procedure is already starded but not completed

I have got my hands on an APC UPS and some HP gen8 server, installed apcupsd on CentOS 7, connected the USB cable and everything was working fine except for this very annoying issue I had: * power goes down (pull the UPS power cord). after some minutes the UPS battery threshold is triggered and the server shutdown procedure is launched by apcupsd. power goes back up (plug in the power cord) while the server is already shutting down but the shutdown sequence is not yet completed. …

Posted on

OpenVPN: tun tap invalid argument (code=22)

After upgrading my OpenVPN server to CentOS 7.5 I had trouble connecting to it. Specifically, I had two different issues: ** the laptop, which is running Fedora 28, was able to connect just fine but DNS resolution was broken. ** OpenVPN for Android was also connecting just fine but reporting a weird error: OpenVPN: tun tap invalid argument (code=22). The first one was caused by me because after the CentOS upgrade procedure was completed I also run yum autoremove which deleted dnsmasq; the solution was fairly simple, reinstall and reconfigure dnsmasq. …

Posted on

Self hosting Firefox Sync on CentOS 7

Configuring this piece of poorly documented bloated shit Mozilla came up with was a huge pain in the ass, so excuse the colored language but I am fucking pissed. The idea was to finally implement a system to synchronize Firefox’s bookmarks across multiple devices without giving Mozilla all my personal data. After some minutes spent researching the subject on the interweb I found out the synchronization system is a huge clusterfuck comprised of multiple components: …

Posted on

CentOS and yum - Error: rpmdb open failed

Today I had Ansible reporting an error on one of my CentOS machines while performing the usual upgrade procedure. I SSH’d into the host to check what was wrong and run yum clean all && yum update manually just to be greeted with the following error: rpmdb: PANIC: fatal region error detected; run recovery error: db3 error(-30974) from dbenv->open: DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db3 - (-30974) error: cannot open Packages database in /var/lib/rpm CRITICAL:yum. …

Posted on

NFS on Fedora

NFS allows to share files and folders over network and is much much faster than samba while using way less resources. To setup a NFS server on Fedora 26 install: $ dnf install nfs-utils Shared directories are listed in the following configuration file: --- # Syntax # <path> <ipaddr>(<option>) /home/user/Public 192.168.0.0/255.255.255.0(ro,sync) More information can be found here: Fedora NFS administration guide. In the above example, the the directory ‘/home/user/Public’ can be accessed by every client in the same LAN with read-only permissions. …

Posted on

Monitor hard disk health status with smartd on Linux

This does not really works, read this: https://uwot.eu/monitor-hard-disk-smart-status-in-python/ First of all install smartmontools, it has the same name on pretty much every distro: $ emerge -a1 smartmontools Proceed to edit its configuration file, at the bottom of the file there is a quick explaination of all the available parameters: cat/etc/smartd.conf --- DEVICESCAN -H -R 1 -R 5 -R 7 -R 10 -R 11 -R 196 -R 197 -R 199 -R 200 -m user@domain. …

Posted on

mdadm RAID on Linux

Every time I have to setup a software RAID in Linux using mdadm I forget something, this time I am writing it down once and for all (or at least I hope so). For the sake of simplicity I will use the creation of a RAID1 as example but this very same procedure can be applied for any other kind of RAID. RAID array creation 1. Partition the drives This step must be repeated for each drive of the array (/dev/sdb and /dev/sdc in my case). …

Posted on