Montag, 4. Januar 2016

Nagios Core 4 service failed on CentOS 7 (EPEL release)

Just a quick post to fix problems with Nagios Core 4 service under CentOS 7.

After installing Nagios Core 4 and making some basic configurations the service cannot be started on CentOS 7.

Full description of the Nagios service:

Name : nagios
Arch : x86_64
Version : 4.0.8
Release : 1.el7

CentOS Linux release 7.2.1511 (Core), yum packages updated today on January 4th, 2016.


Running the nagios.service gives the following error:

systemctl status nagios
● nagios.service - Nagios Network Monitoring
Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2016-01-04 09:32:45 EST; 7min ago
Docs: http://www.nagios.org/documentation
Process: 10738 ExecStart=/usr/sbin/nagios /etc/nagios/nagios.cfg (code=exited, status=1/FAILURE)
Process: 10736 ExecStartPre=/usr/sbin/nagios -v /etc/nagios/nagios.cfg (code=exited, status=0/SUCCESS)
Main PID: 10738 (code=exited, status=1/FAILURE)

Jan 04 09:32:45 localhost.localdomain systemd[1]: Starting Nagios Network Monitoring...
Jan 04 09:32:45 localhost.localdomain systemd[1]: Started Nagios Network Monitoring.
Jan 04 09:32:45 localhost.localdomain systemd[1]: nagios.service: main process exited, code=exited, status=1/FAILURE
Jan 04 09:32:45 localhost.localdomain systemd[1]: Unit nagios.service entered failed state.
Jan 04 09:32:45 localhost.localdomain systemd[1]: nagios.service failed.

Reviewing journalctl I can nail down the problem to:

Jan 04 09:41:25 localhost.localdomain nagios[11123]: Nagios 4.0.8 starting... (PID=11123)
Jan 04 09:41:25 localhost.localdomain nagios[11123]: Local time is Mon Jan 04 09:41:25 EST 2016
Jan 04 09:41:25 localhost.localdomain nagios[11123]: qh: Failed to init socket '/var/log/nagios/rw/nagios.qh'. bind() failed: No such file or directory
Jan 04 09:41:25 localhost.localdomain nagios[11123]: Error: Failed to initialize query handler. Aborting

Doing an Internet search got me to the following solution:
bugzilla.redhat.com

Here is my detailed steps on how to fix this:

What happened?
Currently Nagios EPEL version 4.0.8 refuses to start because it cannot create and access its standard socket file located at /var/log/nagios/rw/nagios.qh due to some missing Nagios SELinux policy rule on CentOS 7.

This should be fixed soon (nagios-4.0.8-2.el7 ?) but until then we need to build our own local Nagios Policy module fix:

Open the following file vi /tmp/nagios-socket.te and put in the following content:
module nagios-socket 1.0;
require {
type nagios_t;
type nagios_log_t;
class sock_file { write create unlink };
class unix_stream_socket connectto;
}
allow nagios_t nagios_log_t:sock_file { write create unlink };
allow nagios_t self:unix_stream_socket connectto;

Afterwards install the policycoreutils-python YUM package if not available already on your system and type the following commands to compile, build and install the new local Nagios policy module before restarting Nagios – which should work afterwards:
yum install policycoreutils-python -y
cd /tmp;checkmodule -M -m -o nagios-socket.mod nagios-socket.te
semodule_package -o nagios-socket.pp -m nagios-socket.mod
semodule -i nagios-socket.pp
install -d -m 755 -o nagios -g nagios /var/log/nagios/rw
systemctl restart nagios && systemctl status nagios

Done!

Donnerstag, 2. Juli 2015

Installing TSM Tivoli Client 6.4 or 7.1 on RHEL7 / CentOS 7 with Failed dependencies: libc.so.6 is needed

Today I got a problems installing TSM Tivoli Client 6.4 and also 7.1 on CentOS 7.
Commands I run
rpm -Uhv gskcrypt64-8.0.14.14.linux.x86_64.rpm
rpm -Uhv gskssl64-8.0.14.14.linux.x86_64.rpm
rpm -Uhv TIVsm-API64.x86_64.rpm
doing than
rpm -Uhv TIVsm-APIcit.x86_64.rpm

