Friday, April 29, 2011

apache2與svn版本 conflict

內建的apache2 與 macport build的 svn 版本相衝的問題記錄

[Thu Apr 28 23:52:36 2011] [error] [client ::1] (20014)Internal error: Expected FS format '2'; found format '4', referer: https://localhost/svn/
[Thu Apr 28 23:52:36 2011] [error] [client ::1] Could not fetch resource information. [500, #0], referer: https://localhost/svn/
[Thu Apr 28 23:52:36 2011] [error] [client ::1] Could not open the requested SVN filesystem [500, #160043], referer: https://localhost/svn/
[Thu Apr 28 23:52:36 2011] [error] [client ::1] Could not open the requested SVN filesystem [500, #160043], referer: https://localhost/svn/
[Thu Apr 28 23:52:36 2011] [error] [client ::1] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: https://localhost/svn/wap/

10.5.8 built-in apache2 參考的 /usr/bin/svn 1.4.4
但 /var/svn 是用 /opt/local/bin/svnadmin 1.6.16 建立出來的

Apr 29 06:10:39 pbg4-17 org.apache.httpd[65275]: httpd: Syntax error on line 485 of /private/etc/apache2/httpd.conf: Syntax error on line 3 of /private/etc/apache2/extra/httpd-subversion.conf: Cannot load /usr/libexec/apache2/mod_dav_svn_1.6.16.so into server: dlopen(/usr/libexec/apache2/mod_dav_svn_1.6.16.so, 10): Library not loaded: /usr/local/lib/libsvn_fs_base-1.0.dylib\n Referenced from: /usr/libexec/apache2/mod_dav_svn_1.6.16.so\n Reason: image not found

就算重build一個 mod_dav_svn_1.6.16.so, 也是沒有辦法
看起來是 apache2 參考到的 /usr/local/lib/libsvn_fs_base-1.0.dylib
沒有辦法打開這個 so

所以目前的方式是重新用 /usrbin/svnadmin 建立 repository

下一步可能考慮重新build apache2 2.2.17 and svn 1.6.16

[Fri Apr 29 06:17:43 2011] [notice] Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.7l DAV/2 SVN/1.4.4 configured -- resuming normal operations

Thursday, April 28, 2011

x11 on mac

1) execute X11.app
2) ssh -X -l remote_username remote_host
After login successfully,
3) export DISPLAY=mac_host:0.0
4) try xclock if displayed on the mac.

Monday, March 28, 2011

Prolific USB to RS232 on mac

After installing the driver for mac
>screen /dev/tty.usbserial 57600
(but it seems to filter out the control byte)

second solution
zterm

DIY solution
http://developer.apple.com/library/mac/#samplecode/SerialPortSample/Introduction/Intro.html

Friday, March 25, 2011

perl experience - ssh installation

Net::SSH::Perl
Net::SSH2
Net::OpenSSH


Problem:
Math::BigInt: couldn't load specified math lib(s), fallback to Math::BigInt::FastCalc at /opt/local/lib/perl5/site_perl/5.12.3/Crypt/DH.pm line 6

Workaround:
reinstall
Math::BigInt::GMP
Math::BigInt::Pari
Math::BigInt::BitVector (no such thing)

Reference:
http://www.perlmonks.org/?node_id=664894



問題 1:
Can't locate object method "new" via package "Net::SSH::Perl" (perhaps you forgot to load "Net::SSH::Perl"?) at rbt.pl line 28.
解決方法:
透過 perl -V 得知
@INC:
    /etc/perl
    /usr/local/lib/perl/5.10.1
    /usr/local/share/perl/5.10.1
    /usr/lib/perl5
    /usr/share/perl5
    /usr/lib/perl/5.10
    /usr/share/perl/5.10
    /usr/local/lib/site_perl
    .
發現有一個 /etc/perl/Net/SSH/Perl.pm -> /usr/share/perl5/Net/SSH.pm, 而它的版本是 0.09
而 Net::SSH::Perl 目前版本為 1.35
所以 mv /etc/perl/Net/SSH/Perl.pm to /etc/perl/Net/SSH/Perl.pm.deprecated

問題 2:
在 cpan, install Net::SSH::Perl
跑到最後,
Running make for S/SC/SCHWIGON/Net-SSH-Perl-1.35.tar.gz
  Has already been unwrapped into directory /root/.cpan/build/Net-SSH-Perl-1.35-NKUlxh

  CPAN.pm: Building S/SC/SCHWIGON/Net-SSH-Perl-1.35.tar.gz

