7/21/2015

Ansible freebsd ssh connection hung

Recently I faced with problem which caused almost a week to find right solution

So the problem was that I wasn't able to connect to my freebsd host from ansible server.

so symptoms were like that

sshpass -d6 ssh -C -v -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/michael/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o User=root -o ConnectTimeout=10 192.168.xxx.xxx /bin/csh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/local/bin/python'
[............]

Warning: Permanently added '192.168.2.110' (ECDSA) to the list of known hosts.debug1: SSH2_MSG_NEWKEYS sentdebug1: expecting SSH2_MSG_NEWKEYSdebug1: SSH2_MSG_NEWKEYS receiveddebug1: Roaming not allowed by serverdebug1: SSH2_MSG_SERVICE_REQUEST sentdebug1: SSH2_MSG_SERVICE_ACCEPT receiveddebug1: Authentications that can continue: publickey,keyboard-interactivedebug1: Next authentication method: keyboard-interactive

ansible new-hosts -l freebsd.local -m shell -a 'uptime'  -vvv
<192.168.2.110> ESTABLISH CONNECTION FOR USER: root
<192.168.2.110> REMOTE_MODULE command uptime #USE_SHELL
<192.168.2.110> EXEC sshpass -d6 ssh -C -v -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/home/michael/.ansible/cp/ansible-ssh-%h-%p-%r" -o StrictHostKeyChecking=no -o GSSAPIAuthentication=no -o PubkeyAuthentication=no -o User=root -o ConnectTimeout=10 192.168.xxx.xxx /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/local/bin/python'

and in that state connection could be couple of hours without any output on ansible server or freebsd logs.

The reason of the problem was FreeBSD PAM module 

I had to change line 12 (in my case ) in /etc/pam.d/sshd

was :

auth            required        pam_unix.so             no_warn try_first_pass

become:

auth            required        pam_unix.so             no_warn try_first_pass authtok_prompt=Password:

no sshd restart required

after that changes I was able to get info from my freebsd hosts

 ansible new-hosts -l freebsd.local -m  ping  
freebsd.local | success >> {
    "changed": false, 
    "ping": "pong"
}
ansible new-hosts -l freebsd.local -m shell -a 'uptime'  
freebsd.local | success | rc=0 >>
 2:30PM  up 4 days, 45 mins, 2 users, load averages: 0.11, 0.09, 0.07



1/20/2014

installing ffmpeg-php with php5.3+

the main purpose of this small note is to save your time from the mistakes I've made

so what we have:

centos 5 or 6
php 5.3, 5.4 or 5.5

and great desire to have ffmpeg-php installed on that server :)

so

wget http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2/download
tar xf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0

phpize
 ./configure 
 and right before make we will do a magic

1) vi ffmpeg_frame.c
 :%s/PIX_FMT_RGBA32/PIX_FMT_RGB32

2) vi ffmpeg_movie.c
row 311: list_entry *le; TO zend_rsrc_list_entry *le;
row 346: list_entry new_le; TO zend_rsrc_list_entry new_le;
row 360: hashkey_length+1, (void *)&new_le, sizeof(list_entry), TO hashkey_length+1, (void *)&new_le,sizeof(zend_rsrc_list_entry), 


make && make install





5/13/2013

Push to multiple remote repositories from a single local repo in Mercurial

You can set multiple remote repository aliases in the [paths] section of the repository configuration file. This file is in .hg/hgrc, and you would add paths like this:
[paths]
default = http://your-default-repo.com/repo
2nd = http://your-second-repo.com/repo
Then you would run hg push 2nd to push to your second repo and hg push to push to your default repo. 
Unfortunately its not possible to run  hg push * to push to all remote hosts at once, you have to specify 
each push destination one by one.

8/09/2012

view confs without comments

Just to note to myself. how to generate clean configs w/out any comments


sed -e '/^$/d;/^#/d;/^;/d' /etc/php.ini > php.ini.clean

result

root@ ~ # cat /etc/php.ini |wc -l
1249
root@ ~ # cat php.ini.clean |wc -l
182


5/24/2012

{new stable release} Zabbix auto install scripts

!!!NOTE: this scripts only for education/testing/investigation purposes, use on your own risk

I've prepared 2 auto Zabbix 2.0.0  installation scripts, tested on Centos 5.8 and 6.2

https://www.dropbox.com/s/pdekmf5yi6on8o3/zabbix20_el6_install.sh << Centos 6.2
https://www.dropbox.com/s/6sdlerh4ufthys4/zabbix20_el5_install.sh << Centos 5.8

short desc
#!/bin/sh
#
# Centos 6.2 (5.8) zabbix 2 install w/ psql9.1 jabber IPv6 support
#
# known problems:
# zabbix web config not fully configured during installation
# need manually to  setup $ZBX_SERVER  and $ZBX_SERVER_NAME parameters after installation finish
# after installation rpm prepared and it is in /root/rpmbuild/RPMS/
# do not know why but in this version zabbix won't work with DB user other than root had to create role for root
#
# reboot required after installation
#
#
# software distributed under the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND
# (c) Michael Veselovski support@omgsw.com
# v1: initial release 4/10/2011
# v2: 24/12/2011 new release:
# - psql 9.1 support added
# - db user should be provided during installation
# - zabbix 1.9.8 support added
# v3.1: 15/05/2012 new release
# - script complete rewitten for Centos 6.2 suppport
# - script installing Zabbix 2.0.0rc4 /psql
# v3.2: 15/05/2012 second script for Centos 5.8
# - separate script for Centos 5.8 
# v4: 23/05/2012 script for zabbix 2.0.0
# - same problems as above