gives error message
error: Failed dependencies:
libc.so.6 is needed by TIVsm-APIcit-6.4.0-0.x86_64
libc.so.6(GLIBC_2.0) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libc.so.6(GLIBC_2.1) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libc.so.6(GLIBC_2.1.3) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libc.so.6(GLIBC_2.2) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libc.so.6(GLIBC_2.3) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libc.so.6(GLIBC_2.3.2) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libdl.so.2 is needed by TIVsm-APIcit-6.4.0-0.x86_64
libdl.so.2(GLIBC_2.0) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libdl.so.2(GLIBC_2.1) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libgcc_s.so.1 is needed by TIVsm-APIcit-6.4.0-0.x86_64
libgcc_s.so.1(GCC_3.0) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libgcc_s.so.1(GLIBC_2.0) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libm.so.6 is needed by TIVsm-APIcit-6.4.0-0.x86_64
libnsl.so.1 is needed by TIVsm-APIcit-6.4.0-0.x86_64
libpthread.so.0 is needed by TIVsm-APIcit-6.4.0-0.x86_64
libpthread.so.0(GLIBC_2.0) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libpthread.so.0(GLIBC_2.1) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libpthread.so.0(GLIBC_2.2) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libpthread.so.0(GLIBC_2.3.2) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libstdc++.so.5 is needed by TIVsm-APIcit-6.4.0-0.x86_64
libstdc++.so.5(CXXABI_1.2) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libstdc++.so.5(GLIBCPP_3.2) is needed by TIVsm-APIcit-6.4.0-0.x86_64
libstdc++.so.5(GLIBCPP_3.2.2) is needed by TIVsm-APIcit-6.4.0-0.x86_64
and after resolving first error I got
libgcc_s.so.1 is needed
...
and than I got
libstdc++.so.5 is needed
...
this also is true for trying tsm tivoli 7.1 client version
Solution was to install missing Linux 32-bit libraries [1] as tsm relies on them
yum install libgcc.i686
yum install libstdc++.i686
yum install compat-libstdc++-33-3.2.3-72.el7.i686


sources
[1] http://www-01.ibm.com/support/docview.wss?uid=swg21608859

Montag, 29. Juni 2015

Fixing installation errors for installing CentOS 7 on Mac Mini 2011 with USB media

This morning I tried to install CentOS7 on an Apple MacMini from 2011 with a USB stick. After grub and the initram fs has been loading there was the following error
dracut-initqueue[639]: Warning: Could not boot. dracut-initqueue[639]: Warning: /dev/root does not exist. Starting Dracut Emergency shell.
This error often occurs by a mismatched usb media label and can easily be resolved by using UUID instead of label in grub2 initram fs kernel arguments [1].

The following steps have been taken form unix stackexchange on how to fix this:

1. starting from the Dracut Emergency shell, find out which device name is your installation usb stick.
2. get the uuid for this device name, write it down.
3. reboot and replace grub2 initram fs kernel arguments from using LABEL to UUID.
The exact procedure can be found here

4. start the installation with the changed kernel arguments, this is a bit tricky because running a changed grub2 command line needs the keyboard combination ctrl-x which does not work on a mac computer [2].
This also does not work when using a PC keyboard on this mac.
Solution was to use a PC keyboard and type F10 instead of CTRL-X work the same on mac to run a changed command line. I tried pressing F10 on a mac keyboard (fn+F10 key) but did not work.
But using a PC keyboard on the mac and hitting F10 worked and booted up the graphical installer.



sources:
[1] http://unix.stackexchange.com/a/209515
[2] https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/722950

Montag, 11. Mai 2015

Resolving DRBD error lk_bdev_save (/var/lib/drbd/drbd-minor-0.lkbd) failed: No such file or directory on centos 7 system

Hi everyone! Just a small post here because I have not found anything about this error on the web (at least not on a english-speaking website ;) ) I recently installed and configured drbd on a centos 7 machine. drbdadm came in version 8.9.2 (api:1) GIT-hash: de9236084d57a09160b366e5fdf5b481c5cc163d build by mockbuild@, 2015-04-10 06:40:59 when I tried to create my resource I got the following error
$drbdadm create-md drbd01
error msg:
initializing activity log
NOT initializing bitmap
Writing meta data...
lk_bdev_save(/var/lib/drbd/drbd-minor-0.lkbd) failed: No such file or directory
New drbd meta data block successfully created.
lk_bdev_save(/var/lib/drbd/drbd-minor-0.lkbd) failed: No such file or directory
searching the internet I found nothing about it so I just looked at the error and resolved it using
mkdir /var/lib/drbd/
I think the rpm package from ELRepo I installed just missed that command. Hope this helps anyone

