LDAP is failing 'make test' with Segmentation fault - ldap

I am attempting to install LDAP on a virtual host. Following the quickstart guide I am building openldap on CentOS release 5.6 (Final). During configuration it complained about my BerkleyDB. So I built Berkeley DB 4.8.3 and ran
env CPPFLAGS=-I/usr/local/BerkeleyDB.4.8/include LDFLAGS=-L/usr/local/BerkeleyDB.4.8/lib ./configure
Successfully working through the makes I am failing at make test
>>>>> Starting test060-mt-hot for bdb...
running defines.sh
Running slapadd to build slapd database...
Running slapindex to index slapd database...
Starting slapd on TCP/IP port 9011...
/var/www/vhosts/poooblic.com/ldap/openldap-2.4.32/tests/../servers/slapd/slapd -s0 -f /var/www/vhosts/poooblic.com/ldap/openldap-2.4.32/tests/testrun/slapd.1.conf -h ldap://localhost:9011/ -
Testing basic monitor search...
Monitor searches
Testing basic mt-hot search: 1 threads (1 x 50000) loops...
./progs/slapd-mtread -H ldap://localhost:9011/ -D cn=Manager,dc=example,dc=com -w secret -e cn=Monitor -m 1 -L 1 -l 50000
Testing basic mt-hot search: 5 threads (1 x 10000) loops...
./progs/slapd-mtread -H ldap://localhost:9011/ -D cn=Manager,dc=example,dc=com -w secret -e cn=Monitor -m 5 -L 1 -l 10000
Testing basic mt-hot search: 100 threads (5 x 100) loops...
./progs/slapd-mtread -H ldap://localhost:9011/ -D cn=Manager,dc=example,dc=com -w secret -e cn=Monitor -m 100 -L 5 -l 100
Random searches
Testing random mt-hot search: 1 threads (1 x 50000) loops...
./progs/slapd-mtread -H ldap://localhost:9011/ -D cn=Manager,dc=example,dc=com -w secret -e dc=example,dc=com -f (objectclass=*) -m 1 -L 1 -l 50000
Testing random mt-hot search: 5 threads (1 x 10000) loops...
./progs/slapd-mtread -H ldap://localhost:9011/ -D cn=Manager,dc=example,dc=com -w secret -e dc=example,dc=com -f (objectclass=*) -m 5 -L 1 -l 10000
Testing random mt-hot search: 100 threads (5 x 100) loops...
./progs/slapd-mtread -H ldap://localhost:9011/ -D cn=Manager,dc=example,dc=com -w secret -e dc=example,dc=com -f (objectclass=*) -m 100 -L 5 -l 100
./scripts/test060-mt-hot: line 190: 15747 Segmentation fault $SLAPDMTREAD -H $URI1 -D "$MANAGERDN" -w $PASSWD -e "$BASEDN" -f "(objectclass=*)" -m $THR -L $OUTER -l $INNER >> $MTREADOUT 2>&1
slapd-mtread failed (139)!
>>>>> test060-mt-hot failed for bdb
(exit 139)
make[2]: *** [bdb-yes] Error 139
make[2]: Leaving directory `/var/www/vhosts/poooblic.com/ldap/openldap-2.4.32/tests'
make[1]: *** [test] Error 2
make[1]: Leaving directory `/var/www/vhosts/poooblic.com/ldap/openldap-2.4.32/tests'
make: *** [test] Error 2
I am not a sys admin and don't fully conceptualize the build process. What docs can I read to help me understand why it is failing and what can I do to work though it? Thanks!

Please follow below - feedback me incase of any issue.
cd db-4.7.25.NC
cd build_unix/
../dist/configure
make
make install
export CPPFLAGS="-I/usr/local/BerkeleyDB.4.7/include"
export LDFLAGS="-L/usr/local/BerkeleyDB.4.7/lib"
export LD_LIBRARY_PATH=/opt/db-4.7.25.NC/build_unix/.libs ( change this path as per your)
./configure
make depend
make
make test
Regards
Naveen

Related

How to suppress "killed by signal 1." error on ssh jump connection