5/15/2012

{new release} Zabbix auto install scripts

!!!NOTE: this scripts only for education/testing/investigation purposes, use on your own risk


I've prepared 2 auto Zabbix 2.0.0rc4 installation scripts, tested on Centos 5.8 and 6.2

https://www.dropbox.com/s/unzvemer4itptdt/zabbix2rc4_el5_install.sh
https://www.dropbox.com/s/88nudr29280xm61/zabbix2rc4_el6_install.sh

short desc
#!/bin/sh
#
# Centos 6.2 (5.8) zabbix 2rc4 install w/ psql9.1 jabber IPv6 support
#
# known problems:
# zabbix web config not fully configured during installation
# need manually to  setup $ZBX_SERVER  and $ZBX_SERVER_NAME parameters after installation finish
# after installation rpm prepared and it is in /root/rpmbuild/RPMS/
# do not know why but in this version zabbix won't work with DB user other than root had to create role for root
#
# reboot required after installation
#
#
# software distributed under the License is distributed on an "AS IS" BASIS,  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND
# (c) Michael Veselovski support@omgsw.com
# v1: initial release 4/10/2011
# v2: 24/12/2011 new release:
# - psql 9.1 support added
# - db user should be provided during installation
# - zabbix 1.9.8 support added
# v3.1: 15/05/2012 new release
# - script complete rewitten for Centos 6.2 suppport
# - script installing Zabbix 2.0.0rc4 /psql
# v3.2: 15/05/2012 second script for Centos 5.8
# - separate script for Centos 5.8

5/07/2012

How to upgrade Joomla from 1.5/1.6 to 2.5

BEFORE APPLYING ANY CHANGES YOU SHOULD CREATE A BACKUP

1) Go to http://domain/administrator => Extensions => Install/Uninstall => Upload Package File “com_jupgrade-2.5.1.zip” => Upload File & Install

2) Extensions => Plugin Manager => find “System - Mootools Upgrade” => Enabled “Yes”

3) create “jupgrade”subfolder in RootDirectory (/var/www/public_html/jupgrade), change owner to Apache user and change permissions to “777”

4) Download “http://joomlacode.org/gf/download/frsrelease/16804/73116/Joomla_2.5.3-Stable-Full_Package.zip” (download link: http://joomlacode.org/gf/project/joomla/frs/) to this directory (./jupgrade) and unpack

5) Go to http://domain/administrator => Components => Jupgrade => Parameters:
Distribution => Joomla 2.5
Skip checks => Yes
Skip Download => Yes
Skip Decompress => Yes
Enable migration debug => Yes
Enable Mootools version debug => Yes
DO NOT FORGET “Save” on the top and close this window.

6) Press “START UPGRADE”

7) After upgrade you should check all links. You may do that via “Xenu's Link Sleuth”.
This program works under Fedora, Red Hat, Ubuntu (use Wine) and Windows.
You may download it from “http://home.snafu.de/tilman/XENU.ZIP”, just unzip, install and start under Wine.
1) Go to “File => Check URL”
2) Enter “http://domain/jupgrade/”, NOT http://domain/jupgrade, DO NOT FORGET the last “/”.
(More about this program: http://home.snafu.de/tilman/xenulink.html)

8) If all looks fine - create another subfolder “my_old_joomla” in RootDirectory and move all content FROM RootDirectory to this subdirectory (from /var/www/public_html/ to /var/www/public_html/my_old_joomla) except “jupgrade” and “my_old_joomla” folders.

9) As we can see the RootDirectory is contained only two folders “jupgrade” and “my_old_joomla” you should move all content from /var/www/public_html/jupgrade to /var/www/public_html/

10) That’s all.


(c)  Yan Ternovsky

5/05/2012

Changing tables engine from MyISAM to InnoDB

1. Edit /etc/my.cnf , make sure that:
  
#skip-innodb - commented out
innodb_file_per_table = ON

2. install Percona toolkit

Visit http://www.percona.com/software/percona-toolkit/ to download the latest release of Percona Toolkit. Or, get the latest release from the command line:
 
wget percona.com/get/percona-toolkit.tar.gz

wget percona.com/get/percona-toolkit.rpm

wget percona.com/get/percona-toolkit.deb

You can also get individual tools from the latest release:
 
wget percona.com/get/TOOL 
 
Replace TOOL with the name of any tool.

3. using pt-find convert tables from MyISAM to  InnoDB

pt-find db-name --engine MyISAM --exec "ALTER TABLE %D.%N ENGINE=INNODB" --print

[how to]Windows slow download speed

in case if Windows servers show poor download performance in clouds based on Onapp software its necessary to do the following

Networking: Xen network adapter->Xen network device drivers-> Properties
Configure:  -> Properties->Advanced

In advanced properties should be set:
CheckSumOffload-> Disabled
LargeSendOffload->Disabled

and as usual reboot VPS

1/20/2012

mdadm

1. start raid

mdadm --assemble --scan

2. start raid in case if you do not have /etc/mdadm.conf (should have raid UUID)

mdadm /dev/md0 --assemble -u e6d85d3d:d20ddcfc:c7cxxxxx:6a0xxxx

3. generate /etc/mdadm.conf

 mdadm --detail --scan >> /etc/mdadm.conf