Mittwoch, 13. August 2014

How to install Ubuntu 14.04 on an old Macbook 2.1 EFI.

UPDATE on 13/3/2015: this instruction method is no longer valid for newer Ubuntu versions > 14.04 (e.g. 14.10)! I will write a follow up soon on this you can find here. There are lots of instructions and tutorials out there on how to install Ubuntu on Mac computers. Most dont work as stated (mostly because it is not easy to make a bootable ubuntu usb boot stick with a mac), so I wrote this tutorial which I think is the most easy one out there!

This post is basically just a short reminder for myself on how to install Ubuntu 14.04 on Macbook 2.1 EFI. Maybe it is useful for other people as well.

Requirement/Prequesites:

Macbook with Mac Os X >=10.6, the full harddisk is occupied by Mac Os X.

1. start Mac Os X, open Disk utility, shrink Mac Os X partition so much that you can create another two partitions, one for Linux root with at least 30 gb and another one for swap, rule of thumb: available RAM memory equals two. For me it was 2 gb * 2 = 4 gb. Choose Mac Os X journaling as filesystem for the new two partitions.
2. After partitioning you should now have three partitions, my setup was 65 gb total (SSD): 30 gb for Mac Os X, 30 gb for Linux (root paritions), 4 gb for the swap partition
3. Install rEFIt, power off computer (do not just restart) to see if rEFIt logo is booting up, if not try again powering off.
4. Boot back into Mac Os X and download Ubuntu 14.04 64 bit AMD for Mac ISO
5. download ISO2USB-Efi-Loader and prepare an USB stick with the ISO from step 3 (details here: here (in german) use the boot64bit efi file on the stick. Use google translate if you cannot understand German.
6. reboot and use the Mac ´ALT´ key during startup and choose the usb-efi stick
7. install ubuntu, choose ´something else´ as the installation type, then use the linux root partition from step 1. (mine is called /dev/sda4) and format it as ext4 and select root (/). Also define the swap partition from step 1. Most importantly in this step is to select the root parititon for the boot loader (e.g. /dev/sda4) but never NEVER use the whole disk for installation of it!!! (never use the full disk e.g. /dev/sda use a partition e.g. /dev/sda4)
8. at the end of the installation the installer says it cant install the bootloader at /dev/sda4, click on ´ignore this and continue installation´ (dont install on /dev/sda - the full disk etc.)
9. after successfully install ubuntu, click on ´test live system´
10. prepare a boot-repair-disk on your usb stick, install boot-repair as stated here (on a usb stick!, you can download the iso and use it similar to step 5 here), reboot and start the stick than click on ´Recommended repair´
11. done! reboot. now a tux symbol will appear at the rEFIt boot menue. Click on it to start ubuntu!

Dienstag, 11. Februar 2014

Fixing package installation problems 'failed to install' in Architect (architect 0.9.3-10) under Ubuntu 12.04

Fixing package installation problems 'failed to install' in Architect 0.9.3-10 under Ubuntu 12.04

for a project I needed "trace into debugging" functionalities in R so I installed the architect 0.9.3-10 deb package within Ubuntu 12.04 using the following instruction which is a standalone eclipse built using the StatEt plugin

started the program, switched in the Embedded R.3.0.2 console typed

source("http://bioconductor.org/biocLite.R") 
to install some additional packages I needed for debugging a specific project

got following error

The downloaded source packages are in
 ‘/tmp/RtmpU46P2P/downloaded_packages’
'biocLite.R' failed to install 'BiocInstaller', use
  'install.packages("BiocInstaller",
  repos="http://www.bioconductor.org/packages/2.13/bioc")'
Warning message:
In install.packages("BiocInstaller", repos = a["BioCsoft", "URL"]) :
  installation of package ‘BiocInstaller’ had non-zero exit status

also tried out the suggested install.packages("BiocInstaller",repos="http://www.bioconductor.org/packages/2.13/bioc") which did not work either

someone suggested that the solution is running R in administrative mode in order to install packages, so I wrote down the R_HOME path from within R

 > R.home()
[1] "/opt/architect/stable/20131204221312/plugins/eu.openanalytics.architect.r.server.gtk.linux.x86_64_0.9.3.201310150807/R"

open a terminal and login as root