I am using scp and ssh connections with following commands and yet keep getting "killed by signal 1." errors.
scp example:
$ scp -q '-oProxyCommand=ssh -W %h:%p {user}#{jump_server}' /path/file.txt
{user}#{server2}:/tmp/
Killed by signal 1.
ssh example:
$ ssh -A -J {user}#{jump_server} -q -o BatchMode=yes -o ServerAliveInterval=10 {user}#{server2} 'ps -ef | grep mysql | wc -l 2>&1'
2
Killed by signal 1.
I tried using -t:
$ ssh -t -A -J {user}#{jump_server} -t -q -o BatchMode=yes -o ServerAliveInterval=10 {user}#{server2} 'ps -ef | grep mysql | wc -l 2>&1'
2
Killed by signal 1.
I tried using LogLevel:
$ ssh -o LogLevel=QUIET -A -J {user}#{jump_server} -q -o BatchMode=yes -o ServerAliveInterval=10 -o LogLevel=QUIET {user}#{server2} 'ps -ef | grep mysql | wc -l 2>&1'
2
Killed by signal 1.
I tried using the ProxyCommand option:
$ ssh -q -oProxyCommand="ssh -W %h:%p {user}#{jump_server}" -q -o BatchMode=yes -o ServerAliveInterval=10 {user}#{server2} 'ps -ef | grep mysql | wc -l 2>&1'
2
Killed by signal 1.
How do I suppress this error message on command line in a bash script?
Add 2>/dev/null to the ssh command:
$ ssh -q -oProxyCommand="ssh -W %h:%p {user}#{jump_server}" 2>/dev/null
If you need to see errors you could go through sed:
$ ssh ... 2>&1 | sed '/^Killed by signal.*/d'

Ansible giving ssh_exchange_identification ERROR