Warning: Prerequisite 'Crypt::RSA => 1.37' for 'SCHWIGON/Net-SSH-Perl-1.35.tar.gz' failed when processing 'VIPUL/Crypt-RSA-1.99.tar.gz' with 'make_test => NO 2 dependencies missing (Tie::EncryptedHash,Crypt::CBC); additionally test harness failed'. Continuing, but chances to succeed are limited.
make: Warning: File `Makefile.PL' has modification time 1e+06 s in the future
Makefile out-of-date with respect to Makefile.PL
Cleaning current config before rebuilding Makefile...
make -f Makefile.old clean > /dev/null 2>&1
/usr/bin/perl Makefile.PL "INSTALLDIRS=site"
This is Net::SSH::Perl.

As of version 1.00, Net::SSH::Perl supports both the SSH1 and
SSH2 protocols natively. The two protocols have different
module prerequisitives, so you need to decide which protocol(s)
you plan to use. If you use one or the other, only those modules
for your chosen protocol will be installed; if you choose both,
all of the supporting modules will be installed. Please choose
the protocols you'd like to use from the following list ("Both"
is the default).

    [1] SSH1
    [2] SSH2
    [3] Both SSH1 and SSH2

Which protocol(s) do you plan to use? [3]

Some of the Net::SSH::Perl ciphers depend on a Crypt:: module from
CPAN. You may already have the necessary modules installed, in which
case you don't need to bother with this step. Otherwise you'll need
to install at least one cipher to use Net::SSH::Perl. Please choose
at least one from the following list (Crypt::IDEA is the default).

    [1] IDEA
    [2] DES
    [3] DES3
    [4] Blowfish
    [5] RC4

Enter your choices, separated by spaces: [1]

Checking for optional modules

Crypt::RSA is required if you wish to use the ssh-rsa public
key algorithm (ssh-dss is used by default).

Would you like to install it? (y/n) [y]

Checking if your kit is complete...
Looks good
Warning: prerequisite Crypt::RSA 1.37 not found.
Writing Makefile for Net::SSH::Perl
Writing MYMETA.yml and MYMETA.json
==> Your Makefile has been rebuilt. <==
==> Please rerun the make command.  <==
false
make: *** [Makefile] Error 1
  SCHWIGON/Net-SSH-Perl-1.35.tar.gz
  /usr/bin/make -- NOT OK
Running make test
  Can't test without successful make
Running make install
  Make had returned bad status, install seems impossible
Failed during this command:
 LDS/Crypt-CBC-2.32.tar.gz                    : make NO
 VIPUL/Tie-EncryptedHash-1.24.tar.gz          : make_test NO one dependency not OK (Crypt::CBC); additionally test harness failed
 VIPUL/Crypt-RSA-1.99.tar.gz                  : make_test NO 2 dependencies missing (Tie::EncryptedHash,Crypt::CBC); additionally test harness failed
 SCHWIGON/Net-SSH-Perl-1.35.tar.gz            : make NO

簡單說, 從倒數幾行提到以下幾個 depency 安裝失敗
Crypt-CBC-2.32
Tie-EncryptedHash-1.24
Crypt-RSA-1.99

解決方法:
到 ~/.cpan/build/ 找到相對應的資料夾內, 依序執行
>perl Makefile.PL
產生  Makefile, 如果有出現 depency 問題, 再逐一解決 depency 問題, 直到沒有再出現 depency 的問題
>make
如果 make fail, 如果是缺乏 library, 則安裝該 library, 如果 library 版本太舊, 則下載 library 源始碼, 自行編譯, 再安裝, 再重新跑 perl Makefile.PL
>make install
如果 make 沒問題, 執行 install

For example, when building Math::GMP, there was an error concerning
"GMP.xs:4:17: error: gmp.h: No such file or directory",
the solution is to
"apt-get install libgmp3-dev"

Monday, March 21, 2011

svn on leopard

svn on leopard experience
refer to http://www.sonzea.com/articles/subversion-trac.html


Error 1
bServer/Documents/favicon.ico, referer: https://localhost/repo
[Sun Mar 20 23:51:47 2011] [error] [client ::1] (20014)Internal error: Expected FS format '2'; found format '4'
[Sun Mar 20 23:51:47 2011] [error] [client ::1] Could not fetch resource information. [500, #0]
[Sun Mar 20 23:51:47 2011] [error] [client ::1] Could not open the requested SVN filesystem [500, #160043]
[Sun Mar 20 23:51:47 2011] [error] [client ::1] Could not open the requested SVN filesystem [500, #160043]
[Sun Mar 20 23:51:47 2011] [error] [client ::1] File does not exist: /Library/WebServer/Documents/favicon.ico, referer: https://localhost/repo

Reason
After google, the problem is that there are two versions of svnadmin in my leopard, one is the built-in /usr/bin/svnadmin, and the other is /opt/local/bin/svnadmin. I used /opt/local/bin/svnadmin to create the repository, but Apache used /usr/bin/svnadmin to process the repository, so the problem "(20014)Internal error: Expected FS format '2'; found format '4'" happened.

Thursday, February 03, 2011

How to learn external IP(外部IP)

using browser to check
www.whatismyip.com
http://checkip.dyndns.org:8245/
http://ipid.shat.net/iponly/


lynx -dump http://whatismyip.com | awk ‘/Your/{print $5}’
lynx -dump http://whatismyip.org/

wget -qO - http://cfaj.freeshell.org/ipaddr.cgi

html2text http://checkip.dyndns.org | cut -c21-35

snmpwalk -v 2c -c public $ROUTERIP ip | grep ipAdEntAddr |grep -v $ROUTERIP |grep -v 127.0.0.1 | awk '{ print $4 }'

#!/bin/bash
wget http://www.whatismyip.com/automation/n09230945.asp -O - -o /dev/null
echo

Sunday, January 30, 2011

curl/wget experience

curl -C - -o --location
"-C -" specifies Resume.
-o specifies the file name to store.
--location specifies the download address. If needed redirect, then follow redirect.

for example,
curl -C - -o bt4-r2-vm.tar.bz2 --location http://www.backtrack-linux.org/download.php?fname=bt4r2vm


wget --continue --trust-server-names http://downloads.raspberrypi.org/raspbian_latest
it will finally stores as 2014-12-24-wheezy-raspbian.zip.