$ sudo su
# set R path  extracted from R (R.home()) for convenience 
$ export MY_R="/opt/architect/stable/20131204221312/plugins/eu.openanalytics.architect.r.server.gtk.linux.x86_64_0.9.3.201310150807/R"
$ cd $MY_R
#run the command line R
$ ./bin/R

got me the following error

./bin/R: line 236: /opt/architect/architect-stable/plugins/eu.openanalytics.architect.r.server.gtk.linux_stable/R/etc/ldpaths: No such file or directory
ERROR: R_HOME ('/opt/architect/architect-stable/plugins/eu.openanalytics.architect.r.server.gtk.linux_stable/R') not found

i opened the R shell command and saw that it sets R_HOME_DIR in line 4

$ less bin/R
# line 4: R_HOME_DIR="/opt/architect/architect-stable/plugins/eu.openanalytics.architect.r.server.gtk.linux_stable/R"

if i do a

ls  /opt/architect/architect-stable/plugins/eu.openanalytics.architect.r.server.gtk.linux_stable/

i got a

No such file or directory error

if i do a

ls -al  /opt/architect/architect-stable/plugins/eu.openanalytics.architect.r.server.gtk.linux_stable

i see that the dynamic link is misplaced

 -> /opt/architect/stable/20131204221312/plugins/eu.openanalytics.architect.r.server.gtk.linux_0.9.3.201310150807 

which does not exist!!!

the right one can be found in the directory /opt/architect/stable/20131204221312/plugins/

/opt/architect/stable/20131204221312/plugins/eu.openanalytics.architect.r.server.gtk.linux.x86_64_0.9.3.201310150807

if you compare both, you see that the correct one has the substring 'x86_64' which the wrong one did not have, so there seems something was wrong with a command such as 'uname' (maybe they used a parameter for uname which was not available on all platforms etc. when generating the script)

to fix this remove dynamic link

rm /opt/architect/architect-stable/plugins/eu.openanalytics.architect.r.server.gtk.linux_stable 

and point to true location

ln -s /opt/architect/stable/20131204221312/plugins/eu.openanalytics.architect.r.server.gtk.linux.x86_64_0.9.3.201310150807 /opt/architect/architect-stable/plugins/eu.openanalytics.architect.r.server.gtk.linux_stable

afterwards R is running fine and I can install what I want e.g. using source("http://bioconductor.org/biocLite.R") command

$ bin/R

Result:
R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> biocLite("cellHTS2")

now I can install all my needed packages from the command line using sudo rights!

Samstag, 1. Dezember 2012

Move an existing Apple Mac Os X Installation from an iMac to White Macbook (Moving installation to different Hardware)

Since we had some hardware related issues with an iMac model 2008 we had to bring it to the Apple customer service. As I knew this take some times after they got it fixed but we needed it at work I tried to migrate the existing iMac Lion installation to a white Macbook, both models from 2008.
I thought this would be easy because both have similar hardware and are both from 2008.
After using Disk Utility to create a complete dump from the existing iMac installation I transferred this image to the Macbook but it did not boot. It brought a "Question Mark folder icon" or the "Stop/Prohibitory sign" at boot up and stopped there. After booting into Single User Mode I learned that it was stuck at the error message:
IOBluetoothHCIController
So I thought maybe the iMac has a bluetooth controller which has been installed into the OS but the white macbook don't so I deleted the kext file but still not booting with the following error message appeared:
'could not find driver for platform AHCI'.
So I thought maybe the kernel extensions are not compatible or the kernel is different...
Messing around with mach_kernels and /System/Library/Extension folder It got me nowhere and I lost a whole business day with no results.
So I tried different things but in the end I found the following solution:
The iMac Lion installation was a very early one 10.7.1 and was never really updated. Also I taught that maybe I have to clean up all the systems caches because the hardware seems to be really different.
So first thing I updated the iMac Lion installation to the latest Mac Os X 10.7.5 and updated all software trough the "Software Updates" program. Then I installed CCleaner and deleted all unnecessary files, languages and repaired the permissions. Then I zeroed out the free space in order to get a smaller dmg. After that I installed Onyx and cleaned out all the system caches (Kernel, Boot, etc). I repaired the permissions with this program once again. After that I created the dmg dump using Disk Utility again and installed it on the white macbook. And it worked! Now it booted up nicely and works 100%.
So in the end I think it was due to some cache files which were still there from the iMac or maybe just the old operating system number.
So what I have learned is if you want to transfer/migrate an existing OS X
installation from one mac to another tidy up the system first!!!