My Ansible playbook connects to a remote node using a Proxy.
When the Ansible play book runs; it gives the following ERROR while doing the ssh step.
[root#vm1-msdp ANSIBLE]# ansible-playbook fend_file.yaml -i env/target -vvvvv
PLAY [LAB1] *******************************************************************
GATHERING FACTS ***************************************************************
<10.169.99.222> ESTABLISH CONNECTION FOR USER: msdp
<10.169.99.222> REMOTE_MODULE setup
<10.169.99.222> EXEC sshpass -d9 ssh -C -tt -vvv -o ProxyCommand="nc -x 142.133.134.161:1088 %h %p" -o StrictHostKeyChecking=no -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o User=msdp -o ConnectTimeout=10 10.169.99.222 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1473708903.98-28407509853006 && echo $HOME/.ansible/tmp/ansible-tmp-1473708903.98-28407509853006'
fatal: [10.169.99.222] => SSH Error: ssh_exchange_identification: Connection closed by remote host
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
But when I run the ssh command myself, I am able to successfully connect.
[root#vm1-msdp ANSIBLE]# ssh -C -tt -o ProxyCommand="nc -x 142.133.134.161:1088 %h %p" -o StrictHostKeyChecking=no -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o User=root -o ConnectTimeout=10 10.169.99.222
root#10.169.99.222's password:
Last login: Mon Sep 12 12:28:19 2016 from 10.169.102.6
root#IC02 ~ #
Do I need to clear any ansible files ?
When you run the SSH command manually, you are specifying the root user. Your Ansible playbook is using your local user of msdp. Try setting your ansible_user variable in your inventory file. Maybe something like:
10.169.99.22 ansible_user=root

Rsnapshot Issue

I am trying to do some backups with Rsnapshot and am constantly getting this error:
/usr/bin/rsync -av --delete --numeric-ids --relative --delete-excluded \
--stats -L --whole-file --exclude=*/web/ --exclude=*/tmp/ \
--exclude=*/dms/ --exclude=*/Recycle\ Bin/ --exclude=*/app/logs/ \
--exclude=*/app/cache/ --exclude=*/vendor/ --exclude=/var/www/files/ \
--exclude=*/releases/ \
--exclude=/var/www/www.xxx.net/app/var/sessions/ \
--rsync-path=rsync_wrapper.sh --exclude=/var/www/psan-static/ \
--rsh=/usr/bin/ssh -p 9922 backup#xxx.xxx.xxx.xxx:/var/www \
/data-ext/backups/rsnapshot/daily.0/myserver/
Unexpected remote arg: backup#xxx.xxx.xxx.xxx:/var/www
rsync error: syntax or usage error (code 1) at main.c(1348) [sender=3.1.0]
----------------------------------------------------------------------------
rsnapshot encountered an error! The program was invoked with these options:
/usr/bin/rsnapshot daily
----------------------------------------------------------------------------
ERROR: /usr/bin/rsync returned 1 while processing backup#xxx.xxx.xxx.xxx:/var/www/
/usr/bin/logger -i -p user.err -t rsnapshot /usr/bin/rsnapshot daily: \
ERROR: /usr/bin/rsync returned 1 while processing \
backup#xxx.xxx.xxx.xxx:/var/www/
I was trying to play with parameters but cannot figure out what's the issue
The issue was with the
--exclude=*/Recycle\ Bin/
This needs to be quoted as spaces seems not to work.
--exclude="*/Recycle\ Bin/"

rsync ssh file copying to GCE instance fails with permission denied

I'm executing the following on my local machine which is authenticated with my project in Google Compute Engine via the Google Cloud SDK:
rsync -avu --omit-dir-times -e ssh \
-o UserKnownHostsFile=/dev/null \
-o CheckHostIP=no -o StrictHostKeyChecking=no \
-i /home/fredrik/.ssh/google_compute_engine \
/somefolder/hello.txt \
1.2.3.4:/mymount/
...where 1.2.3.4 is the public IP of my GCE instance and I get the following error:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(600) [sender=3.0.6]
The machine I execute the command on is authenticated and can, e.g., successfully execute gcloud compute ssh instance-1 in order to SSH into the same instance.
What do I need to do in order to successfully execute the rsync command?
Quotes around -e solved it:
rsync -avu --omit-dir-times -e "ssh -o UserKnownHostsFile=/dev/null -o CheckHostIP=no -o StrictHostKeyChecking=no -i /home/fredrik/.ssh/google_compute_engine" /somefolder/hello.txt 1.2.3.4:/mymount/

How do I handle sqlcmd.exe "Timeout expired" message, which doesn't appear to be an error?

When running the following command, sqlcmd.exe writes "Timeout Expired" to the console but the exit code it returns is 0.
sqlcmd.exe -X1 -b -S "[ValidServer]" -d "[ValidDatabase]" -t 5 -i "C:\test\ScriptThatRunsLongerThan5Seconds.sql" -E
Please notice I'm purposely setting the querytimeout, -t, to 5 seconds. Also, I'm the -b argument, which I thought should return exit code 1 for errors. I've also tried the -r1 argument and the -m-1 argument to no avail.
I've also looked at the Troubleshooting: Timeout Expired article and noticed that it references an "Error: -2". The sqlcmd.exe documentation for all the arguments related to errors seem to only deal with error codes greater than 0, so perhaps "Timeout expired" is not an error? Also, no matter what arguments I've tried I only see "Timeout expired" as the output, no error code at all.
Lastly, here are all the commands I've tried, only edited to protect server and database names:
C:\>sqlcmd.exe -X1 -b -S "[ValidServer]" -d "[ValidDatabase]" -t 5 -i "C:\test\ScriptThatRunsLongerTHan5Seconds.sql" -E
Timeout expired
C:\>sqlcmd.exe -X1 -b -S "[ValidServer]" -d "[ValidDatabase]" -t 5 -i "C:\test\ScriptThatRunsLongerTHan5Seconds.sql" -E -r1
Timeout expired
C:\>sqlcmd.exe -X1 -b -S "[ValidServer]" -d "[ValidDatabase]" -t 5 -i "C:\test\ScriptThatRunsLongerTHan5Seconds.sql" -E -V16
Timeout expired
C:\>sqlcmd.exe -X1 -b -S "[ValidServer]" -d "[ValidDatabase]" -t 5 -i "C:\test\ScriptThatRunsLongerTHan5Seconds.sql" -E -m-1
Timeout expired
C:\>sqlcmd.exe -X1 -S "[ValidServer]" -d "[ValidDatabase]" -t 5 -i "C:\test\ScriptThatRunsLongerTHan5Seconds.sql" -E -m-1
Timeout expired
C:\>sqlcmd.exe -X1 -b -S "[ValidServer]" -d "[ValidDatabase]" -t 5 -i "C:\test\ScriptThatRunsLongerTHan5Seconds.sql" -E -r0
Timeout expired
C:\>sqlcmd.exe -X1 -b -S "[ValidServer]" -d "[ValidDatabase]" -t 5 -i "C:\test\ScriptThatRunsLongerTHan5Seconds.sql" -E -o "sqlError.txt"
C:\>notepad sqlError.txt
#REM only "Timeout expired" was written to sqlError.txt
C:\>del sqlError.txt
C:\>sqlcmd.exe -X1 -S "[ValidServer]" -d "[ValidDatabase]" -t 5 -i "C:\test\ScriptThatRunsLongerTHan5Seconds.sql" -E -m-1
Timeout expired
C:\>sqlcmd.exe -X1 -S "[ValidServer]" -d "[ValidDatabase]" -t 5 -i "C:\test\ScriptThatRunsLongerTHan5Seconds.sql" -E -V-3
Sqlcmd: '-V -3': Severity level has to be a number between 1 and 25.
C:\>sqlcmd.exe -X1 -S "[ValidServer]" -d "[ValidDatabase]" -t 5 -i "C:\test\ScriptThatRunsLongerTHan5Seconds.sql" -E -V1
Timeout expired
C:\>sqlcmd.exe -X1 -S "[ValidServer]" -d "[ValidDatabase]" -t 5 -i "C:\test\ScriptThatRunsLongerTHan5Seconds.sql" -E -r1
Timeout expired
Update: I should note I'm calling this from a C# console application via the Systems.Diagnostics.Process, so I'd like the ExitCode to be 1 if possible. I'm not sure if I can capture ERRORLEVEL.
Further Update: My machine is writing stderr to stdout for some reason, so I'm unable to test the validity of Stefan M's answer. I believe his answer is most likely correct as I've interpreted the documentation for sqlcmd.exe in the same manner. I have another question about why my machine is writing stderr to stdout here.
You can't use -V-3, the lowest value is -V1. In Combination with -b you should get the desired result. The value "ERRORLEVEL" will be set to 1 only if the severity is HIGHER than the value of -V.
My best guess is (not tested):
sqlcmd.exe -X1 -b -S "[ValidServer]" -d "[ValidDatabase]" -t 5 -i "C:\test\ScriptThatRunsLongerThan5Seconds.sql" -E -V1
And then try:
echo %ERRORLEVEL%
The relevant part is:
The value that is returned to the DOS ERRORLEVEL
variable is 1 when the SQL Server error message has a severity level
greater than 10; otherwise, the value returned is 0. If the -V option
has been set in addition to -b, sqlcmd will not report an error if the
severity level is lower than the values set using -V
From http://technet.microsoft.com/en-us/library/ms162773.aspx
-b
Specifies that sqlcmd exits and returns a DOS ERRORLEVEL value when an error occurs. The value that is returned to the DOS ERRORLEVEL
variable is 1 when the SQL Server error message has a severity level
greater than 10; otherwise, the value returned is 0. If the -V option
has been set in addition to -b, sqlcmd will not report an error if the
severity level is lower than the values set using -V. Command prompt
batch files can test the value of ERRORLEVEL and handle the error
appropriately. sqlcmd does not report errors for severity level 10
(informational messages).
If the sqlcmd script contains an incorrect comment, syntax error, or is missing a scripting variable, ERRORLEVEL returned is 1.
-m error_level
Controls which error messages are sent to stdout. Messages that have a severity level greater than or equal to this level are sent.
When this value is set to -1, all messages including informational
messages, are sent. Spaces are not allowed between the -m and -1. For
example, -m-1 is valid, and -m -1 is not.
This option also sets the sqlcmd scripting variable SQLCMDERRORLEVEL. This variable has a default of 0.
-V error_severity_level
Controls the severity level that is used to set the ERRORLEVEL variable. Error messages that have severity levels greater than or
equal to this value set ERRORLEVEL. Values that are less than 0 are
reported as 0. Batch and CMD files can be used to test the value of
the ERRORLEVEL variable.