CentOS 7: failed to open \efi\centos\grubx64.efi

For some reason one of my CentOS 7 boxes decided to nuke itself yesterday, when I powered it on it prompted me with the following error: “failed to open \efi\centos\grubx64.efi”. What I did to fix it is: Boot up a rescue USB, mount the required partitions and chroot. Add a DNS server: $ echo "nameserver *.*.*.*" >> /etc/resolv.conf Enable networking using ifconfig (in my case it was already enabled). Install some additional grub2 modules: $ yum install grub2-efi-modules Reinstall grub, read “/etc/fstab” or “lsblk” command to find it: $ /sbin/grub2-install /dev/boot/partition Reinstall grub: $ yum reinstall grub-efi shim Rebuild grub. …

Posted on

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

Nginx, PHP-FPM, SELinux and sendmail

Since I am a real master at forgiving things I am writing this one down. PHP mail function relies on sendmail but SELinux by default block webservers from sending emails, the usual error that pop-out is: cat /var/log/maillog"> --- sendmail[16328]: NOQUEUE: SYSERR(nginx): /etc/mail/sendmail.cf: line 0: cannot open: Permission denied Allow webservers to send email is as easy as editing the appropriate SELinux boolean: setsebool -P httpd_can_sendmail 1 Use sestatus to check SELinux booleans: …

Posted on

Zabbix and XMPP alerts

Zabbix should theoretically be able out of the box to send alerts via XMPP. For some reason this functionality does not work as intended, luckily it is possible to specify a custom script to send alerts; combining the aforementioned script with the Perl library sendxmpp is the easiest way to enable Zabbix from sending notifications via XMPP. $ yum install sendxmpp Create a bash script, this will be invoked by Zabbix to send notifications: …

Posted on

Zabbix server on CentOS 7 and SELinux

Zabbix is an open source resource and network monitoring system, more info: zabbix.com. The official wiki is missing some important bits regarding the installation of the tool on CentOS 7 systems. First of all, let’s add Zabbix repository and then proceed to with the installation of Zabbix and some required dependecies: $ rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm $ yum install mariadb mariadb-server httpd zabbix-server-mysql zabbix-web-mysql setroubleshoot Configure MariaDB Login to MariaDB shell, change root’s password, create a new database for Zabbix and add a new user: …

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

Ejabberd HTTP File Upload (XEP-0363)

XMPP module HTTP File Upload (formerly XEP-0363) provides a way to share files between XMPP clients, it works transparently and even in multi user chats. The sender uploads a file on an HTTP(S) server that will then generate an URI, this is sent to each one of the recipients that can then download it. The interesting bits about this XEP are various: File sharing now works even in multi-user chats (MUC), in any case the file is only uploaded a single time even if the recipients are more than one. …

Posted on